Skip to content

Claude Desktop

Last updated View as MarkdownAgent setup

By pointing Claude Desktop ↗︎ at AI Gateway instead of Anthropic directly, you get observability, caching, and centralized credentials for your Anthropic requests, without changing how you use Claude Desktop. Claude Desktop can send third-party inference requests to a custom gateway; this configuration sends those requests to AI Gateway's Anthropic endpoint, authenticated with your Cloudflare gateway token or Cloudflare Access. AI Gateway can supply the Anthropic credentials for you through Unified Billing or a stored provider key (BYOK).

If your gateway is protected by Cloudflare Access, refer to Use with Cloudflare Access.

Prerequisites

Before you start, you need:

Use with a gateway token

  1. In Claude Desktop, select Help > Troubleshooting > Enable Developer Mode.

  2. Select Developer > Configure Third-Party Inference.

  3. In Connection, set the connection type to Gateway.

  4. In Gateway credentials, set Credential kind to Static API key.

  5. Set Gateway API key to your Cloudflare gateway token.

    Replace <CF_AIG_TOKEN> with your gateway token.

    <CF_AIG_TOKEN>
  6. Set Gateway auth scheme to Bearer.

  7. Set the gateway base URL to your gateway's Anthropic endpoint.

    Replace <ACCOUNT_ID> and <GATEWAY_ID> with your values.

    https://gateway.ai.cloudflare.com/v1/<ACCOUNT_ID>/<GATEWAY_ID>/anthropic
  8. In Models, add the Claude model you want to use.

    Field Value
    Model ID claude-sonnet-4-5
    Display name Claude Sonnet 4.5
    Tier alias sonnet
  9. In Gateway credentials, select Test connection.

  10. Start a Claude Desktop conversation. Requests now route through AI Gateway.

Use with Cloudflare Access

If your gateway is protected by Cloudflare Access, Claude Desktop can authenticate with a short-lived Access token instead of a gateway token. Use a local helper script to fetch the token with cloudflared.

Before you start, set up a custom domain protected by Access with a policy that allows your identity. Install cloudflared on the machine running Claude Desktop.

  1. Create a local helper script, replacing ai-gateway.example.com with your gateway's custom domain:

    aig-access.shsh
    #!/bin/sh
    exec cloudflared access login --no-verbose --app https://ai-gateway.example.com

    The --no-verbose flag prints only the JSON Web Token (JWT) to standard output, as the helper requires. If Claude Desktop cannot find cloudflared, replace it in the script with the full path returned by command -v cloudflared.

  2. Make the script executable:

    chmod +x aig-access.sh
  3. In Claude Desktop, select Help > Troubleshooting > Enable Developer Mode.

  4. Select Developer > Configure Third-Party Inference.

  5. In Connection, set the connection type to Gateway.

  6. In Gateway credentials, set Credential kind to Helper script and Gateway auth scheme to Bearer.

  7. Set the gateway base URL to https://ai-gateway.example.com/anthropic, replacing ai-gateway.example.com with your gateway's custom domain.

  8. In Helper Script, set the path to your local aig-access.sh script. Use the full path to the file.

  9. In Models, add the Claude model you want to use.

  10. In Gateway credentials, select Test connection. Complete the Access login flow when prompted, then start a Claude Desktop conversation.

To confirm traffic reaches AI Gateway, refer to Verify it works.

Was this helpful?