Skip to main content
Early accessGnani Evon v3.5 is now available as an API to early access registrants.

Two error shapes

An error response has an HTTP error status and a JSON body. The body comes in one of two shapes, depending on where the request was refused:
Both use the same HTTP status codes as OpenAI, so the OpenAI SDKs raise their usual exceptions for both. Branch on the HTTP status and the code, not on message: the message is for people and may change.
The daily token quota has two codes. DAILY_TOKEN_QUOTA_EXCEEDED comes from the gateway, in the detail shape. daily_token_quota_exceeded comes from the API, in the error shape. Both mean the quota is used up until midnight IST. Check for both.

Handle errors in code

Read the code from whichever shape the response uses:

Error codes

LLM errors use OpenAI’s error format, so the OpenAI SDKs raise them as their usual exceptions (BadRequestError, RateLimitError and so on):
Use the HTTP status and error.code in your code. message explains the problem in plain words and may change. Authentication and request-rate errors come from the API gateway and use a different shape. The OpenAI SDKs still raise them by status (AuthenticationError, PermissionDeniedError, RateLimitError):
Errors that happen after a stream has started arrive as a last event in the stream. See Streaming. The codes for every Gnani API are in the Error Reference.

Retrying

Retry connection errors and 429, 500, 502, 503 and 504 with exponential backoff, for example 1 s, 2 s, then 4 s. When a response has Retry-After, wait at least that long. Do not retry other 4xx errors: they fail the same way until you change the request. OpenAI’s SDKs, and the Gnani Python SDK clients built on them, already retry these for you (2 retries by default; set max_retries on the client to change it).

Retry guide by status

An SDK retry of a daily-quota 429 fails again until the reset. To stop retrying it, check the code and skip it in your own retry logic, or set max_retries to 0 and retry yourself.

Limits

Rate limits and the daily token quota behind most 429 errors.

Error Reference

Error formats and codes for every Gnani API.