How it works
Request enters the gateway
Claude Code talks to the gateway using the Anthropic Messages API. Your Claude
subscription token is forwarded through to Anthropic (OAuth passthrough), so
the request is served on your subscription.
Primary target is tried first
The gateway resolves the model to a route. The highest-priority target is your
Claude subscription.
Prerequisites
You need a Barndoor account with admin privileges, the LLM Gateway enabled for
your organization, and an active Claude subscription for the developer using it.
1. Configure the providers
In the Barndoor web UI, go to Admin > LLM Management > Providers.- Add an Anthropic provider and choose the Claude OAuth auth method. This is the passthrough provider: it stores no API key and forwards the caller’s subscription token.
- Add a fallback provider for the model you want to overflow to (for example an open model on a cloud you already use). Give it whatever credentials that provider needs.
2. Create a route with failover
Go to Model Routes and create a route under a single model name (the alias Claude Code will target). Add two targets, in priority order:| Priority | Target | Purpose |
|---|---|---|
| 1 (highest) | Anthropic (Claude OAuth) | Primary, served on your subscription |
| 2 | Fallback provider | Overflow when the subscription is rate-limited |

Targets are tried top to bottom. Set the primary’s retry-on-429 count if you
want the gateway to briefly retry the subscription before spilling; leave it at 0
to fail over immediately.
3. Create a gateway API key
Go to API Keys and create a key. This authenticates Claude Code to the gateway; it is separate from your Claude subscription token, which the gateway forwards to Anthropic.4. Point Claude Code at the gateway
Stay logged into Claude Code with your Claude subscription so it sends its OAuth token, then set these environment variables and launchclaude:
x-api-key header authenticates you to the
gateway, while Claude Code’s Authorization: Bearer subscription token is
what the gateway forwards to Anthropic.