XuanShu API

Responses API

HTTP, streaming, and WebSocket guidance for OpenAI Responses.

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>.

Responses API

POST /v1/responses creates responses; GET /v1/responses supports WebSocket upgrade for compatible clients.

Models and advanced capabilities depend on the current console configuration.

Request and call

Responses uses input for text or structured input and can enable stream.

curl https://www.xuanshuapi.com/v1/responses \
  -H "Authorization: Bearer <YOUR_API_KEY>" -H "content-type: application/json" \
  -d '{"model":"<MODEL_FROM_MODELS>","input":"Reply with OK","stream":false}'

Response and streaming behavior

Completed responses include status and output; with stream=true consume response events, while WebSocket upgrade requires separate connection handling.

HTTP 200
{"object":"response","status":"completed","output":[{"type":"message","role":"assistant","content":[{"type":"output_text","text":"OK"}]}]}

Key parameters

ParameterDescription
modelA model visible to the key and enabled for Responses.
inputText or structured input.
streamEnables response events.

Typical failures

400 commonly indicates incompatible input or parameters; inspect key and permissions for 401/403; 426 indicates an invalid WebSocket upgrade.

HTTP 400  # invalid input or parameter
HTTP 401/403  # authentication or permission
HTTP 426  # WebSocket upgrade required or invalid
HTTP 429/5xx  # bounded retry candidate

Next steps

Available models, multipliers, quotas, and some advanced capabilities depend on the current key and console configuration.