Chat

One completion.

One completion.

POST /v1/chat/completions, the gateway's own inference route. The id lost its v1 when the default version left the operationId; the address did not move.

The document states that address and NOT its shape — no requestBody and no responses — so a generated method takes no prompt and hands back an opaque body. No language can ship this as an example that runs, and python, typescript and go each ship five. The flow keeps its place here because the operation is served: the day cloud's handler declares its In and Out types, the sixth example returns everywhere at once with nothing left to decide.

Non-streaming when it does. 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.

Implements the OpenAI-compatible chat completions API

POST /v1/chat/completions · reference →

Implements the OpenAI-compatible chat completions API

Reasoning effort is reasoning_effort (Responses: reasoning.effort). Send auto, or nothing, and enso-auto's router decides: it starts at Enso Flash and moves to a deeper tier only when the router or Kai judges the request needs it. The ladder: instant (no reasoning; none and minimal read instant) serves enso-flash with thinking off, low enso-flash, medium enso-pro, high enso-max, max enso-ultra (xhigh reads max). On a tier named outright the effort sets only how hard it thinks, and instant turns thinking off. Fast mode is fast: true (or X-Fast: 1): billed from prepaid balance on every plan at 2x the price on enso-auto and enso-flash, 3x on enso-pro and enso-max, 4x on enso-ultra, it asks prepaid rungs first, and a payer with no money of its own is refused prepaid_required.

ParameterInRequiredDescription
X-Fastheader—Fast mode, as the body's fast: "1" or "true".
X-Max-Costheader—The most this request may cost, in USD per 1,000 tokens. Routing picks only models under it; an org's own ceil
X-Max-Latency-Msheader—The slowest model this request accepts, in milliseconds.
frequency_penaltybody—
function_callbody—
functionsbody—
logit_biasbody—
logprobsbody—
max_completion_tokensbody—
max_tokensbody—
messagesbody—
metadatabody—
modelbody—
nbody—
parallel_tool_callsbody—
hanzo chat completions
import { Configuration, AiApi } from 'hanzoai';

const api = new AiApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postChatCompletions({ frequency_penalty: 0, function_call: "<function_call>" });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AiApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AiApi(client).post_chat_completions(frequency_penalty=0, function_call="<function_call>")
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AiAPI.PostChatCompletions(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, ai_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = ai_api::post_chat_completions(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AiApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AiApi(client).postChatCompletions();
curl -X POST https://api.hanzo.ai/v1/chat/completions \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "frequency_penalty": 0,
       "function_call": "<function_call>"
     }'

MCP declares no tool for ai — tools/list on https://api.hanzo.ai/v1/mcp names the products it does reach. Use HTTP or an SDK.


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.

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.
Last updated Nov 21, 2026