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

# Anthropic SDK

> Use FreeModel with the Anthropic SDK compatibility endpoint.

<Warning>
  This SDK uses the compatibility endpoint. For new applications, prefer the OpenAI SDKs and the [OpenAI-compatible API](/api-reference/chat-completions).
</Warning>

Install the Anthropic SDK.

```bash theme={null}
pip install anthropic
```

Set `base_url` to `https://api.freemodel.app`. The SDK adds the `/v1/messages` path.

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

client = Anthropic(
    api_key="sk-xxxx",
    base_url="https://api.freemodel.app",
)

message = client.messages.create(
    model="<claude-model-id>",
    max_tokens=128,
    messages=[
        {"role": "user", "content": "Give me one API reliability tip."}
    ],
)

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

Replace `<claude-model-id>` with an available model ID from [`GET /v1/models`](/api-reference/list-models). FreeModel accepts the SDK's `x-api-key` authentication with a FreeModel `sk-...` key.

See [Claude messages](/api-reference/claude-messages) for the request format.
