XuanShu API
Embeddings API
OpenAI-compatible Embeddings endpoint and capability boundaries.
Last verified:
Connection and authentication
Unified OpenAI-compatible Base URL: https://www.xuanshuapi.com/v1
OpenAI-compatible APIs use Authorization: Bearer <YOUR_API_KEY>; Claude Messages also accepts x-api-key: <YOUR_API_KEY>; Gemini v1beta uses x-goog-api-key: <YOUR_API_KEY>.
Embeddings API
POST /v1/embeddings is available only for models enabled for vector requests in the current configuration.
Embeddings are available only for models enabled in the current configuration.
Request and call
Embeddings accepts a model and a string or string-array input.
curl https://www.xuanshuapi.com/v1/embeddings \
-H "Authorization: Bearer <YOUR_API_KEY>" -H "content-type: application/json" \
-d '{"model":"<MODEL_FROM_MODELS>","input":["first document","second document"]}'Response and streaming behavior
The data array returns vectors and indexes in input order; this endpoint is not streaming.
HTTP 200
{"object":"list","data":[{"object":"embedding","index":0,"embedding":[0.012,-0.034]},{"object":"embedding","index":1,"embedding":[0.056,0.078]}],"usage":{"prompt_tokens":4,"total_tokens":4}}Key parameters
| Parameter | Description |
|---|---|
| model | Must be enabled for vector requests. |
| input | A string or array of strings. |
| encoding_format | Set only when supported by the target model. |
Typical failures
For 400 inspect the input type; for 404 inspect the model ID; models without vector support fail.
HTTP 400 # invalid input type
HTTP 404 # model not found or unavailable
HTTP 429/5xx # bounded retry candidateNext steps
Available models, multipliers, quotas, and some advanced capabilities depend on the current key and console configuration.