POST / turns one or more texts into vectors of numbers. Two texts with similar meanings produce similar vectors: that is the basis of semantic search, document clustering and duplicate detection. The endpoint follows the OpenAI format, so the SDKs work unchanged.
POST https://api.realmoon.ai/v1/embeddings- Authentication: an
sk-moon-…key with theinferencescope (see Authentication). - Body: JSON, 8 MB at most.
- Response: a
listobject of vectors.
ParametersLink to the Parameters section
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | yes | An embedding model from GET /. |
input | string, array of strings, or tokens | yes | The text, or up to 2,048 texts. A list of integers (or a list of lists of integers) is read as pre-tokenized input. No empty strings. |
dimensions | integer | no | Vector size, between 1 and the model’s size. Only for models that accept it (custom_dimensions set to true in /v1/models). |
encoding_format | string | no | float (default) or base64: the numbers as little-endian float32, base64-encoded. |
input_type | string | no | query (a question) or document (a text to retrieve), for models that tell the two apart. |
user | string | no | Your end user’s identifier. Accepted, not passed on. |
Any other parameter is rejected with 400 .
ExampleLink to the Example section
curl https://api.realmoon.ai/v1/embeddings \
-H "Authorization: Bearer $MOONAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistralai/mistral-embed-2312",
"input": ["How do I cancel my contract?", "Store opening hours"]
}'import os
from openai import OpenAI
client = OpenAI(base_url="https://api.realmoon.ai/v1", api_key=os.environ["MOONAI_API_KEY"])
result = client.embeddings.create(
model="mistralai/mistral-embed-2312",
input=["How do I cancel my contract?", "Store opening hours"],
)
for item in result.data:
print(item.index, len(item.embedding))import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://api.realmoon.ai/v1', apiKey: process.env.MOONAI_API_KEY });
const result = await client.embeddings.create({
model: 'mistralai/mistral-embed-2312',
input: ['How do I cancel my contract?', 'Store opening hours'],
});
for (const item of result.data) console.log(item.index, item.embedding.length);ResponseLink to the Response section
{
"object": "list",
"model": "mistralai/mistral-embed-2312",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, 0.0789] },
{ "object": "embedding", "index": 1, "embedding": [-0.0311, 0.0042, 0.0517] }
],
"usage": { "prompt_tokens": 18, "total_tokens": 18, "credits": 1 }
}The vectors are shortened in the example: a real vector from this model has 1,024 numbers.
| Field | Type | Description |
|---|---|---|
object | string | Always list. |
model | string | The model you called. |
data[].object | string | Always embedding. |
data[].index | integer | The text’s position in input. |
data[].embedding | array or string | The vector: a list of numbers, or a base64 string with encoding_format: . |
usage.prompt_tokens, usage.total_tokens | integer | Tokens counted. |
usage.credits | integer | Credits charged for the request. |
Headers: X-Moon-Request-Id, X-Moon-Prompt-Storage: , X-Moon-Blur and, when Moon Blur replaced values, X-Moon-Blur-Redactions.
Moon BlurLink to the Moon Blur section
When Moon Blur is on for the key (the default), the personal data it detects in the texts is replaced before sending to the model. Only the vectors of the affected passages change. The X-Moon-Blur header is on or off, and X-Moon-Blur-Redactions gives the number of values replaced. Text given as tokens is not read by Moon Blur. See Privacy.
ModelsLink to the Models section
List as of November 5, 2026; the current list, with prices and vector sizes, comes from GET /.
| Model | Vector size | dimensions |
|---|---|---|
openai/ | 1,536 | yes |
openai/ | 3,072 | yes |
mistralai/ | 1,024 | no |
mistralai/ | 1,536 | no |
google/ | 3,072 | no |
qwen/ | 4,096 | no |
qwen/ | 2,560 | no |
baai/bge-m3 | 1,024 | no |
intfloat/ | 1,024 | no |
voyageai/, voyageai/, voyageai/ | depends on the model | no |
perplexity/ | depends on the model | no |
Use the same model for your documents and for your queries: vectors from two different models cannot be compared.
CostsLink to the Costs section
Before the call, the request holds the most the texts can count (one token per byte of text, plus a few tokens per text). It is then billed on the tokens actually counted, or on the actual cost reported by the provider. A request that fails costs nothing.
LimitsLink to the Limits section
| Limit | Value |
|---|---|
| Texts per request | 2,048 |
| Request size | 8 MB, and about 1 million tokens |
| Response size | number of texts × vector size: 3 million numbers at most |
| Requests in flight per workspace | 8 |
| Wait for the model’s response | 85 seconds at most |
Beyond the response size, the API tells you how many texts this model accepts in one request: split them across several calls.
ErrorsLink to the Errors section
| HTTP | code | Meaning |
|---|---|---|
| 400 | missing_required_parameter | model is missing. |
| 400 | unknown_parameter | Unknown parameter. |
| 400 | unsupported_parameter | dimensions on a model that does not accept it, or a value the model rejects (with a hint). |
| 400 | unsupported_value | dimensions out of range, or unknown encoding_format. |
| 400 | null | Malformed, empty or oversized input, or too many texts (param: ); unknown input_type; invalid JSON body. |
| 403 | org_policy | Your organization’s rules refuse this model. |
| 404 | model_not_found | Unknown model, or one that does not serve this endpoint. |
| 413 | request_too_large | Body larger than 8 MB. |
| 413 | moon_blur_payload_too_large | A text exceeds 500,000 characters, too long for Moon Blur: nothing is sent or charged. |
| 429 | too_many_concurrent | Already 8 embedding requests in flight for this workspace. |
| 429 | upstream_rate_limited | The model is overloaded: retry after Retry-After (10 seconds). |
| 502, 504 | upstream_error, upstream_timeout | The model failed or did not respond in time. |
| 503 | moon_blur_unavailable | Moon Blur could not scan the texts: nothing is sent or charged. |
Key, balance and spend cap errors are in Errors.