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

# Messages

> Anthropic-compatible messages endpoint.

Use `/v1/messages` when your client already speaks the Anthropic Messages format.

```bash theme={null}
curl https://apiany.ai/v1/messages \
  -H "Authorization: Bearer $APIANY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-m3",
    "max_tokens": 512,
    "messages": [
      { "role": "user", "content": "Draft three API docs section titles." }
    ]
  }'
```

APIAny.AI processes the request and returns an Anthropic-compatible response.

## Tool use

Declare tools with `tools` (each has `name`, `description`, `input_schema`) and
control selection with `tool_choice`. Multi-turn `tool_use` / `tool_result`
content blocks are supported.

```json theme={null}
{
  "model": "minimax-m3",
  "max_tokens": 512,
  "tools": [
    {
      "name": "get_weather",
      "description": "Get current weather",
      "input_schema": {
        "type": "object",
        "properties": { "location": { "type": "string" } },
        "required": ["location"]
      }
    }
  ],
  "tool_choice": { "type": "auto" },
  "messages": [{ "role": "user", "content": "Weather in NYC?" }]
}
```

## Streaming

Set `stream: true` to receive Anthropic server-sent events:
`message_start`, `content_block_start`, `content_block_delta`,
`content_block_stop`, `message_delta`, `message_stop`.

## Parameters

Supported: `model`, `messages`, `max_tokens` (required), `system`,
`temperature`, `top_p`, `top_k`, `stop_sequences`, `tools`, `tool_choice`,
and `stream`.
