Skip to content
이 페이지는 아직 해당 언어로 제공되지 않아 영어로 표시됩니다.

Errors & billing

APISea error codes, retry strategy, request ids, and exactly how token, image, video and music requests are billed against your balance.

← 전체 문서

Error format

Every error uses the OpenAI error shape, so existing client libraries raise the right exception types:

json
{
  "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

StatusCodeWhat to do
400invalid_request_error, model_not_found, invalid_jsonFix the request. Check the model id against the directory or GET /v1/models.
401invalid_api_keyCheck the key and the header format. See Authentication.
402insufficient_balanceTop up in the console. Nothing is charged while the balance is empty.
404not_found, task_not_foundThe endpoint or task does not exist for your account.
429rate_limit_exceededRetry with exponential backoff and jitter.
500 / 502 / 503server_error, bad_gatewayTemporary 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, or veo3.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_tokens or max_completion_tokens to 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

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

이 문서에서 문제를 발견하셨나요? support@apisea.ai(으)로 이메일을 보내주세요.