NewEco lane now on 91 models: the same model at a lower price

Currency

You always top up in euro. Other currencies are shown at today's ECB rate. ECB reference rates

Sign inGet started

Docsv1

Docs menuEmbeddings

POST/v1/embeddings

Embeddings

POST /v1/embeddings: turn text into vectors with an embedding model, in the OpenAI format.

Creates embedding vectors for one or more texts. Works with the models in the embedding category; they list only /v1/embeddings in their endpoints.

Base URL: https://api.nexrouting.com/v1 (also https://nexrouting.com/api/v1).

Headers

Authorizationstringrequired
Authorization: Bearer <key> (or x-api-key: <key>).
Content-Typestring
application/json. The body is read as JSON either way.

Body

modelstringrequired
Model ID, such as openai/text-embedding-3-small.
inputstring | arrayrequired
A text, or an array of texts. One request with many texts counts once against your rate limit.
dimensionsinteger
Length of the vectors, for models that support it.
encoding_formatstring
float or base64, for models that support it.

There is no streaming on this endpoint. You pay for the input tokens at the model's input price.

Example request

curl https://api.nexrouting.com/v1/embeddings \  -H "Authorization: Bearer $NEXROUTING_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "openai/text-embedding-3-small",    "input": ["first text", "second text"]  }'

Example response

200 OK
{  "object": "list",  "data": [    { "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, 0.0789] },    { "object": "embedding", "index": 1, "embedding": [0.0234, -0.0567, 0.0891] }  ],  "model": "openai/text-embedding-3-small",  "usage": { "prompt_tokens": 6, "total_tokens": 6 }}

Vectors are shortened here; real ones have hundreds or thousands of numbers.

Errors

OpenAI error shape. A chat model on this endpoint returns 400 unsupported_endpoint. All codes are in Errors.