Skip to content
AI GatewayAI Gateway Manual

Anthropic

How to connect an Anthropic Provider with your organization's API key, or so that users send requests on their own Claude subscriptions.

This guide covers only what differs for the Anthropic type. For adding the Provider, reviewing models, and allowing them in projects, follow Connect model Providers.

An Anthropic Provider accepts chat requests only. It does not support embeddings or image generation.

There are two Authentication methods, and the method cannot be changed after saving. To use both, add a separate Anthropic Provider with a different name.

Provider API keyPersonal Claude subscription
Anthropic authenticationServer API key saved by the administratorOAuth token that the user’s Claude Code sends with each request. AI Gateway does not store it
Model listRead from Anthropic when you save the ProviderRegistered from AI Gateway’s built-in Claude model list when you save the Provider
BillingYour organization’s Anthropic accountEach user’s own Claude subscription
Callable APIsSame as other ProvidersAnthropic Messages API (/anthropic) only
  1. Choose Anthropic as the Provider type. Base URL is filled with https://api.anthropic.com.
  2. Under Authentication, choose Provider API key.
  3. Enter an API key issued by Anthropic in Credential.

AI Gateway provides built-in prices for Anthropic models, and administrators cannot change them. See Model pricing and costs.

Connection settings: Personal Claude subscription

Section titled “Connection settings: Personal Claude subscription”

Use this method to let users connect Claude Code, signed in with their own Claude subscription, to AI Gateway. Requests to this Provider reach Anthropic with the OAuth token that the user’s Claude Code sends with each request, instead of a server API key. AI Gateway applies Project permissions, the model allow policy, and usage limits exactly as it does for the API key method.

  • Client: users sign in with the official Claude Code. The user-side setup is in Connect Claude Code.
  • Cost: costs shown in AI Gateway are estimates based on API list prices. Subscription requests are charged to each user’s Claude account, so they are not deducted from Project Budgets and are not blocked when a Budget runs out. Request and token limits still apply to them. Actual charges and usage limits are set by each user’s Claude account.
  1. In AI resources → Model Providers, select Add provider.
  2. Enter a Name. It becomes the prefix of the model IDs users call. Example: claude-subscription/claude-opus-5-5
  3. Set Provider type to Anthropic.
  4. Under Authentication, select Personal Claude subscription. Base URL is fixed to https://api.anthropic.com, and the credential field disappears. Test connection is not shown either.
  5. Select Save provider. The Provider is created enabled, with AI Gateway’s built-in Claude models registered. No one can call these models until a project’s policy allows them.

In the Network section, you can change only the timeouts. CA certificate (PEM), Skip TLS verification, and Allow private network are locked so the token cannot be sent anywhere else.

This Provider does not read Anthropic’s model list; it uses AI Gateway’s built-in Claude model list instead. Anthropic’s policy does not let AI Gateway sign in with a user’s subscription to read Anthropic’s model list.

  1. In AI resources → Model Providers, open the Provider and go to the Models view. The models registered when you saved the Provider are listed.
  2. Check the update status to the right of the search box. When the registered models match the built-in list, it shows Models are up to date. When an AI Gateway upgrade has added models to the built-in list, it shows N model updates available.
  3. Select N model updates available. In the Review model updates dialog, every model under New models is selected and none under Models not in the built-in list is. To delete a model, select it under Models not in the built-in list.
  4. Select Update.

There is no field for entering model IDs. You cannot add a model that is not in the built-in list from this view.

AI Gateway does not check whether users’ subscriptions can use a registered model. If a user’s subscription plan does not support a model, Anthropic rejects the request.

Before Claude Code runs a tool in auto mode, it asks a Sonnet model whether the tool may run. To let users run this check on Sonnet, also allow a Sonnet model in the Project. Otherwise Claude Code runs the check on the main model the user specified, so every tool run uses that model’s subscription usage.

  1. In the AI resources → Model Providers list, check that the Provider is enabled. If it is disabled, Enable it.
  2. Add <provider-name>/<model-id> to the model allow policy of the project that will use it. Example: claude-subscription/claude-opus-5-5

A user’s OAuth token is used only when the final target is a personal Claude subscription Provider. If you use routing rules, check the final target.

  • When the model a subscription user selects, or the final target of a routing rule, is another Provider, AI Gateway sends the request with the credentials stored for that Provider. The token is not sent to that Provider, and the cost is charged to your organization’s Provider account and deducted from Project Budgets. Models allowed in a project are available with both the API key method and the subscription method; there is no setting that blocks them for subscription users only.
  • When a request sent to a subscription Provider fails, AI Gateway does not retry with another rule or a server API key.
  • A request made with the API key method that reaches a model of this Provider fails with a model error.

The setup guidance on the user’s Models page assumes the API key method and does not mark models of subscription Providers. Give users the following directly.

  • The model ID to use: <provider-name>/<model-id>. If you allowed a Sonnet model for auto mode, give its ID too.
  • The project where you allowed the models. Users issue their Gateway Key in this project.
  • The setup guide: Connect Claude Code when they run Claude Code in a terminal, or Claude Code personal subscription settings when they launch it from Companion.
  • That a personal subscription does not work in Claude Desktop. When Claude Desktop is signed in with an Anthropic account, its Code tab does not go through the Gateway. The Third-Party Inference Gateway connection that Companion sets up authenticates only with a Gateway Key, so its requests use the Provider credentials you registered.

In Model Logs, a request sent on a personal Claude subscription shows Personal Claude subscription as its Authentication source. Requests the same user sent to models of other Providers show Gateway-managed credentials, so you can tell subscription requests apart from requests handled with server credentials.

An error returned by Anthropic applies only to the user who sent that request. On a 401 or 429, AI Gateway does not disable the Provider or switch to other credentials.

Error the user receivedWhat to check
401The user’s Claude Code login has expired. The user signs in again with /login in Claude Code.
429The user hit their subscription’s usage limit. Check the limit in the Claude account.
400 model errorThe user put the Gateway Key in ANTHROPIC_API_KEY and sent the request with the API key method.
An error saying the model was not found or is not allowedThe model ID is missing the Provider name, the model is not in the built-in list, or it is not allowed in the project.