Chat
One completion.
One completion.
OpenAI-compatible request and response. Non-streaming on purpose — streaming is a different transport (SSE) that the generated clients return as an opaque body, so demonstrating it here would teach the wrong shape. Print choices[0].message.content.
Create chat completion
POST /v1/chat/completions · reference →
OpenAI-compatible chat completions. Set stream: true for an SSE token
stream (text/event-stream), otherwise a single JSON response. model
accepts any model id from GET /v1/models (including the Zen ladder).
| Parameter | In | Required | Description |
|---|---|---|---|
model | body | yes | |
messages | body | yes | |
stream | body | — | |
temperature | body | — | |
top_p | body | — | |
max_tokens | body | — | |
tools | body | — | |
tool_choice | body | — |
hanzo chat completions \
--messages '[{"role":"system"}]' \
--model <model>import { Configuration, OpenAICompatibleApi } from 'hanzoai';
const api = new OpenAICompatibleApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.aiCreateChatCompletion({ model: "<model>", messages: [{"role":"system"}] });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import OpenAICompatibleApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = OpenAICompatibleApi(client).ai_create_chat_completion(model="<model>", messages=[{"role":"system"}])cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.OpenAICompatibleAPI.AiCreateChatCompletion(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, open_ai_compatible_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = open_ai_compatible_api::ai_create_chat_completion(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.OpenAICompatibleApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new OpenAICompatibleApi(client).aiCreateChatCompletion();curl -X POST https://api.hanzo.ai/v1/chat/completions \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"messages": [
{
"role": "system"
}
]
}'The MCP door does not expose this operation as a tool. It answers tools/list at https://api.hanzo.ai/v1/mcp with the ones it does.
Every command, call and tool above is generated from the same OpenAPI document that generates the SDKs themselves — the four surfaces are projections of one doc comment, so they cannot disagree.
How is this guide?