Messages
The Anthropic Messages wire protocol on /oss. Used by Claude
Code (CLI + Desktop) and the Anthropic SDK.
posthttps://api.opengateway.one/oss/v1/messages
Request
curl
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-sonnet-4-7", "max_tokens": 512, "messages": [{ "role": "user", "content": "Review this migration plan." }] }'
Response
json
{
"id": "msg_...",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-7",
"content": [{ "type": "text", "text": "The plan looks solid, but..." }],
"stop_reason": "end_turn",
"usage": { "input_tokens": 18, "output_tokens": 96 }
}
Token counting
Claude Code's /context command and the Anthropic SDK use the count-tokens route:
post/oss/v1/messages/count_tokens
curl
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-sonnet-4-7", "messages": [{ "role": "user", "content": "How many tokens is this?" }] }'
Tolerant headers
- Any
anthropic-versionis accepted — never a400. - Unknown/retired
anthropic-betavalues (e.g.context-1m-2025-08-07) are accepted and ignored. See 1M context. - Auth via
x-api-keyorAuthorization: Bearer.
Thinking / effort
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.