Use Claude Code with Aperture
Last validated:
Configure Claude Code to send requests through Aperture by Tailscale so your organization gets centralized API key management, usage tracking, and session logging.
Prerequisites
Before you begin, you need:
- An Aperture instance with at least one configured AI provider (such as Anthropic), accessible from your device. Refer to get started with Aperture if you have not set this up.
- The Aperture host URL accessible from your device. Use
http://, nothttps://. - Claude Code installed on your device.
To avoid unexpected TLS issues, use http:// for the Aperture URL when configuring LLM clients. All connections remain encrypted using WireGuard, even when HTTPS is not used.
Aperture routes requests based on the model name, not the LLM client. Any LLM client configured to use Aperture can access any provider your admin has set up. Refer to the provider compatibility reference for the full list of supported providers and API formats.
Configure Claude Code
To configure Claude Code to use Aperture, create or edit the global Claude Code settings file (~/.claude/settings.json) and set ANTHROPIC_BASE_URL to your Aperture URL:
{
"apiKeyHelper": "echo '-'",
"env": {
"ANTHROPIC_BASE_URL": "http://<aperture-hostname>"
}
}
The apiKeyHelper setting returns a placeholder value because Aperture injects credentials automatically. You do not need to configure an API key on the client.
You can also configure Claude Code using an environment variable instead of a settings file. Set the following environment variable:
export ANTHROPIC_BASE_URL="http://<aperture-hostname>"
Claude Code v1.x requires additional configuration because the apiKeyHelper setting does not exist in earlier versions. You must provide a placeholder authentication token and explicitly specify the model.
{
"model": "claude-sonnet-4-6",
"env": {
"ANTHROPIC_AUTH_TOKEN": "bearer-managed",
"ANTHROPIC_BASE_URL": "http://<aperture-hostname>"
}
}
Claude Code with Amazon Bedrock
If your Aperture instance routes through Amazon Bedrock, use the following settings.json configuration instead of the default Anthropic configuration shown above:
{
"env": {
"ANTHROPIC_MODEL": "claude-sonnet-4-6",
"ANTHROPIC_BEDROCK_BASE_URL": "http://<aperture-hostname>/bedrock",
"CLAUDE_CODE_USE_BEDROCK": "1",
"CLAUDE_CODE_SKIP_BEDROCK_AUTH": "1"
}
}
If you use Claude Code in VS Code with Bedrock, also add "claudeCode.disableLoginPrompt": true to your VS Code user settings JSON (open the Command Palette and select Preferences: Open User Settings (JSON)).
Claude Code with Vertex AI
If your Aperture instance routes through Vertex AI, use the following settings.json configuration instead of the default Anthropic configuration. Replace <project-id> with your Google Cloud project ID.
{
"env": {
"CLOUD_ML_REGION": "global",
"ANTHROPIC_VERTEX_PROJECT_ID": "<project-id>",
"CLAUDE_CODE_USE_VERTEX": "1",
"CLAUDE_CODE_SKIP_VERTEX_AUTH": "1",
"ANTHROPIC_VERTEX_BASE_URL": "http://<aperture-hostname>/v1"
}
}
If you use Claude Code in VS Code with Vertex, also add "claudeCode.disableLoginPrompt": true to your VS Code user settings JSON (open the Command Palette and select Preferences: Open User Settings (JSON)).
Verify the connection
To verify that Claude Code routes requests through Aperture:
- Send a test message in Claude Code.
- Open the Aperture dashboard at
http://<aperture-hostname>/ui/and confirm the request appears on the Logs page.
If the request does not appear, refer to the Aperture troubleshooting topic.
Next steps
- Grant model access to users: Control which models each user or group can access through Aperture.
- View your usage dashboards: Monitor token consumption, costs, and session activity across your organization.
- Set per-user spending limits: Configure quota buckets to control costs for individual users.