POST /v1/embeddings
Creates embedding vectors for one or more strings. OpenAI-compatible: any OpenAI SDK, LangChain, LlamaIndex, or LiteLLM configuration works by pointing its base URL at the gateway.
Embedding models use the same model:level naming as every other model (for example titan-embed-text-v2:il5), so your text is processed on infrastructure authorized at the level you request.
Request
Headers
Body Parameters
Unrecognized fields (such as
user or dimensions) are ignored. Vector size is fixed per model.
Example
Response
data[i] corresponds to input[i]. With encoding_format: "base64", embedding is a base64 string of little-endian float32 values.
Models
Vector size is fixed per model so that an index you build today stays valid.
Behavior and Limits
- Batching. Up to 512 strings per request; larger batches are rejected with a
400rather than truncated, so split them client-side. Each string ininputis embedded as its own upstream call; a request with many strings takes correspondingly longer. Large ingestion jobs may see429responses when the upstream per-minute quota is reached — standard client retry with backoff handles this. - Over-length input returns
400; text is never silently truncated. - Billing is per input token at the model’s rate. There are no output tokens.
- Nothing is stored. Inputs and vectors are returned to you and discarded, the same zero-persistence posture as every other endpoint.
- Embedding models are rejected on
/v1/chat/completions,/v1/messages, and/v1/responses, and chat models are rejected here, each with a400that names the correct endpoint. - There is no Anthropic-SDK equivalent of this endpoint; use an OpenAI-compatible client for embeddings even if the rest of your application uses
/v1/messages.
Errors
See Errors. Common cases: unknown or non-embedding model (400), empty string in input (400), upstream rate limit (429).