Skip to main content

Embeddings

POST /v1/embeddings

Converts text into vectors for semantic search, RAG, clustering, and recommendations.

RequestREQUEST
POSThttps://test.kailin.com.cn/v1/embeddings
ResponseRESPONSE
Fill in the request and hit Send — the response shows up here

Request​

curl https://test.kailin.com.cn/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "text-embedding-3-small",
"input": "AI Station is a unified model gateway"
}'

Request Body​

ParameterTypeRequiredDescription
modelstringYesEmbedding model, e.g. text-embedding-3-small, text-embedding-3-large, text-embedding-ada-002
inputstring / arrayYesA string or an array of strings (batch) — per-request limits depend on the model
dimensionsintegerNoOutput vector dimensions (text-embedding-3 series supports dimension reduction)
encoding_formatstringNofloat (default) or base64
userstringNoEnd-user identifier

Response​

{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0023, -0.0091, 0.0154, "..."]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 12,
"total_tokens": 12
}
}
FieldDescription
data[].embeddingVector array — default 1536 dimensions (text-embedding-3-small) / 3072 (-large)
data[].indexIndex of the corresponding input string
usage.prompt_tokensBilled token count

Batch Requests​

{
"model": "text-embedding-3-small",
"input": ["first document", "second document", "third document"]
}

The returned data carries index matching the input order. A single batched call is faster and cheaper on request count than per-item calls.

Using the SDK​

from openai import OpenAI

client = OpenAI(
api_key="sk-your-token",
base_url="https://test.kailin.com.cn/v1",
)

resp = client.embeddings.create(
model="text-embedding-3-small",
input=["Document A", "Document B"],
)
vectors = [item.embedding for item in resp.data]
note

Gemini-native embedding endpoints (/v1beta/models/{model}:embedContent etc.) are also proxied — parameters follow the Gemini official format, see Google's documentation.