Embeddings

View as Markdown

The Embeddings API turns text into vectors you can use for semantic search, retrieval, clustering, and ranking.

1POST https://api.meshapi.ai/v1/embeddings
2Authorization: Bearer rsk_<your_key>

Quick start

$curl https://api.meshapi.ai/v1/embeddings \
> -H "Authorization: Bearer <YOUR_RSK_KEY>" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "openai/text-embedding-3-small",
> "input": "The quick brown fox jumps over the lazy dog."
> }'

Request fields

FieldTypeNotes
modelstringEmbedding model ID. Required unless your key has a default model.
inputstring | string[] | int[] | int[][]Text or tokenized input.
dimensionsintegerOptional output size for models that support truncation.
encoding_format"float" | "base64"Output format.
input_typestringOptional hint for asymmetric embedding models.
providerstring | objectOptional provider routing preferences.
userstringOptional end-user identifier for abuse monitoring.

Batch input in a single request

You can embed multiple strings in one API call:

$curl https://api.meshapi.ai/v1/embeddings \
> -H "Authorization: Bearer <YOUR_RSK_KEY>" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "openai/text-embedding-3-small",
> "input": [
> "first sentence",
> "second sentence",
> "third sentence"
> ]
> }'

The returned data array matches the order of your input array.

Response shape

1{
2 "object": "list",
3 "data": [
4 {
5 "object": "embedding",
6 "index": 0,
7 "embedding": [-0.0123, 0.0456]
8 }
9 ],
10 "model": "openai/text-embedding-3-small",
11 "usage": {
12 "prompt_tokens": 12,
13 "total_tokens": 12
14 }
15}

Choosing a model

Use GET /v1/models to inspect available embedding models and their pricing. For embeddings, the most useful fields are:

  • model_type
  • context_length
  • pricing
  • is_free

SDK coverage

The official SDKs all expose first-class embeddings resources:

  • Node: client.embeddings.create(...)
  • Python: client.embeddings.create(...)
  • Go: client.Embeddings.Create(...)
  • Java: client.embeddings().create(...)

Common errors

HTTPMeaning
401Missing or invalid API key
402Balance or spend limit issue
422Invalid request body
429Rate limit exceeded