Skip to main content
POST
Messages (Claude)
This endpoint speaks the Anthropic Messages API format: request body, response body, streaming events and error shapes are the same as Anthropic’s. Point the official Anthropic SDK (or Claude Code) at our base URL and use your ModelHunter.AI API key.

Models

claude-haiku-5-5: prompts above 100K input tokens are billed at 5× these rates (official tiered pricing). Prompt-cache writes are billed at the official cache-write rate.

Authentication

Send your API key as x-api-key: YOUR_API_KEY (what the Anthropic SDKs send) or Authorization: Bearer YOUR_API_KEY.

Body Parameters

The body follows the Anthropic Messages API. The most common fields:
string
required
One of the models above.
object[]
required
Conversation turns: [{ "role": "user" | "assistant", "content": string | content blocks }]. Content blocks may include images and tool results.
integer
required
Maximum output tokens, including extended thinking.
string | object[]
System prompt.
boolean
default:false
Stream the response as Anthropic server-sent events (message_start, content_block_delta, message_delta, message_stop).
number
Sampling temperature.
object[]
Tool definitions, in Anthropic format.
Other Anthropic fields (stop_sequences, top_p, top_k, tool_choice, thinking, metadata) are passed through unchanged. Optional headers anthropic-version and anthropic-beta are forwarded.

Long requests and streaming

Use "stream": true for reasoning models and long outputs. Tokens arrive as they are generated, so long answers never sit idle on the connection. While a stream is waiting for the model (for example while it is thinking), we send : keepalive SSE comments every 15 seconds; SSE clients and the official SDKs ignore them.Non-streaming requests that take longer than 15 seconds are also kept alive: the response starts with 200 OK and leading whitespace (ignored by JSON parsers) until the result is ready. If such a request fails after that point, the error is returned in the response body with status 200 instead of an error status, so check the body for an error field.

Billing

Each call is billed per token at the official price. When the request starts, the maximum possible cost (estimated input + max_tokens of output) is held from your balance; when it finishes you are charged for the tokens actually used and the rest is released. Failed requests are not charged. Calls appear in your usage history as chat tasks (prompts and responses are not stored).