Skip to content
Console

API reference

Messages

POSThttps://api.monkeybird.si/v1/messages

Generates a model response in the Anthropic Messages format. Works with the official Anthropic SDKs and with Claude Code.

pip install anthropic
curl https://api.monkeybird.si/v1/messages \
  -H "x-api-key: $MONKEYBIRD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "monkeybird-glm-5.3-sem-censura",
    "max_tokens": 1024,
    "system": "Answer in English.",
    "messages": [{"role": "user", "content": "Explain what an API is in one sentence."}]
  }'

Headers

x-api-keyom_...required
API key. Authorization: Bearer also works.
Content-Typeapplication/jsonrequired
JSON body.
anthropic-versionstring
Accepted and not required.

Body

modelstringrequired
Model ID, or a claude-* name (see Accepted IDs). The response repeats the name you sent.
max_tokensintegerrequired
Output token limit, 1 or more. The answer stops there. Up to 32,768; larger values are reduced to it. The same limit is reserved from the balance before the call.
messagesarrayrequired
Turns with role user or assistant. Messages with role system are merged into system.
systemstring | array
Instructions, as text or text blocks.
temperaturenumber
Forwarded to the model.
top_pnumber
Forwarded to the model.
stop_sequencesstring[]
Up to 4 sequences; extras are ignored.
toolsarray
Custom tools (name, description, input_schema). Anthropic server tools, such as web search, are ignored.
tool_choiceobject
auto, any, tool (with name) or none.
streamboolean
Returns Anthropic server-sent events. Another type returns 400.

Other fields, such as top_k, metadata and thinking, are ignored.

Content blocks

BlockSupport
textSupported.
imageBase64 (source.type: base64) or https:// URL (source.type: url), only on models with vision.
tool_useSupported, in assistant turns.
tool_resultSupported, with text content. is_error: true is sent to the model as an error.
thinkingIgnored.
documentNot supported: 400. Send the text instead.

Response

200 OK
{
  "id": "msg_...",
  "type": "message",
  "role": "assistant",
  "model": "monkeybird-glm-5.3-sem-censura",
  "content": [{ "type": "text", "text": "..." }],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 24,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "output_tokens": 40
  }
}
stop_reasonWhen
end_turnThe model finished the answer.
max_tokensReached max_tokens.
tool_useThe model called a tool.
refusalThe answer was blocked by a content filter.

usage.input_tokens excludes cached tokens, which come in cache_read_input_tokens. cache_creation_input_tokens is always 0. The request ID comes in the request-id header.

Streaming

With "stream": true, the events follow the Anthropic order: message_start, content_block_start, content_block_delta (text_delta or input_json_delta), content_block_stop, message_delta and message_stop. A failure in the middle of the stream arrives as an error event.

Count tokens

POSThttps://api.monkeybird.si/v1/messages/count_tokens

Returns {"input_tokens": n}, an estimate of 3 characters per token over system, messages and tools. Free; requires a valid key.

cURL
curl https://api.monkeybird.si/v1/messages/count_tokens \
  -H "x-api-key: $MONKEYBIRD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "monkeybird-glm-5.3-sem-censura", "messages": [{"role": "user", "content": "ok"}]}'
To use Claude Code with MonkeyBird, see the Claude Code page.