API reference · API
Create embeddings (OpenAI wire format)
POST/v1/embeddingsAPI keyNo key
Goes through the same dispatch discipline as a completion: key auth, rate limit, key policy, credits, and metering, with completion tokens recorded as zero. Answers 501 unsupported_capability when the upstream that serves the chosen model cannot embed. With no key and x402 on, a 402 names the price; see GET /api/x402.
Request body
application/json, required
| Field | Type | What it is |
|---|---|---|
| modelrequired | string | A catalog model id. At most 200 characters. |
| inputrequired | string or array of string or array of integer or array of array of integer | A string, or an array of strings or token arrays. |
| encoding_format | string | One of "float", "base64". |
| dimensions | integer | At most 16384. |
| user | string | At most 200 characters. |
Example
{
"model": "antimatter/auto",
"input": "Say hello in five words."
}Answer 200
The embedding vectors and the prompt token count.
Headers: x-antimatter-upstream, x-antimatter-request-id, x-request-id, x-antimatter-cost-micros, x-antimatter-cost-breakdown, x-antimatter-adjusted, x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset
| Field | Type | What it is |
|---|---|---|
| object | string | |
| model | string | |
| data | array of object | |
| data[] | string | |
| data[] | integer | |
| data[] | array of number | |
| usage | object | |
| usage. | integer | |
| usage. | integer | |
| usage. | number | |
| usage. | CostDetails | usage.cost_details: what usage.cost is made of, in dollars, summing to it exactly. The same figures as the x-antimatter-cost-breakdown header. Never the upstream's own reported charge. |
| usage. | number | Prompt tokens at the upstream's input rate. |
| usage. | number | Prompt tokens the vendor served from its cache, at its cache read rate. |
| usage. | number | Prompt tokens written into the vendor's cache, at its cache write rate. |
| usage. | number | Answer tokens other than reasoning. |
| usage. | number | Reasoning tokens, inside completion_tokens, at the output rate. |
| usage. | number | A paid tool or search beside the tokens. |
| usage. | number | The operator's stated markup on the parts above, less any discount. |
| usage. | number | What no card explains: a replayed cached answer, or an upstream charge above its published card, passed on at cost plus the markup. |
Errors
- 401OpenAI shaped error.
- 402OpenAI shaped error.
- 403OpenAI shaped error.
- 413OpenAI shaped error.
- 429OpenAI shaped error.
- 499The client closed the connection before the response finished.
- 501OpenAI shaped error.
- 504The upstream did not answer within the gateway's timeout (upstream_timeout).
Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.