# Anthropic SDK (/docs/guides/anthropic-sdk)

Use the official Anthropic Python and TypeScript SDKs with cheapaimodel.



<Callout type="warn">
  **Not available yet.** No model in the [catalog](/models) currently lists the Anthropic Messages endpoint (`/v1/messages`). Use the [OpenAI SDK](/docs/guides/openai-sdk) for now. This guide applies once a model's catalog page lists `/v1/messages`.
</Callout>

The Anthropic SDKs call `/v1/messages`. Set the base URL **without** `/v1`; the SDK adds the path itself.

<Tabs items="[&#x22;Python&#x22;, &#x22;TypeScript&#x22;]">
  <Tab value="Python">
    ```bash title="Terminal"
    pip install anthropic
    ```

    ```python
    import os
    from anthropic import Anthropic

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

    message = client.messages.create(
        model="<model-id>",
        max_tokens=1024,
        messages=[{"role": "user", "content": "Explain recursion in one sentence."}],
    )
    print(message.content[0].text)
    ```
  </Tab>

  <Tab value="TypeScript">
    ```bash title="Terminal"
    npm install @anthropic-ai/sdk
    ```

    ```ts
    import Anthropic from "@anthropic-ai/sdk";

    const client = new Anthropic({
      baseURL: "https://api.cheapaimodel.ai",
      apiKey: process.env.CHEAPAIMODEL_API_KEY,
    });

    const message = await client.messages.create({
      model: "<model-id>",
      max_tokens: 1024,
      messages: [{ role: "user", content: "Explain recursion in one sentence." }],
    });
    console.log(message.content);
    ```
  </Tab>
</Tabs>

## Environment variables [#environment-variables]

```bash title="Terminal"
export ANTHROPIC_BASE_URL="https://api.cheapaimodel.ai"
export ANTHROPIC_API_KEY="$CHEAPAIMODEL_API_KEY"
```

Replace `<model-id>` with a model from the [catalog](/models) that lists `/v1/messages`.
