Skip to content

Messages

POST /<lane>/v1/messages — the Anthropic Messages wire protocol. Used by Claude Code (CLI + Desktop), the Anthropic SDK, and OpenCode’s Anthropic adapter.

Terminal window
curl "https://api.opengateway.one/oss/v1/messages" \
-H "Authorization: Bearer $OPENGATEWAY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-turbo-hub-qwen3-coder",
"max_tokens": 512,
"messages": [{ "role": "user", "content": "Review this migration plan." }]
}'
{
"id": "msg_...",
"type": "message",
"role": "assistant",
"model": "claude-turbo-hub-qwen3-coder",
"content": [{ "type": "text", "text": "The plan looks solid, but..." }],
"stop_reason": "end_turn",
"usage": { "input_tokens": 18, "output_tokens": 96 }
}

Claude Code’s /context command and the Anthropic SDK use POST /<lane>/v1/messages/count_tokens:

Terminal window
curl "https://api.opengateway.one/oss/v1/messages/count_tokens" \
-H "Authorization: Bearer $OPENGATEWAY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{ "model": "claude-turbo-hub-qwen3-coder",
"messages": [{ "role": "user", "content": "How many tokens is this?" }] }'
{ "input_tokens": 9 }
  • Any anthropic-version is accepted — never a 400.
  • Unknown/retired anthropic-beta values (e.g. context-1m-2025-08-07) are accepted and ignored. See 1M context.
  • Auth via x-api-key or Authorization: Bearer.

Modern (4.6+) clients send thinking: { type: "adaptive" } plus output_config: { effort }. OpenGateway maps this to the upstream model’s effort knob — see Effort levels.