Embeddings
Behavior
Example vectors are shortened. Match data[].index to each input and validate dimensions before indexing.
Endpoint and authentication
POST /v1/embeddingsUse an XHub API key: Authorization: Bearer . Do not use upstream provider credentials as gateway keys.
Use the gateway root Base URL shown in the playground, without appending /v1; send requests to the full endpoint path above.
Request example
curl "$XHUB_BASE_URL/v1/embeddings" \
-H "Authorization: Bearer $XHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_MODEL_NAME","input":["Hello world"]}'Request parameters
| Field | Type | Description |
|---|---|---|
| model | string · required | Public model name; deployment must support this protocol. |
| input | string | string[] · required |
| encoding_format / dimensions | string / integer | float or base64; vector length only if supported. |
Success response
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
0.1,
0.2
]
}
],
"usage": {
"prompt_tokens": 3,
"total_tokens": 3
}
}| Field | Type |
|---|---|
| object | string |
| data | object[] |
| data[].object | string |
| data[].index | number |
| data[].embedding | array |
| usage | object |
| usage.prompt_tokens | number |
| usage.total_tokens | number |
Errors and troubleshooting
| HTTP | Meaning |
|---|---|
| 400 | Invalid request. Check JSON, parameters and query. |
| 401 | Missing or invalid XHub credential. |
| 403 | Permission denied. Check model scope or policy. |
| 429 | Limit exceeded. Inspect response details and Retry-After. |