🪷 Zen LM

Messages (Anthropic-compatible)

Use the Anthropic Messages API format with Zen models via api.hanzo.ai

Messages API (Anthropic-compatible)

Zen models are reachable through the Anthropic Messages wire format at the same base URL, alongside the chat-completions format. This is a second envelope we speak so that a client already written against that shape can call Zen models without being rewritten — point its base URL at https://api.hanzo.ai/v1 and give it a Hanzo key. Model ids do not carry across vendors: the ids below are Hanzo models and resolve only here.

Endpoint

POST https://api.hanzo.ai/v1/messages

Authentication

x-api-key: $HANZO_API_KEY
# or
Authorization: Bearer $HANZO_API_KEY

Include the anthropic-version header:

anthropic-version: 2023-06-01

Quickstart

curl

curl https://api.hanzo.ai/v1/messages \
  -H "x-api-key: $HANZO_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zen5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello, Zen."}]
  }'

Python (Anthropic SDK)

from anthropic import Anthropic

client = Anthropic(
    api_key="hk-your-api-key",
    base_url="https://api.hanzo.ai/v1",
)

message = client.messages.create(
    model="zen5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello, Zen."}],
)
print(message.content[0].text)

TypeScript (Anthropic SDK)

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: "hk-your-api-key",
  baseURL: "https://api.hanzo.ai/v1",
});

const message = await client.messages.create({
  model: "zen5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello, Zen." }],
});
console.log(message.content[0].text);

Streaming

curl https://api.hanzo.ai/v1/messages \
  -H "x-api-key: $HANZO_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zen5",
    "max_tokens": 1024,
    "stream": true,
    "messages": [{"role": "user", "content": "Hello, Zen."}]
  }'

Streaming uses Server-Sent Events (SSE), identical to the Anthropic streaming format.

Supported Parameters

ParameterTypeRequiredDescription
modelstringYesZen model ID (e.g., zen5, zen5-pro, zen5-coder)
messagesarrayYesArray of message objects with role and content
max_tokensintegerYesMaximum tokens to generate
streambooleanNoEnable SSE streaming (default: false)
temperaturefloatNoSampling temperature (0.0 - 1.0)
top_pfloatNoNucleus sampling parameter
systemstringNoSystem prompt
stop_sequencesarrayNoStop generation at these sequences

Response Format

{
  "id": "msg_abc123",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Hello! How can I help you today?"
    }
  ],
  "model": "zen5",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 12,
    "output_tokens": 15
  }
}

Using Both Formats

The same api.hanzo.ai/v1 host serves both wire formats:

Wire formatEndpointClients
Chat completionsPOST /v1/chat/completionshanzoai, @hanzo/ai, or any client written for that shape
MessagesPOST /v1/messagesanthropic
CatalogueGET /v1/modelsAny HTTP client

All Zen models work with both. Use whichever your application already speaks.

On this page