# AI providers

<a id="why-panes-isolated-worktrees-prevent-env-var-collision"></a>

Each agent signs in the way it does in any terminal, from its own login or the provider variables in its environment, so one [pane](/docs/panes-and-worktrees) can run on your subscription and another on a company Bedrock account.

| You want | Do this |
|---|---|
| Your Claude or ChatGPT subscription | Run `claude` and sign in, or `codex login`. Every pane on that machine uses it. |
| An API key for one repo | Add it in **Project Settings → Environment Variables** ([how](/docs/environment-variables#project-environment-variables)). |
| A different key in one pane | Export it in a tab, or use a `.envrc` or `.env` ([how](/docs/environment-variables#setting-env-vars-per-pane)). |
| A key the agent uses without pasting it in chat | Save it as a [Pane secret](#keep-keys-in-pane-secrets). |

> **Warning:** Agent logins stay on the machine where you signed in. Sign in on each computer that runs agents.

<a id="provider-quick-reference"></a>

<a id="setting-env-vars-per-pane"></a>

<a id="using-envrc-or-env"></a>

## What each agent reads

### Claude Code

| Provider | Set this |
|---|---|
| Anthropic API | `ANTHROPIC_API_KEY`. It overrides your subscription login. |
| A gateway (OpenRouter, Vercel AI Gateway, LiteLLM, GLM) | `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN`, from the gateway's Claude Code guide |
| Amazon Bedrock | `CLAUDE_CODE_USE_BEDROCK=1` plus AWS credentials ([guide](https://code.claude.com/docs/en/amazon-bedrock)) |
| Google Vertex AI | `CLAUDE_CODE_USE_VERTEX=1` plus your project and region ([guide](https://code.claude.com/docs/en/google-vertex-ai)) |
| Microsoft Foundry (Azure) | `CLAUDE_CODE_USE_FOUNDRY=1` plus `ANTHROPIC_FOUNDRY_RESOURCE` and a key ([guide](https://code.claude.com/docs/en/microsoft-foundry)) |

Full list: Claude Code's [environment variables reference](https://code.claude.com/docs/en/env-vars).

### Codex

`codex login` uses your ChatGPT account. For an API key, run `printenv OPENAI_API_KEY | codex login --with-api-key`.

Other providers, such as OpenRouter or Azure, go in a `[model_providers]` block in `~/.codex/config.toml`, whose `env_key` names the variable holding the key. Codex ignores this block in a project's `.codex/config.toml`. See [OpenRouter's Codex guide](https://openrouter.ai/docs/guides/coding-agents/codex-cli).

### Other agents and chat tabs

Aider, Goose, OpenCode and Cursor's CLI: see their [quick starts](/docs/quick-starts/aider).

A chat tab runs Claude, Codex or Cursor without a terminal and uses the same login. To give it an API key instead, use **Settings → AI & Agents → Chat tab sign-in**. That key stays on this machine.

## Keep keys in Pane secrets

A Pane secret is a named value, like `stripe/STRIPE_KEY`, kept in your OS secure store and synced to your other computers. An agent gets it in one of two ways:

1. A project variable whose source is **Pane secret** ([Project Settings](/docs/environment-variables#project-environment-variables)).
2. Running a command through `runpane secrets exec`:

```bash
runpane secrets exec --project stripe -- npm test
runpane secrets exec --project stripe --env API_KEY=STRIPE_KEY -- ./deploy.sh
```

When a secret is missing, the agent runs `runpane secrets request`. You type the value on a masked [Notify](/docs/notify) card and click **Save securely**. The agent only learns that it was saved.

Manage secrets in **Settings → Secrets**, or with `runpane secrets list`, `set` and `delete` (`runpane help secrets`).

> **Warning:** Secrets keep keys out of chat and shell history. They aren't a sandbox: any program running as you can use every secret. On a Linux server without a keyring, values sit in a private file as plain text.

## Shared credentials across hosts

Pane syncs the keys it uses itself to all your computers. Agents never get them.

| Shared key | Pane uses it for | Set it in |
|---|---|---|
| Deepgram, fal, OpenRouter | Voice dictation | **Settings → Integrations**, or the phone's voice setup |
| APNs key | iPhone notifications | **Settings → Integrations → iPhone notifications** |
| Anthropic | Naming new panes from your prompt | `anthropicApiKey` in `~/.pane/config.json` (or `$PANE_DIR`) |

Keys in a host's environment aren't shared. On that host, all four `PANE_APNS_*` variables win over the shared APNs key, while `DEEPGRAM_API_KEY`, `FAL_KEY` and `OPENROUTER_API_KEY` apply only when no shared key is set.

A desktop or the [iPhone app](/docs/phone#ios-app-beta) with more than one computer saved carries keys between them when it starts and when a key changes. The phone keeps no copy. The newest key wins, and removals sync too. **Settings → Integrations** shows where and when each was set. A host shares keys only with its owner's Tailscale login or a device paired to it. To link computers, see [Your computers](/docs/your-computers).

To stop sharing, unlink or forget the computer in **Settings → Remote Access → Computers**. It keeps the keys it already has until you remove them there.

## Related

- [Environment variables](/docs/environment-variables): variables Pane sets, and setting your own
- [MCP servers](/docs/mcp): Pane's tools for agents, and your own MCP servers
- [Security & permissions](/docs/security): what leaves your machine
