# Errors and limits The error format deepflock uses, every error code, and how rate limits work. ## Error format Errors use the same shape as OpenAI, so SDKs raise their usual exceptions: ```json { "error": { "message": "Invalid or missing API key.", "type": "authentication_error", "code": "invalid_api_key" } } ``` | Field | Meaning | |---|---| | `message` | A sentence for humans. It may change; do not match on it. | | `type` | The broad kind of error. | | `code` | A short, stable code for your code to check. Some `400` errors have no code (`null`). | ## Error codes | Status | Type | Code | Meaning | |---|---|---|---| | `400` | `invalid_request_error` | `null` | The body is not JSON, or `messages` is missing or empty. | | `400` | `invalid_request_error` | `unsupported_parameter` | A field we do not support, for example `n` other than 1, or `tools`. | | `400` | `invalid_request_error` | `context_length_exceeded` | The prompt is longer than the model allows. | | `401` | `authentication_error` | `invalid_api_key` | Missing, wrong or deleted key. | | `402` | `insufficient_quota` | `insufficient_funds` | Your balance cannot cover the reservation (prompt + `max_tokens`). | | `402` | `insufficient_quota` | `key_limit` | This key has reached its spending limit. | | `403` | `permission_error` | `model_not_allowed` | Your key is not allowed to use this model. | | `404` | `invalid_request_error` | `model_not_found` | The model id does not exist or is not available. | | `404` | `invalid_request_error` | `not_found` | Unknown endpoint. | | `429` | `rate_limit_error` | `rate_limit_exceeded` | Too many requests for this key. Sent with `Retry-After`. | | `502` | `server_error` | `flock_failed` | The flock failed while answering and no other flock could take over. | | `503` | `server_error` | `no_capacity` | No flock is free for this model right now. Sent with `Retry-After`. | If a flock fails after a streamed answer has started, the stream carries one last event with an `error` object (code `flock_failed`) instead of a normal finish. ## What to do | Status | Retry? | |---|---| | `400`, `401`, `403`, `404` | No. Fix the request, the model id or the key. | | `402` | No. Add credit, raise the key's limit or lower `max_tokens`. | | `429` | Yes, after the number of seconds in the `Retry-After` header. | | `502` | Yes, with back-off: 1 s, 2 s, 4 s. | | `503` | Yes, after the number of seconds in the `Retry-After` header. | ## Rate limits Each key has a requests-per-minute limit (60 by default). [`GET /v1/me`](/api-me) shows it as `rpm`. Over the limit you get `429` with a `Retry-After` header that says how many seconds to wait. A flock has a fixed number of Macs, so it can only serve so many requests at once. When every flock for a model is busy, you get `503` with the code `no_capacity` and a short `Retry-After`, rather than a long wait. ## Speed A flock is a row of Macs in different homes. Each answer has to travel the whole row for every word, so speed depends on the trips between Macs. The only numbers we publish are measured ones, with their setup. See [Our acceleration](/acceleration) for the measured table. Long prompts are the slowest part of a flock.