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

# Anthropic-compatible API

> Use Anthropic clients or direct HTTP requests with Tokenless routing modes.

Use the Anthropic-compatible base URL with a Tokenless API key:

```text theme={"dark"}
https://api.usetokenless.com/anthropic
```

<Note>
  Tokenless supports Anthropic's Messages and Models routes, preserving the
  compatible request and response formats while routing behind profiles such as
  `tokenless-pro`.
</Note>

## Use an Anthropic client

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

  client = Anthropic(
      base_url="https://api.usetokenless.com/anthropic",
      api_key=os.environ["TOKENLESS_API_KEY"],
  )

  message = client.messages.create(
      model="tokenless-pro",
      max_tokens=1024,
      messages=[{"role": "user", "content": "Hello"}],
  )

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

  ```ts Node.js theme={"dark"}
  import Anthropic from "@anthropic-ai/sdk";

  const client = new Anthropic({
    baseURL: "https://api.usetokenless.com/anthropic",
    apiKey: process.env.TOKENLESS_API_KEY,
  });

  const message = await client.messages.create({
    model: "tokenless-pro",
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello" }],
  });

  console.log(message.content[0]);
  ```

  ```sh cURL theme={"dark"}
  curl https://api.usetokenless.com/anthropic/v1/messages \
    -H "x-api-key: $TOKENLESS_API_KEY" \
    -H "anthropic-version: 2023-06-01" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "tokenless-pro",
      "max_tokens": 1024,
      "messages": [{"role": "user", "content": "Hello"}]
    }'
  ```
</CodeGroup>

## Use Claude Code with tkl

With the Tokenless CLI installed, sign in once and launch Claude Code through the
Anthropic-compatible route. No API key setup is required.

```sh theme={"dark"}
tkl login
tkl claude
```

For the full upstream specification, see the [Claude Messages API
reference](https://platform.claude.com/docs/en/api/messages). Use these pages
for the Tokenless-compatible routes and routing behavior.
