Embeddings
Convert text into vector representations for semantic search, similarity, clustering, and RAG.
Create embeddings
POST /v1/embeddings1
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Embedding model, e.g. text-embedding-3-small |
input | string | array | Yes | Text to embed, or an array of texts (batch) |
encoding_format | string | No | float (default) or base64 |
dimensions | integer | No | Output 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."
}'1
2
3
4
5
6
7
2
3
4
5
6
7
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"]
}1
2
3
4
2
3
4
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
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Response fields
| Field | Type | Description |
|---|---|---|
data[].embedding | array | The vector; length depends on the model |
data[].index | integer | Index matching the input order |
usage.prompt_tokens | integer | Input tokens consumed |
TIP
There is also a Gemini native format (/v1/engines/{model}/embeddings, a legacy "engines" path style).