Errors & billing
APISea error codes, retry strategy, request ids, and exactly how token, image, video and music requests are billed against your balance.
← Semua dokumentasiError format
Every error uses the OpenAI error shape, so existing client libraries raise the right exception types:
{
"error": {
"message": "Insufficient balance. Top up at https://apisea.ai/console.",
"type": "insufficient_quota",
"code": "insufficient_balance"
}
}Each response also carries an x-apisea-request-id header. Include it when you contact support, and use it to look up the charge with GET /v1/logs/requests/{id}.
Status codes
| Status | Code | What to do |
|---|---|---|
| 400 | invalid_request_error, model_not_found, invalid_json | Fix the request. Check the model id against the directory or GET /v1/models. |
| 401 | invalid_api_key | Check the key and the header format. See Authentication. |
| 402 | insufficient_balance | Top up in the console. Nothing is charged while the balance is empty. |
| 404 | not_found, task_not_found | The endpoint or task does not exist for your account. |
| 429 | rate_limit_exceeded | Retry with exponential backoff and jitter. |
| 500 / 502 / 503 | server_error, bad_gateway | Temporary upstream issue. Retry, and consider a fallback model. |
Retry strategy
- Retry 429 and 5xx responses with exponential backoff (for example 1 s, 2 s, 4 s, 8 s, with random jitter), up to 4–5 attempts.
- Do not retry 400, 401 or 402 responses without changing the request or your balance.
- For async tasks, retry the status poll, not the submission, to avoid creating duplicate jobs.
- For critical paths, keep a fallback model in the same category, for example
claude-sonnet-4-6→gpt-5.5, orveo3.1-fast→seedance-2.0.
How billing works
Your balance is prepaid in US dollars. The minimum top-up is $50 and the balance does not expire. Each request is priced at the rate published on its model page at the time of the request.
Token-priced models (chat, embeddings, some image models)
Cost = input tokens × input rate + output tokens × output rate (+ cached input × cached rate where supported), with rates quoted per 1 million tokens. Token counts come from the usage object the provider returns, including in streaming responses.
Note
Reasoning models count their hidden reasoning tokens as output tokens, exactly as the provider does. Set
max_tokensormax_completion_tokensto cap spending per request.
Image models
Most image models are billed per successful image at a fixed price for the chosen resolution or quality tier, multiplied by n. A few image models are priced by tokens; their pages show an approximate per-image cost.
Video models
Most video models are billed per second of output at the requested resolution: cost = per-second rate × duration. Some models are billed per clip. If you omit duration, the model's documented default is used.
Music and audio
Music actions such as generate, extend, cover or stems are billed per request. Transcription is billed per minute of audio (Whisper) or per token (GPT-4o transcribe).
Failed requests
Requests that return an error are not billed. Async tasks are charged when they are accepted; if the task later ends in failure, the charge is refunded automatically the next time you query the task with GET /v1/tasks/{task_id}.
Checking usage from code
# Balance for the whole account
curl https://api.apisea.ai/v1/user/balance -H "Authorization: Bearer $APISEA_API_KEY"
# Spend for the last 7 days grouped by model
curl https://api.apisea.ai/v1/usage -H "Authorization: Bearer $APISEA_API_KEY" \
-H "Content-Type: application/json" -d '{"group_by":"model","scope":"account"}'
# The charge for a single request or task
curl https://api.apisea.ai/v1/logs/requests/task_01... -H "Authorization: Bearer $APISEA_API_KEY"The console shows the same data with per-request detail.
Menemukan masalah dalam dokumentasi ini? Email support@apisea.ai.