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

# Migrating from Anthropic

> Keep the official anthropic package and change two lines — the base URL (host root, no /v1) and the API key.

Same story as [OpenAI](/migrate/from-openai): keep the official
`anthropic` package and change **two lines in client
construction**. System prompts, tool use, streaming events, and
`cache_control` blocks all pass through the gateway verbatim.

<Note>
  **Base URL — host root, no `/v1`.** The Anthropic SDK appends
  `/v1/messages` itself, so the base URL is
  `https://api.aireserve.com` — unlike OpenAI-flavored clients,
  which need the `/v1` suffix.
</Note>

| Anthropic concept                        | AI Reserve equivalent                                                                                              |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| API key from `console.anthropic.com`     | API key from your AI Reserve workspace (`aireserve_api_…`) — see [Authentication](/getting-started/get-an-api-key) |
| `ANTHROPIC_API_KEY` environment variable | `AUDACITY_API_KEY`, or pass the key to the constructor                                                             |
| `https://api.anthropic.com`              | `https://api.aireserve.com` (host root — no `/v1`)                                                                 |
| Claude models only                       | Every [gateway model](/models) answers `/v1/messages` — GPT, Gemini, Grok, … via the same `messages.create` call   |
| `count_tokens`                           | Identical — `POST /v1/messages/count_tokens`, free, no inference                                                   |

<CodeGroup>
  ```diff Python theme={"dark"}
   import os
   from anthropic import Anthropic

   client = Anthropic(
  -    api_key=os.environ["ANTHROPIC_API_KEY"],
  +    base_url="https://api.aireserve.com",  # host root — NO /v1
  +    api_key=os.environ["AUDACITY_API_KEY"],
   )

   # Everything below is unchanged:
   res = client.messages.create(
       model="claude-sonnet-4-6",
       max_tokens=256,
       messages=[{"role": "user", "content": "hello"}],
   )

   # Streaming still yields message_start … message_stop events:
   with client.messages.stream(model=…, max_tokens=…, messages=…) as stream:
       for text in stream.text_stream:
           print(text, end="")
  ```

  ```diff TypeScript theme={"dark"}
   import Anthropic from "@anthropic-ai/sdk";

   const client = new Anthropic({
  -  apiKey: process.env.ANTHROPIC_API_KEY,
  +  baseURL: "https://api.aireserve.com", // host root — NO /v1
  +  apiKey: process.env.AUDACITY_API_KEY,
   });

   // Everything below is unchanged:
   const res = await client.messages.create({
     model: "claude-sonnet-4-6",
     max_tokens: 256,
     messages: [{ role: "user", content: "hello" }],
   });
  ```
</CodeGroup>

The [AI Reserve SDKs speak the Anthropic format natively](/api-reference/sdk-wire-formats) too
(v0.5.0 in all five languages) — same `messages.create` /
`count_tokens` convention, one dependency for every wire format:

```python theme={"dark"}
from audacity import Audacity

client = Audacity()   # reads AUDACITY_API_KEY

response = client.messages.create(   # same calling convention
    model="claude-sonnet-4-6",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello!"}],
)
```

**Claude Code and the Claude Agent SDK** migrate without touching this
section at all — they are configured entirely through
`ANTHROPIC_BASE_URL` / `ANTHROPIC_AUTH_TOKEN` environment
variables. See the [Claude Code recipe](/connect/claude-code).

<Note>
  **What carries over verbatim.** System prompts, tool use
  (`tool_use` / `tool_result` blocks), streaming events
  (`message_start` … `message_stop`), and
  [prompt caching](/capabilities/prompt-caching) — `cache_control` markers are
  forwarded to Anthropic unchanged, with the same minimums and 5-minute lifetime. What
  changes: the key and its environment variable, the base URL, and the model namespace —
  `/v1/messages` answers for every gateway model, not just Claude.
</Note>
