# Messages (Anthropic)

`POST /v1/messages` is the Anthropic Messages API, for Claude Code, the Anthropic
SDK and most agent frameworks.

```bash
curl "$APIX_BASE/v1/messages" \
  -H "x-api-key: $APIX_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "4/glm-5.3-flash",
    "max_tokens": 256,
    "system": "Answer in one sentence.",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

Supported: `system`, content blocks (`text`, `image`, `tool_use`, `tool_result`,
`thinking`), `tools` with the Anthropic schema, `tool_choice`, `stop_sequences`,
`temperature`, `top_p`, `top_k` (when the model supports it), and streaming with `message_start`,
`content_block_start/delta/stop`, `message_delta` and `message_stop`.

### Count tokens

`POST /v1/messages/count_tokens` with the same body returns
`{"input_tokens": N}`.

```python
from anthropic import Anthropic

client = Anthropic(api_key="apix-...", base_url="https://your-host")
message = client.messages.create(
    model="4/glm-5.3-flash",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello"}],
)
```
