On this pageErrors and retries
Back to docs

Errors and retries

Diagnose failures with errors and request IDs.

HTTP 429 can mean local admission pressure, a full queue or upstream throttling. Read the error and Retry-After; it does not imply unlimited RPM or TPM.

Honor Retry-After and use bounded exponential backoff with jitter. Cap attempts and total time. For video jobs that may already exist, look up the job ID before submitting again.

Retain x-mientaymedia-request-id when present and the failure time for investigation. Exclude API keys and sensitive payloads from reports.

Error code

HTTPError typeReason
400invalid_request_errorWrong JSON or missing parameters
401authentication_errorMissing key, wrong key or revoked key
402insufficient_balance
api_key_monthly_limit
outstanding_undercharge
Read error.type: insufficient_balance means available funds are insufficient; api_key_monthly_limit means the key reached its monthly spending cap; outstanding_undercharge means an unpaid amount from a previous request needs reconciliation. For a key cap, check Dashboard → Keys; adding wallet funds does not increase that cap.
403model_not_allowedThis API key is not allowed to use the selected model. Check its model permissions in Dashboard → Keys or select an allowed model.
413request_too_largeThe body exceeds 20 MB or the input exceeds a model/provider-specific limit. Read the message and reduce context, images or files; a body below the gateway limit can still receive 413.
429rate_limit_errorHTTP 429 can mean local admission pressure, a full queue or upstream throttling. Read the error and Retry-After; it does not imply unlimited RPM or TPM.
502api_errorUnable to connect model from upstream provider
503service_unavailableTemporarily unavailable or under maintenance; inspect the request ID and timestamp before retrying.

Balance errors may include required_vnd and available_vnd; key-cap errors may include limit_vnd and spent_vnd. Save these fields with the request ID for investigation, without sharing the API key.

{
  "type": "error",
  "error": {
    "type": "insufficient_balance",
    "message": "Số dư đã hết. Top up tại https://vietrouter.com.vn/dashboard/topup"
  }
}

Troubleshooting

View model status in Pricing

Retain x-mientaymedia-request-id when present and the failure time for investigation. Exclude API keys and sensitive payloads from reports.

Honor Retry-After and use bounded exponential backoff with jitter. Cap attempts and total time. For video jobs that may already exist, look up the job ID before submitting again.

SymptomCommon causesHow to handle
404 or “Not Found”Wrong base URL — extra or missing /v1 suffix.Anthropic-style tools use https://vietrouter.com.vn; OpenAI-style tools use https://vietrouter.com.vn/v1.
401 authentication_errorWrong key, revoked key, or the app is still using a saved old key.Create a new key in the dashboard, remove the old key from the app, then restart the app.
402 insufficient_balanceWallet balance is empty.Top up on the Top-up page.
429 rate_limit_errorHTTP 429 can mean local admission pressure, a full queue or upstream throttling. Read the error and Retry-After; it does not imply unlimited RPM or TPM.Honor Retry-After and use bounded exponential backoff with jitter. Cap attempts and total time. For video jobs that may already exist, look up the job ID before submitting again.
Claude Code keeps asking you to sign inThe machine still has an old Anthropic account session.Run /logout in Claude Code, set ANTHROPIC_AUTH_TOKEN, then reopen the terminal.
App says the model does not existWrong model name, or the app adds a provider prefix on its own.Call GET /v1/models for the exact names, and drop prefixes like anthropic/ unless the app requires them.
Image requests failThe app sends images in a format the model rejects, or the image is too large.Chỉ dùng model có nhãn Vision, nén ảnh và giữ toàn bộ yêu cầu dưới 20 MB.
Environment variables have no effectAn old terminal still has stale values, or the app reads config from its own file.Open a new terminal (Windows: sign out/in), and check whether the app has a config file that overrides environment variables.

Examples receive source review and local checks; this does not establish compatibility with every app version. Check settings, send a small request and confirm usage before production use.

Zalo groupWhatsApp