Create embedding
Create OpenAI-format text embeddings.
POST /v1/embeddings
For semantic search, retrieval, and similarity calculation. This endpoint accepts only OpenAI Embeddings text input for doubao-embedding-vision-251215; use the native Seedance/Doubao multimodal embeddings endpoint for images, video, or mixed input.
Back to Text endpoint listRequest parameters
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Embedding model ID. |
input | string | string[] | Yes | Text to embed. |
provider | string | No | Specify provider preferences. |
routing | object | No | Routing preference, such as provider or strategy tags. |
encoding_format | string | No | Vector encoding format. |
dimensions | integer | No | Specify output vector dimensions; model support is required. |
user | string | No | Application-side user identifier. |
Request examples
curl "https://api.globalrouter.com/v1/embeddings" \
-H "Authorization: Bearer $GR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-embedding-vision-251215",
"input": ["GlobalRouter 统一模型接入", "透明定价与可靠交付"],
"encoding_format": "float",
"dimensions": 1024,
"user": "user_123"
}'Response fields
| Field | Type | Required | Description |
|---|---|---|---|
object | string | No | OpenAI-style object type. |
data | array | Yes | Embedding result list. |
data[].embedding | number[] | Yes | Embedding vector array. |
usage | object | No | Usage statistics. |
Response example
{
"object": "list",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.012, -0.034, 0.056] }
],
"model": "doubao-embedding-vision-251215",
"usage": { "prompt_tokens": 12, "total_tokens": 12 }
}Errors
| HTTP | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization Bearer token. |
| 403 | FORBIDDEN | The current API key is not allowed to call this scope or model. |
| 429 | RATE_LIMITED | Requests are too frequent or the asynchronous task queue is full; reduce concurrency or retry later. |
Notes
- This endpoint preserves the OpenAI Embeddings text input format; image_url, video_url, and multimodal content parts are not accepted.
- For full multimodal support, use /doubao/api/v3/embeddings/multimodal.