# Use any coding agent with one key

> Claude Code, Codex, OpenCode, Cursor, and other OpenAI-compatible tools share 406+ models, one balance, and one request log.

Point any coding agent at one URL

**Slug**: `coding-agents`  
**URL**: https://anyrouter.dev/use-cases/coding-agents  
**Markdown**: https://anyrouter.dev/use-cases/coding-agents.md  
**Short link**: https://anyrouter.dev/u/coding-agents  

## Why use this

Each coding agent wants its own provider key and base URL. Switching models or comparing cost means editing every tool separately.

## Set it up

1. Mint one AnyRouter key. If you hold provider keys, add them once on /byok.
2. Set the Anthropic env vars for Claude Code and the OpenAI env vars for Codex. Cursor and other tools take the same URL and key in their OpenAI-compatible model settings.
3. Start on anyrouter/auto so failover picks a model that is answering, or anyrouter/coding to run only on your own keys.

## Code

### Claude Code

```bash
export ANTHROPIC_BASE_URL="https://anyrouter.dev/api"
export ANTHROPIC_API_KEY="$ANYROUTER_API_KEY"
```

### Codex

```bash
export OPENAI_BASE_URL="https://anyrouter.dev/api/v1"
export OPENAI_API_KEY="$ANYROUTER_API_KEY"
```

### OpenCode

```bash
anyr opencode
```

### Cursor

```text
Cursor settings → Models → OpenAI-compatible custom model
Base URL:  https://anyrouter.dev/api/v1
API key:   your sk-ar- key
Model:     anyrouter/coding
```

## Related

- [claude-code](https://anyrouter.dev/use-cases/claude-code)
- [codex](https://anyrouter.dev/use-cases/codex)
- [opencode](https://anyrouter.dev/use-cases/opencode)
- [free-tier-keys](https://anyrouter.dev/use-cases/free-tier-keys)
