Skip to main content

Operations

API errors, rate limits, and retries

Giotto's OpenAI-compatible API returns HTTP status codes, an OpenAI-style error body for gateway-generated errors, and rate-limit headers. Read all three when handling a failure. The examples here use the standard OpenAI Python client wi...

Giotto's OpenAI-compatible API returns HTTP status codes, an OpenAI-style error body for gateway-generated errors, and rate-limit headers. Read all three when handling a failure. The examples here use the standard OpenAI Python client with the Giotto /v1 endpoint.

At a glance

Status Likely cause Next step
400 Invalid request body or parameter Correct the request before retrying.
401 Invalid Giotto credential Check the client ID, secret, and bearer-token format.
402 Insufficient by-token credits Check your Giotto balance and add credits.
403 Disabled priority or unavailable model entitlement Check the credential and model access.
404 Model not found Use a model returned by GET /v1/models.
429 Per-minute or concurrency limit exceeded Follow Retry-After and reduce request volume.
502, 503, 504 Gateway dependency or model service unavailable or timed out Use bounded backoff and check whether earlier work may have started.

An upstream model service can return other statuses or its own error body. Do not assume every failure has a gateway error code.

How limits work

Each credential has configured requests-per-minute and concurrency limits based on its priority. The limits are not a single published number for every account. Read the response headers for the limits that apply to your credential.

  • Requests per minute: requests are counted in one-minute windows. Once the limit is exceeded, the gateway returns 429. Rejected attempts still increase the observed count, so repeated probing does not help.
  • Concurrency: the gateway limits requests in progress. It may wait for a slot before returning 429. A rejected concurrency attempt may already have consumed one request from the minute's allowance.
  • Streaming: an active response keeps a concurrency slot until the stream completes or closes. Close streams you stop consuming.

Coordinate traffic from workers that share a credential. If you use multiple credentials or API paths, check the limits and headers returned by the path you actually call.

Rate-limit headers

Header names are case-insensitive. These headers reflect a gateway admission snapshot; some may be absent on a request rejected before admission.

Header Meaning
X-RateLimit-Limit Configured requests-per-minute limit.
X-RateLimit-Remaining Requests left in the current minute after this attempt. It is 0 on a per-minute gateway rejection.
X-RateLimit-Concurrency-Limit Maximum active requests in the applicable concurrency pool.
X-RateLimit-Concurrency-Used Slots in use at the gateway's admission decision.
X-RateLimit-Concurrency-Remaining Slots left at that moment; this is not a reservation for a later request.
Retry-After Seconds to wait after a gateway 429 before trying again.

Admitted responses also include X-Gateway-Priority and X-Gateway-Configured-Requests-Per-Minute. There is no documented reset-time header. Use Retry-After rather than deriving a reset time from X-RateLimit-Remaining.

What a 429 response contains

Check error.code to distinguish requests_per_minute from concurrency_limit_exceeded. The optional gateway object gives the limit, observed value, and retry delay. Example numbers below are illustrative:

HTTP/1.1 429 Too Many Requests
Retry-After: 18
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
Content-Type: application/json

{
  "error": {
    "message": "The requests-per-minute limit has been reached.",
    "type": "rate_limit_error",
    "param": null,
    "code": "requests_per_minute"
  },
  "gateway": {
    "limit": 60,
    "observed": 61,
    "retry_after_seconds": 18
  }
}

For a concurrency rejection, expect X-RateLimit-Concurrency-Limit, X-RateLimit-Concurrency-Used, and X-RateLimit-Concurrency-Remaining. The per-minute rejection's Retry-After points to the next minute window. A concurrency rejection supplies a configured retry delay; active requests may finish sooner or later.

Gateway error codes

Gateway-generated errors have an error object with message, type, param, and code. Use the HTTP status and error.code together:

Status error.code Action
400 invalid_model_request Fix the JSON body or model field.
401 invalid_api_key Check the Giotto credential and Authorization header.
402 insufficient_credits Check the by-token balance. See API billing, credits, and usage.
403 priority_disabled, model_pricing_unavailable, model_unavailable_for_this_credential Check the enabled API offering and selected model.
404 model_not_found Choose a deployed model available to your credential.
429 requests_per_minute, concurrency_limit_exceeded Follow Retry-After and adjust request volume.
502, 504 upstream_unavailable, upstream_timeout Retry cautiously after checking whether work may have started.
503 keycloak_unavailable, priority_store_unavailable, priority_not_configured, concurrency_store_unavailable Pause and retry with backoff; escalate if persistent.

Read errors in the Python client

The standard OpenAI Python client raises APIStatusError for non-successful HTTP responses. Inspect its status, body, and headers:

from openai import APIStatusError

try:
    completion = client.chat.completions.create(
        model=model_id,
        messages=[{"role": "user", "content": "Hello"}],
    )
except APIStatusError as exc:
    print(exc.status_code)
    print(exc.response.headers.get("retry-after"))
    print(exc.response.text)

Connection failures and local timeouts use client exceptions such as APIConnectionError and APITimeoutError. They do not prove whether a request reached the server.

Retry safely

  1. For a gateway 429, wait at least the number of seconds in Retry-After. Add a small random delay when many workers may retry together. Keep a maximum attempt count and an overall deadline.
  2. For 502, 503, 504, or a network failure, use exponential backoff with jitter and a cap. A generation request may have started even if its result did not reach you; avoid blindly resending when duplicate work matters.
  3. For 400, 401, 402, 403, or 404, correct the request, credential, balance, or access before retrying.
  4. Limit work in progress in your application. When X-RateLimit-Remaining or X-RateLimit-Concurrency-Remaining approaches zero, slow new submissions.

The OpenAI Python client may make automatic retries for some transient failures. Account for those attempts when setting deadlines and your own retry policy.

When contacting support

Include the API path, UTC time, HTTP status, error.code, relevant response headers, and X-Request-Id if returned. Do not send your client secret or full Authorization header. Contact Giotto support if a service error persists or your configured limit appears incorrect.

Related articles

Powered by Zendesk