> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llm.kiwi/llms.txt
> Use this file to discover all available pages before exploring further.

# Limits and pricing

> LLM.kiwi pricing and usage limits: free-tier access, per-minute rate limits, token quotas, request size caps, and fair-use throttling behavior explained.

LLM.kiwi is currently free to use without a credit card. Usage limits protect reliable access for everyone.

<Note>
  Limits can change as capacity and model availability change. Treat response headers and API errors as the runtime source of truth rather than hardcoding a quota into your application.
</Note>

## Free access

| Item        | Current behavior                                |
| ----------- | ----------------------------------------------- |
| Price       | Free                                            |
| Credit card | Not required                                    |
| API keys    | Created and managed in the dashboard            |
| Models      | Query `GET /v1/models` for current availability |
| Base URL    | `https://api.llm.kiwi/v1`                       |

Free access does not mean unlimited capacity. Applications must handle rate limits and temporary unavailability gracefully.

## Rate limits

When a limit is reached, the API returns HTTP `429 Too Many Requests`.

Your application should:

1. Stop sending immediate retries.
2. Respect `Retry-After` if the response includes it.
3. Otherwise wait using exponential backoff with small random jitter.
4. Give up after a limited number of attempts.
5. Show the user a clear, temporary error.

```python theme={null}
import random
import time
from openai import RateLimitError


def create_with_retry(client, messages, attempts=3):
    for attempt in range(attempts):
        try:
            return client.chat.completions.create(
                model="auto",
                messages=messages,
                timeout=30,
            )
        except RateLimitError:
            if attempt == attempts - 1:
                raise
            delay = (2 ** attempt) + random.uniform(0, 0.5)
            time.sleep(delay)
```

Do not create many API keys to evade limits. That can degrade the service and may lead to access restrictions.

## Tokens and context

Models process text as tokens. Both your input and the generated output count toward the model's context capacity.

```json theme={null}
{
  "usage": {
    "prompt_tokens": 120,
    "completion_tokens": 45,
    "total_tokens": 165
  }
}
```

| Field               | Meaning                                                  |
| ------------------- | -------------------------------------------------------- |
| `prompt_tokens`     | System instructions, conversation history, and new input |
| `completion_tokens` | Generated response                                       |
| `total_tokens`      | Combined input and output usage                          |

Tokenization differs between languages and models, so word counts are only rough estimates.

## Keep requests efficient

* Keep system instructions specific and remove repetition.
* Send only conversation history needed for the next answer.
* Summarize older turns in long conversations.
* Use `max_tokens` when the endpoint and selected model support it.
* Cache deterministic results that are safe to reuse.
* Avoid sending the same request repeatedly after a permanent error.
* Limit concurrent requests in background jobs.

## Request too large

An oversized request commonly returns a `400` error. Reduce one or more of:

* The user input
* Included documents
* Conversation history
* Requested maximum output

When processing a large document, split it at meaningful boundaries, process the sections, and then combine or summarize the results.

## Design for changing capacity

For production-like prototypes:

* Set a connection and response timeout.
* Handle `429`, `500`, and `503` as temporary failures.
* Queue background work instead of starting unlimited parallel requests.
* Track success rate and latency without logging private content or API keys.
* Provide a fallback message when the service is unavailable.

<CardGroup cols={2}>
  <Card title="Error reference" icon="triangle-exclamation" href="/errors">
    Decide which failures can be retried.
  </Card>

  <Card title="Best practices" icon="shield" href="/best-practices">
    Secure and stabilize your integration.
  </Card>
</CardGroup>
