> ## 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

> Use your own AI provider API keys for full cost control.

Bring Your Own Keys (BYOK) lets you connect your own API keys from AI providers. When BYOK is enabled, agent requests go directly to the provider instead of through Twill's proxy. You pay the provider at their standard rates and Twill does not bill for AI usage.

<Note>BYOK is available on the **Max** plan.</Note>

## Supported providers

| Provider       | Env variable                   | Works with            |
| -------------- | ------------------------------ | --------------------- |
| **Anthropic**  | `ANTHROPIC_API_KEY`            | Claude Code, OpenCode |
| **OpenAI**     | `OPENAI_API_KEY`               | Codex, OpenCode       |
| **Google AI**  | `GOOGLE_GENERATIVE_AI_API_KEY` | OpenCode              |
| **OpenRouter** | `OPENROUTER_API_KEY`           | OpenCode              |

## Setup

<Steps>
  <Step title="Go to Settings">
    Navigate to **Settings > Bring Your Own Keys** in your workspace.
  </Step>

  <Step title="Add a provider key">
    Select the provider, paste your API key, and save. You can add keys for multiple providers.
  </Step>

  <Step title="Create a task">
    When you create a task, select an agent and model supported by your configured provider. Twill routes the request directly to the provider using your key.
  </Step>
</Steps>

## Good to know

* BYOK usage is tracked in Twill for visibility, but you are not billed for it through Twill. Set spending limits directly with your provider.
* Sandbox compute is still covered by your Twill plan.
* If you select an agent and model that requires a provider you have not configured, the task falls back to Twill's platform credits.
