Skip to main content

Documentation Index

Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Anthropic provides Claude models. The AI Gateway supports Anthropic as a managed provider—no Anthropic account needed—and also works with your own Anthropic API key. Anthropic models can be called using either the OpenAI-compatible API (chat completions format) or the native Anthropic API (messages format). Both are supported.

Managed keys setup

No Anthropic account needed. Follow the quickstart to create your gateway and API key, then point your SDK at the gateway:
from openai import OpenAI

client = OpenAI(
    base_url="https://your-ai-gateway.ngrok.app/v1",
    api_key="ng-xxxxx-g1-xxxxx"  # Your AI Gateway API Key
)

response = client.chat.completions.create(
    model="claude-opus-4-6",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)

Attach your own key

Attach your Anthropic key to your AI Gateway API Key. ngrok encrypts and stores it server-side, so clients only ever send your AI Gateway API Key.
1

Get an Anthropic API key

Create an account at console.anthropic.com and generate an API key. Keys start with sk-ant-.
2

Attach the key

ngrok api ai-gateway-provider-keys create \
  --ai-gateway-api-key-id aigk_xxxxx \
  --provider-id anthropic \
  --description "My Anthropic Key" \
  --value sk-ant-...
3

Make a request

Use your AI Gateway API Key—the gateway resolves the Anthropic key server-side.
from openai import OpenAI

client = OpenAI(
    base_url="https://your-ai-gateway.ngrok.app/v1",
    api_key="ng-xxxxx-g1-xxxxx"  # Your AI Gateway API Key
)

response = client.chat.completions.create(
    model="claude-opus-4-6",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)
See Attaching Provider Keys for key rotation, listing, and removing attached keys.

Explicit provider routing

Use the anthropic: prefix to force routing to Anthropic specifically:
response = client.chat.completions.create(
    model="anthropic:claude-opus-4-6",
    messages=[{"role": "user", "content": "Hello!"}]
)

Available models

See the model catalog for the full list of supported Claude models.

Next steps