For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Claude Desktop
Configure Claude Desktop to use agentgateway
Configure Claude Desktop to route requests through your agentgateway proxy using a Claude Teams or Pro account.
Before you begin
- Install the
agentgatewaybinary. - Install Claude Desktop.
- Install the Claude Code CLI (
npm install -g @anthropic-ai/claude-code). This is required to runclaude setup-tokenand obtain your bearer token. - Have a Claude Teams or Pro subscription.
Configure agentgateway
Start agentgateway with the Teams configuration. Agentgateway listens on port 4001 and exposes Claude at the /claude path.
Create a configuration file.
cat > config.yaml << 'EOF' binds: - port: 4001 listeners: - name: default protocol: HTTP routes: - name: claude-agent matches: - path: pathPrefix: /claude policies: urlRewrite: path: prefix: / backends: - ai: name: claude-agent provider: anthropic: {} policies: ai: routes: /v1/messages: messages /v1/messages/count_tokens: anthropicTokenCount '*': passthrough EOFStart agentgateway.
agentgateway -f config.yaml
Claude Code automatically sends the anthropic-beta: oauth-2025-04-20 header required for OAuth-based authentication. Claude Desktop may require this header to be set as well depending on your client version. If requests fail with a 400 error, add the following to the passthrough route policy in your config:
policies:
requestHeaderModifier:
add:
anthropic-beta: oauth-2025-04-20Configure Claude Desktop
Get a bearer token for your Claude account.
claude setup-tokenCopy the token printed to the terminal.
Open Claude Desktop and enable developer mode: Help → Troubleshooting → Enable Developer Mode. Then fully quit and relaunch Claude Desktop. A new Developer menu appears in the menu bar.
In the menu bar, go to Developer → Configure Third Party Inference → Gateway.
Enter the gateway URL. Use
127.0.0.1rather thanlocalhost.http://127.0.0.1:4001/claudeEnter the bearer token you copied in step 1.
Click Save and restart Claude Desktop.
Verify the connection
Send a message in Claude Desktop. If the connection is successful, responses flow through your agentgateway proxy and appear in the terminal where agentgateway is already running.
Look for log entries like the following in your running agentgateway output:
info request gateway=default/default listener=http route=claude-agent endpoint=api.anthropic.com:443 http.method=POST http.path=/v1/messages http.status=200 protocol=llm