Skip to main content
Tikway uses HTTP status codes to report the outcome of a request. Successful responses follow the API you called. Gateway-generated errors follow an OpenAI, Anthropic, or Gemini shape based on the incoming protocol. Errors returned directly by an upstream model may have different fields, so inspect both the status code and response body.

Common HTTP status codes

The same HTTP status can have different causes. In particular, 429 can mean rate limiting or insufficient balance. Branch on the machine-readable error.code, not the wording in error.message.

Error response formats

The following are examples of gateway-generated errors. The IDs are illustrative; use the actual x-request-id response header for debugging.

OpenAI-compatible

error.type is the broad category, error.code is the specific cause, and error.param may name an invalid request field.

Anthropic Messages

Native Gemini

In a Gemini error, error.code is the numeric HTTP status and error.status is its canonical name. For invalid fields, details may also include a google.rpc.BadRequest entry.

Common gateway error codes

Some validation, billing, and provider failures have more specific codes. Do not assume a directly forwarded upstream error uses one of the codes above.

Request IDs and rate limit headers

The x-request-id response header helps identify a request. Keep the request time, endpoint, model, HTTP status, and request ID in your logs. Never log the full API key. After authentication, a response may include these rate limit headers: Limits depend on the key’s configuration. Responses rejected during authentication or rate limiting may omit these headers, so provide a fallback retry delay.

Retries and streaming errors

Retry only temporary failures, such as a rate limit 429, 500, 503, or 504. If 429 has error.code: "insufficient_balance", resolve the balance issue instead. Fix 400, 401, 403, 404, 413, or 422 requests before trying again. Cap retry attempts and increase the delay between them. Before resubmitting a paid task creation request, check whether the task was already accepted. A stream can fail after the initial HTTP 200. Continue reading events: Anthropic may emit event: error, Responses may emit event: response.failed, and Chat Completions or Gemini streams may carry an error object in a data frame. For successful response fields, consult the endpoint’s API Reference. For asynchronous video jobs, use the task ID to retrieve the final result.