Create message
Anthropic Messages API: for Claude models only; the Base URL has no /v1, and the Anthropic SDK and Claude Code work directly.
/v1/messagesClaude models use the Anthropic protocol. Set the SDK Base URL to https://api.hop-base.com (without /v1); the request path is still /v1/messages. POST /v1/messages/count_tokens is also supported.
The table lists only the parts the gateway fills in or handles specially; other Messages API fields are forwarded as-is, with ranges per Anthropic's official spec. A Claude key calling an OpenAI protocol path returns 404 "The current platform does not support this API path".
Headers
Bearer sk-…; or send x-api-key: sk-… instead — either works
Added automatically by the SDK and forwarded as-is, e.g. 2023-06-01
Beta feature flags, forwarded as-is
Body parametersJSON
A Claude model ID in the current key's group; if the group does not include the model, returns 404 model_not_found
No gateway cap; the maximum follows the model's official spec. The official API requires it; HopBase fills in 4096 when it is missing, so long outputs are cut off at 4096 (stop_reason: "max_tokens"). Set it explicitly
Default4096
In Anthropic's official format, forwarded as-is
Items≥ 1
user or assistant
A string, or an array of content blocks (text, image, tool_use, tool_result, etc.)
System prompt, forwarded as-is
true returns an Anthropic SSE event stream
Defaultfalse
Anthropic tool definitions (name, description, input_schema), forwarded as-is
Extended thinking config, forwarded as-is; values per Anthropic's official spec
Forwarded as-is; range per Anthropic's official spec
Returns
200Success. Non-streaming returns message JSON; with stream: true it returns Anthropic SSE
Message ID
Model ID
Content blocks
text / thinking / tool_use
Text of a text block
tool_use: tool name
tool_use: tool input
end_turn / max_tokens / tool_use / stop_sequence
Token usage
Input tokens
Output tokens
Input tokens written to the cache
Input tokens read from the cache
Errors
{"type":"error","error":{"type":"invalid_request_error","message":"…"}}, with no code. Key-validation errors (401, 402, 403) still use the OpenAI shapemissing_api_key / invalid_api_key / api_key_expired)insufficient_quota)model_not_found), or the path does not belong to the group (route_not_found)request_too_large)user_concurrency_limit / apikey_concurrency_limit), with Retry-After