Messages
The Anthropic Messages format, for Claude Code and Anthropic SDKs.
Create a message
POST
/api/v1/messagesPer token · credits onlyThe Anthropic Messages format on the same menu as Chat Completions. Claude Code and the Anthropic SDKs work once their base URL is https://mystudios.fun/api. Requests and responses pass through unchanged.
Request body
modelstringrequiredA model id from the menu. Dated ids like claude-sonnet-5-20250929resolve to the menu model. Haiku ids get the lowest-priced Claude. Smart Router isn't available here.max_tokensintegerrequiredThe most tokens the reply can use, up to 32,768.messagesobject[]requiredThe conversation, oldest first. Each message has a role and content.user · assistantsystemstring | object[]The system prompt.streambooleanStream Anthropic's server-sent events.toolsobject[]Tools the model can call, in Anthropic's format.Other Anthropic parameters pass through to the model.
Example request
import Anthropic from "@anthropic-ai/sdk";const client = new Anthropic({ apiKey: process.env.CLAWHUNTER_API_KEY, baseURL: "https://mystudios.fun/api",});const message = await client.messages.create({ model: "claude-sonnet-5-5", max_tokens: 1024, messages: [{ role: "user", content: "Why is the sky blue?" }],});
Response
An Anthropic message, exactly as the model returned it. The charge shows in your account's usage.
Response
{ "id": "msg_…", "type": "message", "role": "assistant", "model": "claude-sonnet-5-5", "content": [ { "type": "text", "text": "Sunlight scatters off molecules in the air…" } ], "stop_reason": "end_turn", "usage": { "input_tokens": 14, "output_tokens": 180 }}
Billing and limits
- Prepaid credits only. This endpoint doesn't take x402.
- Send your key as x-api-key or as a Bearer token.
- Billed per token at the same rates as Chat Completions, listed on Models.
- The call reserves your input plus max_tokens, then settles for what you used. Your balance has to cover the reserve.
- max_tokens is required and caps at 32,768.
- Input caps at 800,000 characters across messages, system, and tools. A larger request returns 413.
- Eligible models draw on your daily free allowance first.
- Errors come back in Anthropic's error format.
- A rejected or failed request is not charged.