Text embeddings

Generate retrieval or similarity vectors with configured embedding models.

POST/v1/embeddings
https://api.hanrouter.ai/v1Manage API keys

URL and authentication

Use https://api.hanrouter.ai/v1 as the OpenAI-compatible Base URL and Authorization: Bearer $HANROUTER_API_KEY. Do not duplicate /v1. All manufacturers use your HanRouter key, not an upstream vendor key.

For the Anthropic SDK and Claude Code, use https://api.hanrouter.ai without /v1; the client appends /v1/messages. Use the OpenAI-compatible interface for Google models.

Embedding results

input is text or a text array. Read data[].embedding and data[].index. Dimensions and input limits vary; do not mix incompatible vector dimensions. Requires an embedding-capable OpenAI-type channel and key group.

Request parameters

model
Required string: exact model ID available to your key.
input
Required: text or an input array allowed by the protocol.

Request example

Examples use configured model IDs. Key group permissions determine access; query GET /v1/models first.

cURL
curl -X POST "https://api.hanrouter.ai/v1/embeddings" \
  -H "Authorization: Bearer $HANROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "your-model-id",
  "input": "Hello HanRouter"
}'

Response example

JSON · illustrative structure
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [
        0.12,
        -0.03,
        0.08
      ]
    }
  ]
}