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

# API keys

> Create keys for each tool or app, limit what they can spend, and fix keys that stop working.

## Create a key

Open [API Keys](https://refillapi.com/keys) and click **Create API Key**. Create one key per tool or app, so you can limit and revoke them separately.

| Field | What to enter |
| - | - |
| Name | Something you will recognize, such as `claude-code-laptop` |
| Expiration | Short for testing; longer or none for production |
| Quota | Spending limit for this key, in US dollars |
| Unlimited quota | Removes this key's own limit. It does not make calls free — they still use your wallet balance |
| Model limits | When on, the key can call only the selected models |
| IP allowlist | When set, only requests from these IPs are accepted |

Send the key in the `Authorization: Bearer YOUR_API_KEY` header. Anthropic-format tools may send it as `x-api-key` instead; both work.

## Ready-made tool configs

Click **Integration config** next to the key to get a config with your key, the base URL and a model ID already filled in, for Claude Code, Codex, OpenCode, Python and cURL. **Copy for your agent** turns it into instructions you can paste to an AI coding assistant, which then writes the config for you.

> [!WARNING]
>
> The generated config contains your full key. Do not share screenshots of it or commit it to a repository.

## When a key stops working

Every one of these returns `401 Invalid token` or a `403` error, even with credit in your wallet:

* the key is disabled, deleted or expired;
* the key has used up its own quota;
* the key's model limits do not include the model you called;
* the request comes from an IP outside the key's allowlist.

Check the key's status, expiry, remaining quota and model list on the [API Keys](https://refillapi.com/keys) page. See [Errors](https://docs.refillapi.com/errors.md) for the exact messages.

## Leaked keys

Delete a leaked key right away, create a new one, and update the tools that used it. Calls made with the old key before you deleted it are billed to your account.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.