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

# Anthropic Messages

> Call Claude models with the Anthropic Messages protocol: chat, streaming, image input, tool use, adaptive thinking and prompt caching.

Messages is Claude's native interface and exposes everything Claude can do: adaptive thinking, tool use, image and PDF understanding, prompt caching. The Anthropic SDKs, Claude Code and other tools that accept a custom Anthropic base URL connect by changing the base URL and the API Key.

## Models

The current Claude generation takes text and image input, returns text, and uses adaptive thinking by default: the model decides how much to think, and `output_config.effort` steers it.

| Model ID | Introduction | Context window | Max output |
| - | - | - | - |
| `claude-fable-5-2` | For demanding reasoning and long-horizon agentic work: hours-long agent sessions, multistep deep research, and analysis carried through to a finished document, spreadsheet or deck. Thinking is always on; forced tool use and sampling parameters are rejected. | 1,000,000 | 128,000 |
| `claude-opus-5-5` | For long-running agentic coding and knowledge work: multihour autonomous coding, large-scale refactoring, complex systems engineering, vision-heavy workflows and computer use. Anthropic's default recommendation for most workloads. | 1,000,000 | 128,000 |
| `claude-sonnet-5-5` | The best combination of speed and intelligence for everyday coding, agent and enterprise workloads: code generation, data analysis, content creation, visual understanding and tool use. | 1,000,000 | 128,000 |
| `claude-haiku-5-5` | For high-volume, latency-sensitive tasks such as classification, extraction and routing, and for subagent work. The fastest model of the current generation. | 1,000,000 | 128,000 |

Context window and max output are in tokens, as published by each model's vendor.

The full list with prices is in the [model catalog](https://www.dreamto.ai/models); `GET /v1/models` lists the models your API Key can use.

## Endpoints

| Endpoint | Purpose |
| - | - |
| [`POST /v1/messages`](https://docs.dreamto.ai/en/api-reference/anthropic-messages/create-message) | Create a message |

The base URL is `https://api.dreamto.ai`. Create an API Key in the [DreamTo console](https://www.dreamto.ai); see [Authentication](https://docs.dreamto.ai/en/authentication.md).

## Quick start

```bash cURL theme={null}
curl "https://api.dreamto.ai/v1/messages" \
  -H "x-api-key: $DREAMTO_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Explain quantum computing in three sentences."}]
  }'
```

```python Python theme={null}
import os

from anthropic import Anthropic

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

message = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain quantum computing in three sentences."}],
)
print(message.content[0].text)
```

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

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

const message = await client.messages.create({
  model: "claude-sonnet-5-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Explain quantum computing in three sentences." }],
});
console.log(message.content[0].text);
```

## Streaming

Add `"stream": true` and the reply arrives as server-sent events: `message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta`, `message_stop`. Text is in `delta.text` of `content_block_delta`; usage is in `message_start` and `message_delta`.

```python Python theme={null}
with client.messages.stream(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Write a four-line poem about autumn."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="")
```

## Use with Claude Code

Set two environment variables, then start Claude Code:

```bash theme={null}
export ANTHROPIC_BASE_URL="https://api.dreamto.ai"
export ANTHROPIC_AUTH_TOKEN="$DREAMTO_API_KEY"
claude
```

## Notes

* The API Key goes in the `x-api-key` header, or in `Authorization: Bearer`.
* `anthropic-version` is optional and defaults to `2023-06-01`; the `anthropic-beta` header is passed on to the model unchanged.
* `POST /v1/messages` is available; token counting (`count_tokens`), Message Batches and the Files API are not.
* Errors use one common structure, see [Errors](https://docs.dreamto.ai/en/errors.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.