Create Embeddings
Create embeddings through nRouter with one POST to /v1/embeddings, with models from OpenAI, Cohere, Voyage, and Vertex for search and RAG workloads.
Create an embedding with one POST to /v1/embeddings. Send text; the response carries its vector — the input to semantic search, retrieval-augmented generation (RAG), and clustering. Models from OpenAI, Cohere, Voyage, and Google Vertex AI run through the same key, budgets, and request logs as your chat traffic.
Send the request
curl https://api.nrouter.ai/v1/embeddings \
-H "Authorization: Bearer $NROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "How do fallbacks work?"
}'input accepts a single string or an array of strings, so a batch of texts embeds in one request. On the text-embedding-3 models, dimensions can set the size of the returned vectors.
Shape the response
Three optional fields control what comes back:
encoding_format—float(the default) returns each vector as an array of numbers;base64returns the same vectors base64-encoded, which significantly reduces JSON transfer size on large batches.dimensions— on thetext-embedding-3models, sets the size of the returned vectors, so storage and similarity search can trade precision for space.user— an identifier for your end user, carried on the request for usage tracking and abuse detection.
Input length limits depend on the model — 8,192 tokens for text-embedding-3-small. The response reports what the batch consumed in the x-nr-input-tokens and x-nr-total-tokens headers.
What you get back
The response carries a data array; each item's embedding field is the vector, a list of numbers ready to store in your vector database. The call appears in your request logs with its exact cost. The full field list — including encoding_format (float or base64) — lives in the Embeddings API reference. Errors use the same shape as everywhere — see Errors & Rate Limits.
FAQ
Next steps
- Embeddings API — The full request and response reference
- Generate Speech — Text in, spoken audio out
- Errors & Rate Limits — Every status, code, and retry rule