XuanShu API
Gemini v1beta API
Native Gemini-compatible Models, model details, and model actions.
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>.
Gemini v1beta API
Use /v1beta/models to discover models and /v1beta/models/{model}:{action} for supported actions.
Available actions and model capabilities depend on Models responses and current configuration.
Request and call
Native Gemini calls put the model in the path and contents in the JSON body.
curl "https://www.xuanshuapi.com/v1beta/models/MODEL_FROM_MODELS:generateContent" \
-H "x-goog-api-key: <YOUR_API_KEY>" -H "content-type: application/json" \
-d '{"contents":[{"role":"user","parts":[{"text":"Reply with OK"}]}]}'Response and streaming behavior
generateContent returns candidates; streamGenerateContent returns incremental results through the streaming action.
HTTP 200
{"candidates":[{"content":{"role":"model","parts":[{"text":"OK"}]},"finishReason":"STOP"}]}Key parameters
| Parameter | Description |
|---|---|
| model | Replace MODEL_FROM_MODELS in the path. |
| contents | Roles and parts content. |
| generationConfig | Set only generation parameters supported by the model. |
Typical failures
For 400 inspect the action and body; for 404 inspect the model path; for 401/403 inspect x-goog-api-key and access.
HTTP 400 # unsupported action or invalid body
HTTP 401/403 # x-goog-api-key or permission
HTTP 404 # model path not available
HTTP 429/5xx # bounded retry candidateNext steps
Available models, multipliers, quotas, and some advanced capabilities depend on the current key and console configuration.