API reference
Integration basics
#Base URL
All endpoints live under /v1 on this deployment’s own domain. There is no region selection — routing to upstream vendors happens behind the gateway.
#Authentication header
A single Authorization: Bearer header is the entire auth story. No signature, no timestamp, and no per-user header — anything beyond the bearer token that other gateways require does not exist here.
#Error envelope
Gateway-side rejections use the OpenAI-shaped envelope with type "xiaoxiang_error". Upstream errors are forwarded unchanged, async task endpoints answer with a flat body, and two cases carry no body at all — read the errors page before writing your parser.
HTTP/1.1 402 Payment Required
X-Oneapi-Request-Id: 2026091023...
{
"error": {
"message": "insufficient account balance, please top up to continue (request id: 2026091023...)",
"type": "xiaoxiang_error",
"code": "insufficient_user_quota"
}
}#Retry policy
Retry 429 and 5xx with exponential backoff, honoring Retry-After when present. Do not retry 4xx validation errors — the same body will fail again. For billable submissions, send an Idempotency-Key so a retry after a timeout replays the first result instead of starting a second job.
import time, requests
def call_with_backoff(url, headers, body, tries=5):
for i in range(tries):
r = requests.post(url, headers=headers, json=body)
if r.status_code not in (429, 500, 502, 503, 504):
return r
# 429 and 413 have no JSON body — never parse before checking status.
wait = int(r.headers.get("Retry-After", 2 ** i))
time.sleep(wait)
r.raise_for_status()#Machine-readable spec
The same contract in two generated formats: OpenAPI for client generation, Postman and API tooling, and a single markdown file to paste into a coding agent. Both are rebuilt from these pages, so they cannot drift from what you are reading.
openapi.json
OpenAPI 3.1 — every documented path, its parameters and its error responses.
llms-full.txt
The whole wire contract as one markdown file, sized for an agent context window.
llms.txt
Short index of every documentation page, for AI clients that fetch it first.
# Any OpenAPI generator works; this is the common one.
npx @openapitools/openapi-generator-cli generate \
-i https://www.aisplice.store/openapi.json \
-g python \
-o ./gateway-client#Endpoint overview
Every path accepts the OpenAI request body — vendor-specific parameters (anthropic tool_use, gemini thinking_config) pass through unchanged. Vendor-native and frozen legacy routes are listed separately on the compatibility page.
| Text | ||
| POST | /v1/chat/completions | Multi-turn chat, tool calling, streaming, JSON mode. |
| POST | /v1/responses | Single-shot text with structured outputs and reasoning. |
| POST | /v1/messages | Anthropic-native shape — same auth, no adapter needed. |
| POST | /v1/responses/compact | Condense a long conversation on models that support compaction — no streaming form. |
| Vector | ||
| POST | /v1/moderations | Content moderation on the same wire format. |
| Music | ||
| POST | /v1/music/generations | Async music generation — returns a task_id; optional webhook supported. |
| GET | /v1/music/tasks/:task_id | Poll async music task status and progress. |
| GET | /v1/music/tasks/:task_id/content | Fetch the finished audio through the gateway. |
| Image | ||
| POST | /v1/images/generations | OpenAI’s image API — every image model, the finished image in the response. |
| POST | /v1/images/tasks | Async image generation, the route image models use — returns a task_id; optional webhook supported. |
| GET | /v1/images/tasks/:task_id | Poll async image task status and progress. |
| GET | /v1/images/tasks/:task_id/content | Fetch final image URLs — persistent links, safe to store. |
| POST | /v1/images/edits | OpenAI’s image edit API — upload the images or give their URLs; every image model. |
| Video | ||
| POST | /v1/videos | OpenAI-shaped video generation (Sora, Doubao) — optional webhook supported. |
| GET | /v1/videos/:task_id | Poll async task status; content lives at /content. |
| GET | /v1/videos/:task_id/content | Download the finished video through the gateway. |
| DELETE | /v1/videos/:task_id | Cancel a task that has not reached a terminal state yet. |
| POST | /v1/videos/:video_id/remix | Re-render an existing video with a new prompt, on models that support it. |
| 3D | ||
| POST | /v1/model3d/tasks | Async 3D asset generation and post-processing — returns a task_id. |
| GET | /v1/model3d/tasks/:task_id | Poll the 3D task; the result URL arrives in the task body, there is no /content route. |
| Media | ||
| POST | /v1/media/upload-policy | Create a short-lived file upload policy for an image, video, audio, or generic file up to its configured limit. |
| App subscriptions | ||
| POST | /v1/google-play/verify | Check a Google Play purchase token against your app with the service account set on this key — free, no model call. |
| POST | /v1/xsolla/verify | Check whether an Xsolla user has an active subscription with the Xsolla API key set on this key — free, no model call. |
| Account | ||
| GET | /v1/balance | Account balance and what this key can still spend — free, no model call. |
| Metadata | ||
| GET | /v1/models | List every model this key is allowed to hit. |
| GET | /v1/models/:model | Retrieve one model entry — the shape Anthropic and OpenAI clients probe on startup. |
Still stuck?
Send us the request ID or the error message and we will look into it.