Messages
POST /<lane>/v1/messages — the Anthropic Messages wire protocol. Used by Claude
Code (CLI + Desktop), the Anthropic SDK, and OpenCode’s Anthropic adapter.
Request
Section titled “Request”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." }] }'Response
Section titled “Response”{ "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 }}Token counting
Section titled “Token counting”Claude Code’s /context command and the Anthropic SDK use
POST /<lane>/v1/messages/count_tokens:
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 }Tolerant headers
Section titled “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
Section titled “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.
OpenGateway Guide
Ask about configuring OpenGateway — lanes, base URLs, client setup, model choice, or an error you hit. Answers are grounded in the docs.