> ## Documentation Index
> Fetch the complete documentation index at: https://docs.verlon.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Anthropic

> Every Claude model Verlon supports — plus quickstart and SDK compatibility (use the Anthropic SDK unchanged against Verlon).

Every Claude model — Opus, Sonnet, and Haiku across the 3.5, 4, 4.5, 4.6, 4.7, and 4.8 generations — is routable through Verlon with your existing Anthropic SDK unchanged. Just point `baseURL` at Verlon and swap the API key.

## Chat models

| Model ID | Type | Context |
| - | - | - |
| `claude-fable-5` | chat | 1000K |
| `claude-fable-5-1` | chat | 1000K |
| `claude-haiku-4-5-20251001` | chat | 200K |
| `claude-haiku-5-5` | chat | 200K |
| `claude-opus-4-5` | chat | 200K |
| `claude-opus-4-5-20251101` | chat | 200K |
| `claude-opus-4-6` | chat | 1000K |
| `claude-opus-4-7` | chat | 1000K |
| `claude-opus-4-8` | chat | 1000K |
| `claude-opus-5` | chat | 1000K |
| `claude-opus-5-5` | chat | 1000K |
| `claude-sonnet-4-5-20250929` | chat | 200K |
| `claude-sonnet-4-6` | chat | 1000K |
| `claude-sonnet-5` | chat | 1000K |
| `claude-sonnet-5-5` | chat | 1000K |

> [!NOTE]
>
> This table is auto-generated from the Verlon model registry on every sync —
> see the [live registry](https://docs.verlon.ai/provider-compatibility/models.md#live-registry) for
> pricing, benchmarks, and deprecation dates.

## Other modalities

*No non-chat models.*

## Quickstart

> [!NOTE]
>
> First time? [Create a gate](https://docs.verlon.ai/platform/gates.md) and grab an [API
> key](https://docs.verlon.ai/getting-started/authentication.md) — the examples below need a `GATE_ID`
> and `VERLON_API_KEY`.

The fastest path — the official Anthropic SDK, pointed at Verlon:

```typescript theme={null}
import Anthropic from '@anthropic-ai/sdk';

const anthropic = new Anthropic({
  baseURL: 'https://api.verlon.ai',
  apiKey: process.env.VERLON_API_KEY,
});

// @ts-ignore - gateId is a Verlon AI extension
const response = await anthropic.messages.create({
  gateId: process.env.GATE_ID,
  model: 'claude-sonnet-4-6', // optional — overrides the gate's configured model
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(response.content[0].text);
```

Any chat model from the table above works — swap `claude-sonnet-4-6` for `claude-opus-4-8`, `claude-haiku-4-5-20251001`, or any other ID.

## SDK compatibility

Verlon exposes an Anthropic-compatible endpoint. The official Anthropic SDK works unchanged — swap two lines and every model in the table above becomes callable through the SDK you already know.

### Configuration — just two lines

```typescript Before theme={null}
import Anthropic from '@anthropic-ai/sdk';

const anthropic = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});

```

```typescript After (Verlon) theme={null}
import Anthropic from '@anthropic-ai/sdk';

const anthropic = new Anthropic({
  baseURL: 'https://api.verlon.ai', // ← add this
  apiKey: process.env.VERLON_API_KEY, // ← change this
});
```

### Specifying your gate

Verlon supports three ways to point a request at a gate:

> [tab] Using gateId (Recommended)
>
> ```typescript theme={null}
> // @ts-ignore - gateId is a Verlon AI extension
> const response = await anthropic.messages.create({
>   gateId: process.env.GATE_ID,
>   max_tokens: 1024,
>   messages: [{ role: 'user', content: 'Hello!' }],
> });
> ```
>
> > [!NOTE]
> >
> > Requires `@ts-ignore` in TypeScript, but the clearest intent.

> [tab] Using model field
>
> ```typescript theme={null}
> const response = await anthropic.messages.create({
>   model: process.env.GATE_ID, // gate UUID in the model slot
>   max_tokens: 1024,
>   messages: [{ role: 'user', content: 'Hello!' }],
> });
> ```
>
> > [!TIP]
> >
> > No TypeScript errors, drop-in with existing code.

> [tab] Using a default header
>
> ```typescript theme={null}
> const anthropic = new Anthropic({
>   baseURL: 'https://api.verlon.ai',
>   apiKey: process.env.VERLON_API_KEY,
>   defaultHeaders: { 'X-Verlon-Gate-Id': process.env.GATE_ID },
> });
>
> const response = await anthropic.messages.create({
>   max_tokens: 1024,
>   messages: [{ role: 'user', content: 'Hello!' }],
> });
> ```
>
> > [!TIP]
> >
> > Cleanest for TypeScript — set once, use everywhere.

### Streaming

Identical behavior to the Anthropic SDK — `stream: true` returns an async iterable of `MessageStreamEvent` objects.

```typescript theme={null}
const stream = await anthropic.messages.create({
  gateId: process.env.GATE_ID,
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Tell me a joke.' }],
  stream: true,
});

for await (const event of stream) {
  if (
    event.type === 'content_block_delta' &&
    event.delta.type === 'text_delta'
  ) {
    process.stdout.write(event.delta.text);
  }
}
```

### Language coverage

```typescript TypeScript theme={null}
import Anthropic from '@anthropic-ai/sdk';

const anthropic = new Anthropic({
baseURL: 'https://api.verlon.ai',
apiKey: process.env.VERLON_API_KEY,
});

const response = await anthropic.messages.create({
gateId: process.env.GATE_ID,
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(response.content[0].text);

```

```python Python theme={null}
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.verlon.ai",
    api_key=os.environ["VERLON_API_KEY"],
)

response = client.messages.create(
    model=os.environ["GATE_ID"],
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)

print(response.content[0].text)
```

```bash cURL theme={null}
curl https://api.verlon.ai/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $VERLON_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "gateId": "'"$GATE_ID"'",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

### What's supported

> [accordion] Streaming
>
> Full support for `stream: true`, identical semantics to Anthropic's SDK.

> [accordion] Tool use
>
> Fully supported. Verlon translates across providers if your gate routes to a
> non-Claude model.

> [accordion] Vision
>
> Image inputs in messages work with any vision-capable model.

> [accordion] System messages + all message types
>
> System prompts, user, assistant, and tool\_result blocks all pass through.

> [accordion] Standard parameters
>
> `temperature`, `max_tokens`, `top_p`, `top_k`, `stop_sequences`, and the
> rest — all passed through.

> [accordion] Usage + cost tracking
>
> Standard `response.usage` with token counts, plus Verlon's `cost` field with
> per-call dollar amount.

## Migrating an existing Anthropic app

**1. Update client initialization**

Swap `baseURL` + `apiKey`. Two lines.

**2. Add a gate reference**

Pass `gateId` (or set the default header). `max_tokens`, `messages`, and
everything else stay the same.

**3. Test in development**

Verify requests appear in the Verlon dashboard and cost tracking works.

**4. Deploy**

Ship. If anything breaks, revert the two-line diff — takes 30 seconds.

## How it works

1. **You send** an Anthropic-format request to `https://api.verlon.ai/v1/messages`
2. **Verlon receives** — validates the gate, applies routing rules
3. **Verlon routes** to whichever model your gate points at (Claude, GPT, Gemini, Mistral, or anything else in the registry)
4. **The provider responds** in its native format
5. **Verlon normalizes** back to Anthropic format
6. **You receive** a standard Anthropic response with an added `cost` field

Your code doesn't know the difference.

## Errors

Errors come back Anthropic-shaped — `{ "type": "error", "error": { "type", "message" } }` — so the Anthropic SDK's error classes work unchanged.

| Status | Meaning | What to check |
| - | - | - |
| `400` | Invalid request | Malformed body or missing `gateId` |
| `401` | Invalid API key | Your `VERLON_API_KEY` value and the `Authorization: Bearer` header |
| `404` | Gate not found | Your `GATE_ID` — the error message names the offending ID |
| `429` | Rate limit exceeded | Back off and retry; the body includes `reset_at`, and every response carries `X-RateLimit-*` headers |

```typescript theme={null}
try {
  const response = await anthropic.messages.create({
    gateId: process.env.GATE_ID,
    max_tokens: 1024,
    messages: [{ role: 'user', content: 'Hello!' }],
  });
} catch (error) {
  if (error.status === 404) {
    console.error('Gate not found — check GATE_ID');
  } else if (error.status === 429) {
    console.error('Rate limited — retry after the reset');
  } else {
    throw error;
  }
}
```

## FAQ

> [accordion] Do I need to change my request code?
>
> No. Change `baseURL` + `apiKey` in the client. The `messages.create` calls
> stay identical.

> [accordion] Can I still call Anthropic directly?
>
> Yes. Revert `baseURL` + `apiKey` to Anthropic values and you're back on
> their API.

> [accordion] Can I route a GPT or Gemini model through the Anthropic SDK?
>
> Yes — that's the point. Configure your gate to route to any model in the
> [registry](https://docs.verlon.ai/provider-compatibility/models.md) and your Anthropic SDK code stays
> the same.

> [accordion] Do I need the Verlon SDK?
>
> No. This whole guide uses only the Anthropic SDK.

## Full non-chat model list

*This provider is chat-only — see the table above.*

## Related

* [OpenAI](https://docs.verlon.ai/provider-compatibility/openai.md) · [Google](https://docs.verlon.ai/provider-compatibility/google.md) · [Mistral](https://docs.verlon.ai/provider-compatibility/mistral.md)
* [Verlon SDK reference](https://docs.verlon.ai/sdk-reference/overview.md) — agent tracing, observability, and the model registry
* [Gates](https://docs.verlon.ai/platform/gates.md) — set up routing rules and model configuration
* [Bring your own key](https://docs.verlon.ai/platform/byok.md) — use your own Anthropic account for provider costs
* [Anthropic's official docs ↗](https://docs.anthropic.com/en/docs/build-with-claude/overview)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.