Menu

Claude Code

Last updated

AI Gateway provides Anthropic-compatible API endpoints so you can use Claude Code through a unified gateway.

Claude Code is Anthropic's agentic coding tool. You can configure it to use Vercel AI Gateway, enabling you to:

  • Route requests through multiple AI providers
  • Monitor traffic and spend in your AI Gateway Overview
  • View detailed traces in Vercel Observability under AI
  • Use any model available through the gateway
  1. First, log out if you're already logged in:

    Next, ensure you have your AI Gateway API key handy, and configure Claude Code to use the AI Gateway by adding this to your shell configuration file, for example in or :

    Setting to an empty string is important. Claude Code checks this variable first, and if it's set to a non-empty value, it will use that instead of .

  2. Run to start Claude Code with AI Gateway:

    Your requests will now be routed through Vercel AI Gateway.

  3. You can override the default models that Claude Code uses by setting additional environment variables:

    This allows you to use any model available through the AI Gateway while still using Claude Code's familiar interface.

    Models vary widely in their support for tools, extended thinking, and other features that Claude Code relies on. Performance may differ significantly depending on the model and provider you select.

  4. If you're on a Mac and would like to manage your API key through a keychain for improved security, set your API key in the keystore with:

    and edit the line above to:

    If you need to update the API key value later, you can do it with:


Was this helpful?

supported.