Skip to content

Embeddings

Converts text into vector embeddings. Uses the standard Embeddings protocol format.

POST https://wrouter.ai/v1/embeddings

Body

ParameterTypeRequiredNotes
modelstringe.g. text-embedding-3-small, text-embedding-3-large, bge-large-zh, qwen3-embedding
inputstring | string[] | number[][]Text(s) to embed
encoding_formatstring"float" (default) or "base64"
dimensionsintegerTruncate to this dim (only some models)

Response

json
{
  "object": "list",
  "data": [
    {"object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, ...]}
  ],
  "model": "text-embedding-3-small",
  "usage": {"prompt_tokens": 8, "total_tokens": 8}
}

Examples

bash
curl https://wrouter.ai/v1/embeddings \
  -H "Authorization: Bearer $WROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": ["WRouter unifies LLM access.", "Weather is nice today."]
  }'
python
from openai import OpenAI
client = OpenAI(api_key="sk-...", base_url="https://wrouter.ai/v1")

vec = client.embeddings.create(
    model="text-embedding-3-large",
    input="vectorize this text",
    dimensions=1024,
).data[0].embedding

Limits

  • Up to 2048 entries per input array
  • Per-entry: up to ~8192 tokens (model-dependent)
  • For longer documents, chunk client-side and batch.