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

# Anthropic compatibility

> Use the Messages request format with your derestricted key.

Anthropic-format clients use the root base URL **`https://api.derestricted.ai`**. The SDK appends `/v1/messages`; including `/v1` twice produces an incorrect URL.

<CodeGroup>
  ```python Python theme={"system"}
  # Install: python -m pip install anthropic
  import os
  from anthropic import Anthropic

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

  message = client.messages.create(
      model="derestricted-llm",
      max_tokens=8192,
      messages=[{"role": "user", "content": "Write a short checklist for reviewing a pull request."}],
  )
  for block in message.content:
      if block.type == "text":
          print(block.text)
  ```

  ```javascript JavaScript theme={"system"}
  // Install: npm install @anthropic-ai/sdk
  import Anthropic from "@anthropic-ai/sdk";

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

  const message = await client.messages.create({
    model: "derestricted-llm",
    max_tokens: 8192,
    messages: [
      {
        role: "user",
        content: "Write a short checklist for reviewing a pull request.",
      },
    ],
  });
  for (const block of message.content) {
    if (block.type === "text") console.log(block.text);
  }
  ```
</CodeGroup>

These use the client configuration and Messages interfaces from the official [Python](https://github.com/anthropics/anthropic-sdk-python) and [JavaScript](https://github.com/anthropics/anthropic-sdk-typescript) SDKs. The model is the derestricted deployment, not a Claude model.

## Supported behavior

* `POST /v1/messages` accepts `messages`, an optional top-level `system` prompt, and client-defined tool schemas/results.
* `stream: true` returns Messages-style SSE events, including content-block events and keepalives.
* `stream: false` returns a complete message with content blocks and usage.
* `POST /v1/messages/count_tokens` returns an approximate input estimate. It is not the deployed model's tokenizer.

## Compatibility boundaries

The request fields `thinking`, `output_config`, `context_management`, `mcp_servers`, `container`, `betas`, and `service_tier` are ignored. Tool `defer_loading` is also removed. These controls do not enable Anthropic-hosted features or change the model's reasoning configuration.

Use text messages and application-executed tools. Managed MCP connections, hosted tools, computer use, media generation, files, and message batches are not provided. Sending Anthropic beta headers does not enable those features. Provider-specific prompt-cache behavior is not guaranteed.

For endpoint details, see [Messages](/api/messages) and [token estimates](/api/count-tokens). For a coding-agent setup, see [Claude Code](/integrations/claude-code).
