Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.xhuoapi.ai/llms.txt

Use this file to discover all available pages before exploring further.

All XHuoAPI APIs are served from https://api.xhuoapi.ai/v1 and authenticated via Bearer Token.

Endpoints

API Gateway

https://api.xhuoapi.ai/v1Entry point for all business calls.

Developer Console

https://api.xhuoapi.aiSubscriptions, credentials, usage.

Identity

https://api.xhuoapi.aiSSO and OAuth2 endpoints.

Status

https://xhuoapi.aiAvailability and incident history.

Obtain an API Token

1

Register

2

Subscribe

Open the detail page of the service you want (Midjourney / Suno / Claude / …) and purchase a package or claim a trial.
3

Create a credential

On the service’s “Credentials” tab, click “Create” and copy the returned Token — that’s your API Key.

Kinds of tokens

  • Business token: created on each service page at platform.xhuoapi.ai; used to call business endpoints on api.xhuoapi.ai. Depending on the application it is bound to, billing comes from either a per-service application (instance balance) or a general-scope application (general balance).
  • Platform token (prefix platform-): for platform management APIs (accounts, subscriptions). Do NOT use for business calls.

Request headers

Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
FieldRequiredNotes
AuthorizationYesBearer prefix (mind the space) + your Token
Content-TypePOSTapplication/json, UTF-8

Common auth / billing errors

The error.code values below come from PlatformGateway’s real exception definitions. The body shape is {"error": {"code": "...", "message": "..."}, "trace_id": "..."}no success field in synchronous errors.

401 — Invalid token

{
  "error": {
    "code": "invalid_token",
    "message": "The specified token is invalid or wrong."
  },
  "trace_id": "2efa9340-b21b-4e26-9e14-4aac95f343ab"
}
Possible error.code:
  • invalid_token — token is wrong or revoked
  • token_expired — token has expired
  • token_mismatched — token does not belong to the requested service (e.g. service credential used on a different service)

400 — Bad request

  • bad_request — JSON payload is malformed
  • no_token — missing Authorization header

403 — Out of balance / blocked

{
  "error": {
    "code": "used_up",
    "message": "Your balance is not sufficient for current request, please buy more in XHuoAPI https://api.xhuoapi.ai"
  },
  "trace_id": "..."
}
  • used_up — instance balance and / or general balance is exhausted
  • disabled — credential or application is disabled
  • forbidden — upstream content moderation rejected the request

404 — Unknown endpoint

  • no_api — path is not registered

429 — Rate limited

{
  "error": {
    "code": "too_many_requests",
    "message": "You have exceeded the rate limit."
  },
  "trace_id": "..."
}
Use exponential backoff before retrying.

500 / 504

  • api_error — gateway or upstream internal error
  • timeout — upstream inference timed out

Security best practices

  • Never hard-code the Token in browser / mobile / desktop code — always proxy through your own backend
  • Store the Token in env vars or a secrets manager
  • Issue distinct Tokens for dev / staging / prod
  • Revoke and re-issue immediately if you suspect leakage

Next

Quickstart

Run your first request

Response format

Success & error fields

Async tasks

Polling & webhook callbacks

API reference

Interactive API docs