# Limits and balance

> Per-minute request limits for API keys, how GoiAPI holds funds based on max_tokens, when you get a 402 error, body size and maximum run time.

Source: https://goiapi.com/en/docs/limits-and-balance

## Requests per minute

Each API key has a limit on requests per minute. Non-streaming responses to requests that pass the key check include headers with the current status (streaming responses do not):

| Header                           | Meaning                                    |
| -------------------------------- | ------------------------------------------ |
| `x-ratelimit-limit-requests`     | Maximum requests per minute for the key    |
| `x-ratelimit-remaining-requests` | Requests left in the current minute        |
| `x-ratelimit-reset-requests`     | Time until the counter resets (e.g. `12s`) |

Going over the limit returns `429` with `Retry-After` (seconds to wait). If you need a higher limit, [contact support](https://goiapi.com/en/contact).

## Balance and holds

Before calling a model, we **hold** an estimated amount (never less than the minimum charge per request), based on:

- input tokens (estimated on the high side from the request size);
- and maximum output tokens: the `max_tokens` (or `max_completion_tokens`) you send, capped at the model's maximum. If you send neither, a default is used.

When the request finishes, we charge the actual usage and release the rest of the hold.

- Your balance must be above 0. The hold may exceed your balance slightly (so long answers are not cut off), so your balance can go slightly negative after a request. Beyond that margin you get a `402` error "Your balance is too low for this request…".
- Tip: when your balance is low, set `max_tokens` to what you actually need so the hold is smaller.
- The **Request history** page in the dashboard shows the cost of each request as it happens.

## Other limits

- Request body: up to 20 MB.
- Each request runs for up to 15 minutes.
- `GET /v1/models` and `POST /v1/messages/count_tokens` are free.
