{"slug":"use-claude-code-with-aperture","title":"Use Claude Code with Aperture","tags":["tailscale"],"agent_summary":"Last validated: Apr 9, 2026","trigger_phrases":[],"runnable":false,"markdown":"\r\n# Use Claude Code with Aperture\r\n\r\nLast validated: Apr 9, 2026\r\n\r\nAperture by Tailscaleis currently [in alpha](https://tailscale.com/docs/reference/tailscale-release-stages#alpha).\r\n\r\nConfigure [Claude Code](https://docs.anthropic.com/en/docs/claude-code) to send requests through [Aperture by Tailscale](https://tailscale.com/docs/aperture) so your organization gets centralized API key management, usage tracking, and session logging.\r\n\r\n## [Prerequisites](https://tailscale.com/docs/aperture/how-to/use-claude-code\\#prerequisites)\r\n\r\nBefore you begin, you need:\r\n\r\n- An Aperture instance with at least one configured AI provider (such as Anthropic), accessible from your device. Refer to [get started with Aperture](https://tailscale.com/docs/aperture/get-started) if you have not set this up.\r\n- The Aperture host URL (default: `http://ai`) accessible from your device. Use `http://`, not `https://`.\r\n- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) installed on your device.\r\n\r\nTo 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.\r\n\r\nAperture 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](https://tailscale.com/docs/aperture/provider-compatibility) for the full list of supported providers and API formats.\r\n\r\n## [Configure Claude Code](https://tailscale.com/docs/aperture/how-to/use-claude-code\\#configure-claude-code)\r\n\r\nTo 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:\r\n\r\n```json\r\n{\r\n  \"apiKeyHelper\": \"echo '-'\",\r\n  \"env\": {\r\n    \"ANTHROPIC_BASE_URL\": \"http://ai\"\r\n  }\r\n}\r\n```\r\n\r\nThe `apiKeyHelper` setting returns a placeholder value because Aperture injects credentials automatically. You do not need to configure an API key on the client.\r\n\r\nYou can also configure Claude Code using environment variables instead of a settings file. Set the following environment variables:\r\n\r\n```shell\r\nexport ANTHROPIC_BASE_URL=\"http://ai\"\r\n```\r\n\r\nClaude 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.\r\n\r\n```json\r\n{\r\n \"model\": \"claude-sonnet-4-5\",\r\n \"env\": {\r\n  \"ANTHROPIC_AUTH_TOKEN\": \"bearer-managed\",\r\n  \"ANTHROPIC_BASE_URL\": \"http://ai\"\r\n }\r\n}\r\n```\r\n\r\n### [Claude Code with Amazon Bedrock](https://tailscale.com/docs/aperture/how-to/use-claude-code\\#claude-code-with-amazon-bedrock)\r\n\r\nIf your Aperture instance routes through Amazon Bedrock, add the following to your `settings.json` instead of the default configuration:\r\n\r\n```json\r\n{\r\n  \"env\": {\r\n    \"ANTHROPIC_MODEL\": \"claude-sonnet-4-5\",\r\n    \"ANTHROPIC_BEDROCK_BASE_URL\": \"http://ai/bedrock\",\r\n    \"CLAUDE_CODE_USE_BEDROCK\": \"1\",\r\n    \"CLAUDE_CODE_SKIP_BEDROCK_AUTH\": \"1\"\r\n  }\r\n}\r\n```\r\n\r\nIf 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)**).\r\n\r\n### [Claude Code with Vertex AI](https://tailscale.com/docs/aperture/how-to/use-claude-code\\#claude-code-with-vertex-ai)\r\n\r\nIf 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.\r\n\r\n```json\r\n{\r\n  \"env\": {\r\n    \"CLOUD_ML_REGION\": \"global\",\r\n    \"ANTHROPIC_VERTEX_PROJECT_ID\": \"YOUR_PROJECT_ID\",\r\n    \"CLAUDE_CODE_USE_VERTEX\": \"1\",\r\n    \"CLAUDE_CODE_SKIP_VERTEX_AUTH\": \"1\",\r\n    \"ANTHROPIC_VERTEX_BASE_URL\": \"http://ai/v1\"\r\n  }\r\n}\r\n```\r\n\r\nIf 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)**).\r\n\r\n## [Verify the connection](https://tailscale.com/docs/aperture/how-to/use-claude-code\\#verify-the-connection)\r\n\r\n1. Send a test message in Claude Code.\r\n2. Open the Aperture dashboard at `http://ai/ui/` and confirm the request appears on the **Logs** page.\r\n\r\nIf the request does not appear, refer to the [Aperture troubleshooting guide](https://tailscale.com/docs/aperture/troubleshooting).\r\n\r\n## [Next steps](https://tailscale.com/docs/aperture/how-to/use-claude-code\\#next-steps)\r\n\r\n- [Grant model access to users](https://tailscale.com/docs/aperture/how-to/grant-model-access): Control which models each user or group can access through Aperture.\r\n- [View your usage dashboards](https://tailscale.com/docs/aperture/reference/dashboard): Monitor token consumption, costs, and session activity across your organization.\r\n- [Set per-user spending limits](https://tailscale.com/docs/aperture/how-to/set-per-user-spending-limits): Configure quota buckets to control costs for individual users.\r\n","html":"<h1>Use Claude Code with Aperture</h1>\n<p>Last validated: Apr 9, 2026</p>\n<p>Aperture by Tailscaleis currently <a href=\"https://tailscale.com/docs/reference/tailscale-release-stages#alpha\">in alpha</a>.</p>\n<p>Configure <a href=\"https://docs.anthropic.com/en/docs/claude-code\">Claude Code</a> to send requests through <a href=\"https://tailscale.com/docs/aperture\">Aperture by Tailscale</a> so your organization gets centralized API key management, usage tracking, and session logging.</p>\n<h2><a href=\"https://tailscale.com/docs/aperture/how-to/use-claude-code#prerequisites\">Prerequisites</a></h2>\n<p>Before you begin, you need:</p>\n<ul>\n<li>An Aperture instance with at least one configured AI provider (such as Anthropic), accessible from your device. Refer to <a href=\"https://tailscale.com/docs/aperture/get-started\">get started with Aperture</a> if you have not set this up.</li>\n<li>The Aperture host URL (default: <code>http://ai</code>) accessible from your device. Use <code>http://</code>, not <code>https://</code>.</li>\n<li><a href=\"https://docs.anthropic.com/en/docs/claude-code\">Claude Code</a> installed on your device.</li>\n</ul>\n<p>To avoid unexpected TLS issues, use <code>http://</code> for the Aperture URL when configuring LLM clients. All connections remain encrypted using WireGuard, even when HTTPS is not used.</p>\n<p>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 <a href=\"https://tailscale.com/docs/aperture/provider-compatibility\">provider compatibility reference</a> for the full list of supported providers and API formats.</p>\n<h2><a href=\"https://tailscale.com/docs/aperture/how-to/use-claude-code#configure-claude-code\">Configure Claude Code</a></h2>\n<p>To configure Claude Code to use Aperture, create or edit the global Claude Code settings file (<code>~/.claude/settings.json</code>) to use the Aperture URL as the <code>ANTHROPIC_BASE_URL</code>. The following example includes some additional recommended settings:</p>\n<pre><code class=\"language-json\">{\r\n  \"apiKeyHelper\": \"echo '-'\",\r\n  \"env\": {\r\n    \"ANTHROPIC_BASE_URL\": \"http://ai\"\r\n  }\r\n}\n</code></pre>\n<p>The <code>apiKeyHelper</code> setting returns a placeholder value because Aperture injects credentials automatically. You do not need to configure an API key on the client.</p>\n<p>You can also configure Claude Code using environment variables instead of a settings file. Set the following environment variables:</p>\n<pre><code class=\"language-shell\">export ANTHROPIC_BASE_URL=\"http://ai\"\n</code></pre>\n<p>Claude Code v1.x requires additional configuration because the <code>apiKeyHelper</code> setting does not exist in earlier versions. You must provide a placeholder authentication token and explicitly specify the model.</p>\n<pre><code class=\"language-json\">{\r\n \"model\": \"claude-sonnet-4-5\",\r\n \"env\": {\r\n  \"ANTHROPIC_AUTH_TOKEN\": \"bearer-managed\",\r\n  \"ANTHROPIC_BASE_URL\": \"http://ai\"\r\n }\r\n}\n</code></pre>\n<h3><a href=\"https://tailscale.com/docs/aperture/how-to/use-claude-code#claude-code-with-amazon-bedrock\">Claude Code with Amazon Bedrock</a></h3>\n<p>If your Aperture instance routes through Amazon Bedrock, add the following to your <code>settings.json</code> instead of the default configuration:</p>\n<pre><code class=\"language-json\">{\r\n  \"env\": {\r\n    \"ANTHROPIC_MODEL\": \"claude-sonnet-4-5\",\r\n    \"ANTHROPIC_BEDROCK_BASE_URL\": \"http://ai/bedrock\",\r\n    \"CLAUDE_CODE_USE_BEDROCK\": \"1\",\r\n    \"CLAUDE_CODE_SKIP_BEDROCK_AUTH\": \"1\"\r\n  }\r\n}\n</code></pre>\n<p>If you use Claude Code in VS Code with Bedrock, also add <code>\"claudeCode.disableLoginPrompt\": true</code> to your VS Code user settings JSON (open the <strong>Command Palette</strong> and select <strong>Preferences: Open User Settings (JSON)</strong>).</p>\n<h3><a href=\"https://tailscale.com/docs/aperture/how-to/use-claude-code#claude-code-with-vertex-ai\">Claude Code with Vertex AI</a></h3>\n<p>If your Aperture instance routes through Vertex AI, add the following to your <code>settings.json</code> instead of the default configuration. Replace <code>YOUR_PROJECT_ID</code> with your Google Cloud project ID.</p>\n<pre><code class=\"language-json\">{\r\n  \"env\": {\r\n    \"CLOUD_ML_REGION\": \"global\",\r\n    \"ANTHROPIC_VERTEX_PROJECT_ID\": \"YOUR_PROJECT_ID\",\r\n    \"CLAUDE_CODE_USE_VERTEX\": \"1\",\r\n    \"CLAUDE_CODE_SKIP_VERTEX_AUTH\": \"1\",\r\n    \"ANTHROPIC_VERTEX_BASE_URL\": \"http://ai/v1\"\r\n  }\r\n}\n</code></pre>\n<p>If you use Claude Code in VS Code with Vertex, also add <code>\"claudeCode.disableLoginPrompt\": true</code> to your VS Code user settings JSON (open the <strong>Command Palette</strong> and select <strong>Preferences: Open User Settings (JSON)</strong>).</p>\n<h2><a href=\"https://tailscale.com/docs/aperture/how-to/use-claude-code#verify-the-connection\">Verify the connection</a></h2>\n<ol>\n<li>Send a test message in Claude Code.</li>\n<li>Open the Aperture dashboard at <code>http://ai/ui/</code> and confirm the request appears on the <strong>Logs</strong> page.</li>\n</ol>\n<p>If the request does not appear, refer to the <a href=\"https://tailscale.com/docs/aperture/troubleshooting\">Aperture troubleshooting guide</a>.</p>\n<h2><a href=\"https://tailscale.com/docs/aperture/how-to/use-claude-code#next-steps\">Next steps</a></h2>\n<ul>\n<li><a href=\"https://tailscale.com/docs/aperture/how-to/grant-model-access\">Grant model access to users</a>: Control which models each user or group can access through Aperture.</li>\n<li><a href=\"https://tailscale.com/docs/aperture/reference/dashboard\">View your usage dashboards</a>: Monitor token consumption, costs, and session activity across your organization.</li>\n<li><a href=\"https://tailscale.com/docs/aperture/how-to/set-per-user-spending-limits\">Set per-user spending limits</a>: Configure quota buckets to control costs for individual users.</li>\n</ul>\n"}