GoRouter
Справочник APIТекст

Создать message (Anthropic Messages API)

POST
/messages

Anthropic Messages-совместимый запрос для Anthropic SDK, Claude Code и других клиентов Anthropic API. Ключ передаётся в x-api-key или Authorization: Bearer. Поле model — ID модели из каталога GoRouter, а не имя модели Anthropic. Поддерживаются system, text/image/document-блоки, tool_use и tool_result, thinking (с подписями) и cache_control. Инструмент web_search_20250305 выполняется встроенным веб-поиском GoRouter. Дополнительно принимаются provider, models, plugins и transforms. Запрос тарифицируется как Chat Completions; usage.cost указан в RUB, id ответа можно передать в /generation.

AuthorizationBearer <ключ>

Inference key для запросов к моделям, management key для Management API.

In: header

Тело запроса

application/json

Типы TypeScript

Use the request body type in TypeScript.

Ответ

application/json

application/json

curl -X POST "https://example.com/messages" \  -H "Content-Type: application/json" \  -d '{    "model": "anthropic/claude-sonnet-4.5",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "Объясни HTTP streaming одним предложением."      }    ]  }'
{}