Skip to main content
Diagnose a BetterToken API error from its HTTP status and response body together. Record the request ID from error.message, fix authentication or configuration errors before resending, and retry only failures identified as temporary.

Before troubleshooting

Have your Model ID, Base URL, and failed response available. Check the Key status and current balance in the BetterToken Dashboard. If you have not completed a model request yet, start with the SDK examples or your tool setup guide.

Read the error response

BetterToken returns API errors in a JSON envelope. For example, a request without a Key can return:
Read error.message even when error.code is empty. The request ID in that message helps identify the failed attempt. A request to /v1/models without a Key returns 401; it does not test whether your model can generate a response. Record these details before contacting support: Keep your BetterToken API Key out of screenshots, support messages, and shared logs.

Check the HTTP status

The table uses general HTTP/API meanings and the linked setup guidance. It is not a list of BetterToken-specific error codes; read the actual response before choosing a fix. For protocol and suffix mistakes, see the Base URL FAQ. For cache questions, use the cache billing FAQ.

Retry temporary failures

Use bounded exponential backoff with jitter after identifying a temporary 429 or server failure. Honor Retry-After when returned; if it exceeds your retry budget, stop and wait outside the loop. SDK retries and your own loop share one attempt budget, so disable SDK retries when implementing your own policy. Do not retry unchanged 400, 401, 403, balance, or configuration failures. A client timeout or broken stream does not prove the request failed before processing. Check the Dashboard first, especially for image generation or a workflow that can repeat an action. The following examples make a non-streaming Chat Completions request with at most four attempts. They retry HTTP 500, 502, and 503. They leave 429 retries off until you confirm the response is a temporary rate limit, and stop on timeouts, network exceptions, and 504 so you can check completion. The maximum retry wait is 30 seconds per attempt.

Prepare the request

Copy a current Model ID from the model plaza and replace both placeholders. Use a text model available through Chat Completions.
The Python example uses the standard library. Save the JavaScript example as an .mjs file and run it with a Node.js version that provides fetch and AbortSignal.timeout.
If the response body identifies a lasting configuration, balance, or access problem, stop the loop and fix it even if the status alone looks retryable. Adapt this short text example to your application’s completion checks before using it for other operations.

Find the guide for your symptom

Confirm the fix

Send one short, non-critical request through the same client, Base URL, and Model ID that failed. Confirm a normal response, then find the matching record in the Dashboard and check the model, status, Token usage, and charge before resuming a larger workflow.

Common questions

Does every 429 mean I should wait and retry?

Use the usage-limit diagnosis FAQ to decide what to check and whether retrying applies to your response.

Should I increase the timeout after one failure?

First check whether your client, a proxy, or an upstream request stopped waiting. Use the timeout guidance, then verify with a small request.