Messages (Anthropic-compatible)

POST /v1/messages — an experimental Anthropic Messages facade over chat completions.
POST /v1/messages accepts a subset of the Anthropic Messages API and translates it into a chat completion. It returns an Anthropic message object, or Anthropic SSE events when streaming. Routing, quota, sticky conversations, and settlement are the same as for /v1/chat/completions.
Experimental. The facade covers the wire subset listed below. It is not certified as fully compatible with Claude Code, the Claude Agent SDK, or the Anthropic SDKs. Test your client before relying on it. Models on Malibu are open-weight MLX models, not Claude.

Endpoint

X-Api-Key is accepted as an alternative to Authorization. Send one or the other. Two different credentials in one request return 400 ambiguous_credentials.

Example

The Anthropic SDK appends /v1/messages itself, so set base_url to https://api.malibu.tech without /v1. Response (live, 23 Sep 2026):

Supported request fields

  • model (same IDs as /v1/models) and max_tokens (same 4,096 cap)
  • system, as a string or text-only content blocks
  • messages[] with user and assistant text blocks, assistant tool_use, and user tool_result
  • tools[] with input_schema, and tool_choice. Only auto takes effect: any and tool are accepted but treated as auto (not forced), and none returns 400 unsupported_tool_choice
  • stream, which emits message_start, content_block_start / _delta / _stop, message_delta, and message_stop. Tool arguments stream as input_json_delta.
  • stop_sequences, temperature, top_p

Rejected

These are rejected before any quota is reserved, with an Anthropic-shaped error that carries code and retryable:
  • image, document, or file content blocks, and unknown block types
  • server tools
  • Anthropic-Beta headers or beta body fields
  • thinking and top_k

Errors

Errors use Anthropic’s envelope, extended with Malibu’s code and retryable fields:
Streaming errors arrive as an SSE event: error frame with the same object. The status codes and code values match Chat completions → Errors.