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 (default:
http://ai) accessible from your device. Usehttp://, 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) to use the Aperture URL as the ANTHROPIC_BASE_URL. The following example includes some additional recommended settings:
{
"apiKeyHelper": "echo '-'",
"env": {
"ANTHROPIC_BASE_URL": "http://ai"
}
}
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 environment variables instead of a settings file. Set the following environment variables:
export ANTHROPIC_BASE_URL="http://ai"
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-5",
"env": {
"ANTHROPIC_AUTH_TOKEN": "bearer-managed",
"ANTHROPIC_BASE_URL": "http://ai"
}
}
Claude Code with Amazon Bedrock
If your Aperture instance routes through Amazon Bedrock, add the following to your settings.json instead of the default configuration:
{
"env": {
"ANTHROPIC_MODEL": "claude-sonnet-4-5",
"ANTHROPIC_BEDROCK_BASE_URL": "http://ai/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, add the following to your settings.json instead of the default configuration. Replace YOUR_PROJECT_ID with your Google Cloud project ID.
{
"env": {
"CLOUD_ML_REGION": "global",
"ANTHROPIC_VERTEX_PROJECT_ID": "YOUR_PROJECT_ID",
"CLAUDE_CODE_USE_VERTEX": "1",
"CLAUDE_CODE_SKIP_VERTEX_AUTH": "1",
"ANTHROPIC_VERTEX_BASE_URL": "http://ai/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
- Send a test message in Claude Code.
- Open the Aperture dashboard at
http://ai/ui/and confirm the request appears on the Logs page.
If the request does not appear, refer to the Aperture troubleshooting guide.
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.