aisplice

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.

error.json
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"
  }
}

All five envelopes and the error-code table →

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

backoff.py
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()

How idempotency keys work →

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

Server URL is rewritten to this domain, so generated clients need no extra configuration.
generate-a-client.sh
# 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/completionsMulti-turn chat, tool calling, streaming, JSON mode.
POST/v1/responsesSingle-shot text with structured outputs and reasoning.
POST/v1/messagesAnthropic-native shape — same auth, no adapter needed.
POST/v1/responses/compactCondense a long conversation on models that support compaction — no streaming form.
Vector
POST/v1/moderationsContent moderation on the same wire format.
Music
POST/v1/music/generationsAsync music generation — returns a task_id; optional webhook supported.
GET/v1/music/tasks/:task_idPoll async music task status and progress.
GET/v1/music/tasks/:task_id/contentFetch the finished audio through the gateway.
Image
POST/v1/images/generationsOpenAI’s image API — every image model, the finished image in the response.
POST/v1/images/tasksAsync image generation, the route image models use — returns a task_id; optional webhook supported.
GET/v1/images/tasks/:task_idPoll async image task status and progress.
GET/v1/images/tasks/:task_id/contentFetch final image URLs — persistent links, safe to store.
POST/v1/images/editsOpenAI’s image edit API — upload the images or give their URLs; every image model.
Video
POST/v1/videosOpenAI-shaped video generation (Sora, Doubao) — optional webhook supported.
GET/v1/videos/:task_idPoll async task status; content lives at /content.
GET/v1/videos/:task_id/contentDownload the finished video through the gateway.
DELETE/v1/videos/:task_idCancel a task that has not reached a terminal state yet.
POST/v1/videos/:video_id/remixRe-render an existing video with a new prompt, on models that support it.
3D
POST/v1/model3d/tasksAsync 3D asset generation and post-processing — returns a task_id.
GET/v1/model3d/tasks/:task_idPoll the 3D task; the result URL arrives in the task body, there is no /content route.
Media
POST/v1/media/upload-policyCreate 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/verifyCheck a Google Play purchase token against your app with the service account set on this key — free, no model call.
POST/v1/xsolla/verifyCheck whether an Xsolla user has an active subscription with the Xsolla API key set on this key — free, no model call.
Account
GET/v1/balanceAccount balance and what this key can still spend — free, no model call.
Metadata
GET/v1/modelsList every model this key is allowed to hit.
GET/v1/models/:modelRetrieve 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.