Skip to content

Embeddings

Convert text into vector representations for semantic search, similarity, clustering, and RAG.

Create embeddings

POST /v1/embeddings

Parameters

ParameterTypeRequiredDescription
modelstringYesEmbedding model, e.g. text-embedding-3-small
inputstring | arrayYesText to embed, or an array of texts (batch)
encoding_formatstringNofloat (default) or base64
dimensionsintegerNoOutput vector dimensions (some models)

Request

bash
curl https://ai.youqi.tech/v1/embeddings \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "YouQi AI is a unified AI model gateway."
  }'

Batch request

Pass an array to input to embed multiple texts at once:

json
{
  "model": "text-embedding-3-small",
  "input": ["First text", "Second text", "Third text"]
}

Response

json
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0091, 0.0157, "..."]
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 18,
    "total_tokens": 18
  }
}

Response fields

FieldTypeDescription
data[].embeddingarrayThe vector; length depends on the model
data[].indexintegerIndex matching the input order
usage.prompt_tokensintegerInput tokens consumed

TIP

There is also a Gemini native format (/v1/engines/{model}/embeddings, a legacy "engines" path style).