Create embeddings

Convert text into vector embeddings

POST /v1/embeddings

Service root: https://getrouter.ai

Protocol: OpenAI Embeddings

Authentication: Authorization: Bearer YOUR_API_KEY

Request body

The request body is required. Media type: application/json

Request fields

FieldTypeRequiredDescription
modelstringYes
inputstring or array<string>YesText to embed
encoding_formatstringNoAllowed values: float, base64; Default: "float"
dimensionsintegerNoOutput vector dimensions

Example request

curl --request POST \
  --url https://getrouter.ai/v1/embeddings \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "MODEL_ID",
  "input": "Hello, introduce yourself."
}'

Responses

StatusDescription
200Embeddings created successfully

Success response fields

FieldTypeRequiredDescription
objectstringNo
dataarray<object>No
modelstringNo
usageobjectNo

Example response

{
  "object": "object",
  "data": [
    {
      "object": "object",
      "index": 1,
      "embedding": [
        1
      ]
    }
  ],
  "model": "MODEL_ID",
  "usage": {
    "prompt_tokens": 1,
    "total_tokens": 1
  }
}

For complete workflows and examples, read the Embeddings API Guide.


This page is generated from the public Relay OpenAPI specification. Browse the complete specification in the API Explorer.