API/messages
The Messages protocol, for conversations, tool calls and SSE streaming. Claude Code calls this endpoint when ANTHROPIC_BASE_URL points at Framewharf.
https://api.framewharf.com/v1/messagesAuthorization: Bearer sk-your_api_keyAuthenticate with Authorization: Bearer or x-api-key. Send the header anthropic-version, for example 2023-06-01. Required: max_tokens.
curl "https://api.framewharf.com/v1/messages" \
-H "Authorization: Bearer sk-your_api_key" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen4-max",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Check the connection to Framewharf."}]
}'With stream: true, the response streams as events such as message_start, content_block_delta and message_stop.
curl --no-buffer "https://api.framewharf.com/v1/messages" \
-H "Authorization: Bearer sk-your_api_key" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen4-max",
"max_tokens": 1024,
"stream": true,
"messages": [{"role": "user", "content": "Write a short greeting."}]
}'Messages puts the system prompt in a separate system field, outside the messages.
{
"model": "qwen4-max",
"max_tokens": 1024,
"system": "You are a technical assistant. Keep answers short.",
"messages": [{ "role": "user", "content": "Explain SSE in one sentence." }]
}Use POST /v1/messages/count_tokens to count input tokens without running the model and without spending credit.