Errors and limits
Every API error comes back with a stable English code you can check in code without parsing text. This page lists every code, what it means and what to do, plus the rate limits and the MCP and OAuth errors.
On this page
The error body
Every error is JSON with an error field, sometimes with extra fields that help explain what happened:
{ "error": "invalid_params", "param": "duration", "detail": "duration: one of 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15" }
| Code | Extra field | What it holds |
|---|---|---|
| invalid_params | param, detail | Which parameter, and why, as "<param>: <reason>" |
| not_found | what | model, job, file or key |
| price_above_cap | credits | The real price |
| too_large | max_bytes | The largest file size in bytes |
| too_many_keys | max | The most keys allowed |
| insufficient_credits on MCP | topup | A link to add credits |
| unauthorized on MCP | hint | How to connect |
Check the code, not only the status: several codes share a status. Every API answer carries Cache-Control: private, no-store. An unexpected error returns 500 server_error, and the details stay in the server log only.
Every error code
| Code | HTTP | What it means | What to do |
|---|---|---|---|
| unauthorized | 401 | No valid key or sign-in. The key is missing, wrong or revoked | Send Authorization: Bearer with an active key. Check on the developers page that it was not revoked |
| account_blocked | 403 | The account was switched off, so its keys and sessions are refused | Do not retry. Reach support through the website |
| bad_origin | 403 | A write request carrying a sign-in cookie came from another site | Use an API key for calls from code, not a cookie |
| web_session_required | 403 | The action is allowed only from the signed-in website, not with an API key | Do it on the website: creating and revoking keys, changing the password, signing out sessions and deleting the account |
| rate_limited | 429 | Too many calls in the current time window | Wait for the window to pass, a minute or an hour as in the table, then retry. There is no Retry-After header |
| invalid_params | 400 | A parameter is missing or invalid. param says which one and detail says why | Fix the parameter using get model. Nothing was charged |
| not_found | 404 | What you asked for does not exist. what says which: model, job, file or key. Another user's job or file counts as not existing | Check the id. For a model, refresh the model list |
| insufficient_credits | 402 | The balance is lower than the price. Nothing was charged. On MCP a topup link is added | Add credits on the credits page and retry |
| storage_payment_required | 402 | The account is held because storage fees above 1 GB were not paid. New generations and uploads are refused. On a file upload the status is 400 | Add credits, or delete files until you are under 1 GB. Deleting lifts the hold at once |
| price_above_cap | 409 | The actual price is above the max_credits you sent. Nothing was charged. credits returns the real price | Estimate again, and if the price is fine resend with max_credits at or above it |
| server_error | 500 | An unexpected failure. The details stay in the server log only | Retry later. For a generation, first check the job list that the job was not created, since there is no duplicate protection |
| too_many_keys | 409 | The account already has 25 active keys. max returns 25 | Revoke an unused key on the developers page |
| too_large | 413 | The file is larger than 4 MB (4194304 bytes). max_bytes returns the limit | Make the file smaller. For a video, for example, export it at 720p |
| no_file | 400 | The form has no field named file, or the request is not multipart at all | Send multipart/form-data with the file in a field named file |
| unsupported_type | 400 | The file type is not supported, or the start of the file does not match the declared type | Use png, jpeg, webp, gif, mp4, webm, mov, mp3, wav, ogg, m4a or flac, with the right Content-Type |
| quota_exceeded | 400 | The upload goes past a limit: 20 GB per account, or above 1 GB when the balance does not cover about a month of storage at the new size, or 50 MB and 30 files on an account that has never added credits | Delete files or add credits |
| confirm_email_mismatch | 400 | When deleting the account, confirm_email is not the account email | Send the exact account email |
| wrong_password | 400 | current_password is wrong, when deleting the account or changing the password | Retry with the right password. Up to 10 tries an hour |
| weak_password | 400 | The new password is shorter than 10 characters, one repeated character or too common | Choose a stronger password |
| password_too_long | 400 | The new password is longer than allowed | Shorten it |
| payment_pending | 409 | Deleting the account was refused because a top-up page opened in the last 48 hours is still waiting for payment | Wait for the payment to complete or expire, then retry |
| generation_failed | none | Not an HTTP error: the value of the error field on a job whose status is failed. The credits are already back | Send the generation again if you want to. Trying other settings or wording can help |
| invalid_client | 400 | OAuth: the app is not recognised. client_id is missing or unknown, or its metadata document could not be loaded or is invalid. Also shown on the consent screen | For the app developer: register the client again or fix its metadata document |
| invalid_request | 400 | OAuth: a required detail is missing. The redirect address is not registered for the app, PKCE with S256 is missing, or code or code_verifier is missing | For the app developer: send a complete request per the standard |
| invalid_grant | 400 | OAuth: the code is invalid, already used or expired (it lives 5 minutes), belongs to another app or address, or the account already has 25 active keys | Connect again from the app. With 25 keys, revoke one on the developers page |
| invalid_target | 400 | OAuth: the request names another service. resource must be https://low-cost.ai/api/mcp | For the app developer: send the right MCP address |
| unsupported_grant_type | 400 | OAuth: only the authorization_code grant_type is supported | For the app developer: use authorization_code with PKCE |
| unsupported_response_type | 400 | OAuth: only response_type code is supported | For the app developer: send response_type=code |
| invalid_redirect_uri | 400 | OAuth, on app registration: 1 to 5 https redirect addresses are needed, or http for the local machine only, with no # | For the app developer: fix redirect_uris |
| invalid_client_metadata | 400 | OAuth, on app registration: the body is not JSON, or token_endpoint_auth_method is not none | For the app developer: register as a public client with PKCE |
| access_denied | none | OAuth: not an HTTP error. This is how the app learns you pressed Cancel on the consent screen. No key was created | Connect again from the app if you want to |
Codes marked OAuth come from the OAuth sign-in endpoints, not from /api/v1. They are explained below.
Reasons for a parameter error
In invalid_params the detail field is always built the same way: the parameter name, a colon, and the reason. These are all the reasons:
| Reason | When |
|---|---|
| unknown parameter | The parameter does not exist on the model |
| required | A required parameter is missing. Also max_credits when not sent |
| not a number | A numeric value that is not a number |
| min <n> or max <n> | A number out of range |
| step <s> | A number that is not on the step grid |
| one of <v1>, <v2>, ... | A value that is not in the allowed list |
| max <n> items, max 8192 characters per item, must be http(s) links | An images list that is too long or holds a value that is not a link |
| must be text, max <n> characters, must be an http(s) link | Invalid text or link |
| no provider serves this combination | There is no way to run this combination. param is params |
| max or min <n> characters or items | Text or a list outside the model's bound |
| content-type must be application/json | The request was not sent as JSON. param is body |
| must be a positive number | max_credits is not a positive number |
| not a timestamp | before on the job or file list is not a date |
| not a ledger id | before on the credit history is not a row number |
| must be a video from your library, max 64 MB, unreadable video, max 15 seconds | The video of an analysis model is not valid |
| must be text, one of he, en, one of graphite, ... | name, lang or theme is invalid in an account update |
A parameter error always happens before any charge.
Rate limits
Rate limits are counted in a fixed time window that starts with the first call and resets when it ends. The call that crosses the limit gets 429 rate_limited.
| What | How many | Window | Counted |
|---|---|---|---|
| POST /api/v1/estimate | 120 | minute | per IP address |
| POST /api/v1/generate and the MCP generate tool, together | 30 | minute | per account |
| Every request to /api/mcp | 120 | minute | per account |
| POST /api/v1/files | 60 | hour | per account |
| POST /api/v1/keys | 20 | hour | per account |
| POST /api/v1/me/password and DELETE /api/v1/me, together | 10 | hour | per account |
| POST /api/oauth/register | 30 | hour | per IP address |
| POST /api/oauth/token | 60 | 10 minutes | per IP address |
| Approving on the OAuth consent screen | 20 | hour | per account |
- There are no Retry-After or X-RateLimit headers. Wait until the window ends, a minute or an hour, then retry
- On MCP, going over on generate comes back as a tool result with isError and rate_limited, and going over the total request count comes back as HTTP 429
- There is no rate limit on reading jobs, files, history, the account and models
MCP errors
On MCP a tool error is a normal result with isError: true, holding text that is the same error JSON:
{ "isError": true, "content": [{ "type": "text", "text": "{\"error\":\"price_above_cap\",\"credits\":12.5}" }] }
- Arguments that do not match the tool definition, such as a missing max_credits or wait_seconds above 25, come back as plain text, not JSON: MCP error -32602: Input validation error
- Without a key you get 401 with a WWW-Authenticate header, which sends assistants that support OAuth to the sign-in flow:
HTTP/1.1 401 WWW-Authenticate: Bearer realm="lowcostai", resource_metadata="https://low-cost.ai/.well-known/oauth-protected-resource/api/mcp" { "error": "unauthorized", "hint": "Send Authorization: Bearer <lca_ API key> from your LowCostAi account, or connect with OAuth" }
A switched off account gets 403 account_blocked, and going over 120 requests a minute gets 429 rate_limited.
OAuth errors
OAuth errors reach the app that is connecting, not you, and most users never see them. Their shape is slightly different:
- POST /api/oauth/token and POST /api/oauth/register return { error, error_description }
- POST /api/oauth/authorize, the approval on the screen, returns { error, detail } with status 400
- A malformed sign-in request is shown as an error page with the code and details, and does not redirect back to the app
- Cancel on the screen sends the user back to the app with error=access_denied in the address
Every code is explained in the table above.
When to retry
| Code | Retry? |
|---|---|
| rate_limited | Yes, after the window passes |
| server_error | Yes, after a wait. For a generation, first check the job was not created |
| insufficient_credits, storage_payment_required | After adding credits or deleting files |
| price_above_cap | After a new estimate, if the price is fine |
| invalid_params, not_found, unsupported_type, too_large | Only after fixing the request |
| unauthorized, account_blocked, web_session_required | No, it is a permission problem |