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

# Bring your own keys

> Run tasks on your own provider API keys at provider rates — Twill bills nothing for the AI usage.

For **cloud tasks**, BYOK model requests go directly from the sandbox to the provider using your API key. You pay the provider at their rates; Twill tracks the spend for visibility but doesn't bill it. Sandbox compute stays covered by your plan.

> [!NOTE]
>
> BYOK is available on the **Max** plan. See [Pricing](https://docs.twill.ai/pricing.md).

Local runs already use your native agent account and don’t need cloud BYOK. Their model usage does not consume Twill credits.

## Supported providers

Configure keys in **Settings → Bring Your Own Keys**. Each provider takes an API key and an optional base URL (for proxies or compatible gateways):

| Provider | Env vars set in the sandbox | Used by |
| - | - | - |
| Anthropic | `ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL` | Claude Code, OpenCode |
| OpenAI | `OPENAI_API_KEY`, `OPENAI_BASE_URL` | Codex, OpenCode |
| Google AI | `GOOGLE_GENERATIVE_AI_API_KEY`, `GOOGLE_BASE_URL` | OpenCode |
| OpenRouter | `OPENROUTER_API_KEY`, `OPENROUTER_BASE_URL` | OpenCode |

## Behavior

* Keys are stored encrypted and injected only into your workspace's sandboxes.
* If a task's model has no key configured for its provider, the task falls back to platform credits.
* Base URLs are scoped per provider, so you can route one provider through a gateway while others go direct.


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