Embeddings

Convert text into high-dimensional vectors for semantic search, similarity, and RAG, compatible with the OpenAI Embeddings protocol.

Basics

MethodPOST Endpointhttps://koprouter.kopglobal.com/v1/embeddings AuthenticationAuthorization: Bearer sk-...

Request Parameters

Parameter Type Required Description
model string Yes Embedding model ID
input string/array Yes Text to embed — a string or an array of strings
encoding_format string No Output format, float (default) or base64
dimensions number No Target vector dimensions

Example Request

curl https://koprouter.kopglobal.com/v1/embeddings \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "input": ["Hello world", "你好,世界"]
  }'

Example Response

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0112, 0.0184]
    },
    {
      "object": "embedding",
      "index": 1,
      "embedding": [0.0019, -0.0108, 0.0177]
    }
  ],
  "model": "MODEL_ID",
  "usage": {
    "prompt_tokens": 5,
    "total_tokens": 5
  }
}
Pass a string array in a single call to reduce request count and overhead; the `data` array order matches `input` one-to-one.