Create completions — POST /v1/chat/completions

Implements the OpenAI-compatible chat completions API

POST /v1/chat/completions

Addresshttps://api.hanzo.ai/v1/chat/completions
MethodPOST
Operationpost_chat_completions
AuthAuthorization: Bearer $HANZO_API_KEY

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.

Request

70 fields, body application/json (required).

FieldInTypeRequiredDescription
X-Fastheaderstring—Fast mode, as the body's fast: "1" or "true".
X-Max-Costheadernumber—The most this request may cost, in USD per 1,000 tokens.
X-Max-Latency-Msheaderinteger—The slowest model this request accepts, in milliseconds.
frequency_penaltybodynumber—
function_callbodyany—
functionsbodyopenai.FunctionDefinition[]—
functions[].descriptionbodystring—
functions[].namebodystring—
functions[].parametersbodyany—
functions[].strictbodyboolean—
logit_biasbodyobject—
logit_bias.*bodyinteger—
logprobsbodyboolean—
max_completion_tokensbodyinteger—
max_tokensbodyinteger—
messagesbodyopenai.ChatCompletionMessage[]—
messages[].MultiContentbodyopenai.ChatMessagePart[]—
messages[].MultiContent[].image_urlbodyopenai.ChatMessageImageURL—
messages[].MultiContent[].image_url.detailbodystring—
messages[].MultiContent[].image_url.urlbodystring—
messages[].MultiContent[].textbodystring—
messages[].MultiContent[].typebodystring—
messages[].contentbodystring—
messages[].function_callbodyopenai.FunctionCall—
messages[].function_call.argumentsbodystring—
messages[].function_call.namebodystring—
messages[].namebodystring—
messages[].reasoning_contentbodystring—
messages[].refusalbodystring—
messages[].rolebodystring—
messages[].tool_call_idbodystring—
messages[].tool_callsbodyopenai.ToolCall[]—
messages[].tool_calls[].functionbodyopenai.FunctionCall—
messages[].tool_calls[].function.argumentsbodystring—
messages[].tool_calls[].function.namebodystring—
messages[].tool_calls[].idbodystring—
messages[].tool_calls[].indexbodyinteger—
messages[].tool_calls[].typebodystring—
metadatabodyobject—
metadata.*bodystring—
modelbodystring—
nbodyinteger—
parallel_tool_callsbodyany—
presence_penaltybodynumber—
reasoning_effortbodystring—
response_formatbodyopenai.ChatCompletionResponseFormat—
response_format.json_schemabodyopenai.ChatCompletionResponseFormatJSONSchema—
response_format.json_schema.descriptionbodystring—
response_format.json_schema.namebodystring—
response_format.json_schema.schemabodyany—
response_format.json_schema.strictbodyboolean—
response_format.typebodystring—
seedbodyinteger—
stopbodystring[]—
storebodyboolean—
streambodyboolean—
stream_optionsbodyopenai.StreamOptions—
stream_options.include_usagebodyboolean—
temperaturebodynumber—
tool_choicebodyany—
toolsbodyopenai.Tool[]—
tools[].functionbodyopenai.FunctionDefinition—
tools[].function.descriptionbodystring—
tools[].function.namebodystring—
tools[].function.parametersbodyany—
tools[].function.strictbodyboolean—
tools[].typebodystring—
top_logprobsbodyinteger—
top_pbodynumber—
userbodystring—

Response

StatusBodyMeaning
200Success.
401—No credential, or one this service does not accept.
403—A valid credential that may not do this.

200 body — 103 fields.

FieldInTypeAlwaysDescription
choicesbodyopenai.ChatCompletionChoice[]—
choices[].content_filter_resultsbodyopenai.ContentFilterResults—
choices[].content_filter_results.hatebodyopenai.Hate—
choices[].content_filter_results.hate.filteredbodyboolean—
choices[].content_filter_results.hate.severitybodystring—
choices[].content_filter_results.jailbreakbodyopenai.JailBreak—
choices[].content_filter_results.jailbreak.detectedbodyboolean—
choices[].content_filter_results.jailbreak.filteredbodyboolean—
choices[].content_filter_results.profanitybodyopenai.Profanity—
choices[].content_filter_results.profanity.detectedbodyboolean—
choices[].content_filter_results.profanity.filteredbodyboolean—
choices[].content_filter_results.self_harmbodyopenai.SelfHarm—
choices[].content_filter_results.self_harm.filteredbodyboolean—
choices[].content_filter_results.self_harm.severitybodystring—
choices[].content_filter_results.sexualbodyopenai.Sexual—
choices[].content_filter_results.sexual.filteredbodyboolean—
choices[].content_filter_results.sexual.severitybodystring—
choices[].content_filter_results.violencebodyopenai.Violence—
choices[].content_filter_results.violence.filteredbodyboolean—
choices[].content_filter_results.violence.severitybodystring—
choices[].finish_reasonbodystring—
choices[].indexbodyinteger—
choices[].logprobsbodyopenai.LogProbs—
choices[].logprobs.contentbodyopenai.LogProb[]—
choices[].logprobs.content[].bytesbodystring (byte)—
choices[].logprobs.content[].logprobbodynumber—
choices[].logprobs.content[].tokenbodystring—
choices[].logprobs.content[].top_logprobsbodyopenai.TopLogProbs[]—
choices[].logprobs.content[].top_logprobs[].bytesbodystring (byte)—
choices[].logprobs.content[].top_logprobs[].logprobbodynumber—
choices[].logprobs.content[].top_logprobs[].tokenbodystring—
choices[].messagebodyopenai.ChatCompletionMessage—
choices[].message.MultiContentbodyopenai.ChatMessagePart[]—
choices[].message.MultiContent[].image_urlbodyopenai.ChatMessageImageURL—
choices[].message.MultiContent[].image_url.detailbodystring—
choices[].message.MultiContent[].image_url.urlbodystring—
choices[].message.MultiContent[].textbodystring—
choices[].message.MultiContent[].typebodystring—
choices[].message.contentbodystring—
choices[].message.function_callbodyopenai.FunctionCall—
choices[].message.function_call.argumentsbodystring—
choices[].message.function_call.namebodystring—
choices[].message.namebodystring—
choices[].message.reasoning_contentbodystring—
choices[].message.refusalbodystring—
choices[].message.rolebodystring—
choices[].message.tool_call_idbodystring—
choices[].message.tool_callsbodyopenai.ToolCall[]—
choices[].message.tool_calls[].functionbodyopenai.FunctionCall—
choices[].message.tool_calls[].function.argumentsbodystring—
choices[].message.tool_calls[].function.namebodystring—
choices[].message.tool_calls[].idbodystring—
choices[].message.tool_calls[].indexbodyinteger—
choices[].message.tool_calls[].typebodystring—
createdbodyinteger—
idbodystring—
modelbodystring—
objectbodystring—
prompt_filter_resultsbodyopenai.PromptFilterResult[]—
prompt_filter_results[].content_filter_resultsbodyopenai.ContentFilterResults—
prompt_filter_results[].content_filter_results.hatebodyopenai.Hate—
prompt_filter_results[].content_filter_results.hate.filteredbodyboolean—
prompt_filter_results[].content_filter_results.hate.severitybodystring—
prompt_filter_results[].content_filter_results.jailbreakbodyopenai.JailBreak—
prompt_filter_results[].content_filter_results.jailbreak.detectedbodyboolean—
prompt_filter_results[].content_filter_results.jailbreak.filteredbodyboolean—
prompt_filter_results[].content_filter_results.profanitybodyopenai.Profanity—
prompt_filter_results[].content_filter_results.profanity.detectedbodyboolean—
prompt_filter_results[].content_filter_results.profanity.filteredbodyboolean—
prompt_filter_results[].content_filter_results.self_harmbodyopenai.SelfHarm—
prompt_filter_results[].content_filter_results.self_harm.filteredbodyboolean—
prompt_filter_results[].content_filter_results.self_harm.severitybodystring—
prompt_filter_results[].content_filter_results.sexualbodyopenai.Sexual—
prompt_filter_results[].content_filter_results.sexual.filteredbodyboolean—
prompt_filter_results[].content_filter_results.sexual.severitybodystring—
prompt_filter_results[].content_filter_results.violencebodyopenai.Violence—
prompt_filter_results[].content_filter_results.violence.filteredbodyboolean—
prompt_filter_results[].content_filter_results.violence.severitybodystring—
prompt_filter_results[].indexbodyinteger—
system_fingerprintbodystring—
usagebodyopenai.Usage—
usage.completion_tokensbodyinteger—
usage.completion_tokens_detailsbodyopenai.CompletionTokensDetails—
usage.completion_tokens_details.audio_tokensbodyinteger—
usage.completion_tokens_details.reasoning_tokensbodyinteger—
usage.prompt_tokensbodyinteger—
usage.prompt_tokens_detailsbodyopenai.PromptTokensDetails—
usage.prompt_tokens_details.audio_tokensbodyinteger—
usage.prompt_tokens_details.cached_tokensbodyinteger—
usage.total_tokensbodyinteger—
routingbodyobject—What the router decided for this request and why, present when one routed it (a model Enso routes by reasoning depth).
routing.bybodystring—One of effort, default, router, kai. What chose the tier: the request's effort, the router's start, its table for the task, or Kai's effort decision.
routing.candidatesbodyobject[]yesEach model the router's table names, with the reasoning depths that read it, shallow to deep.
routing.candidates[].depthsbodystring[]yes
routing.candidates[].modelbodystringyes
routing.chosenbodystringyesThe model the request is served at.
routing.inputsbodyobjectyes
routing.inputs.depthbodystringyesThe reasoning depth the request states; default when it states none.
routing.inputs.keybodystringyesThe table row that depth was read at.
routing.inputs.policybodystringyesOne of funded, unfunded, n/a. Whether the caller's plan or balance pays for the tier; unfunded is served on its no-cost rungs at no charge.
routing.inputs.taskbodystring—The task the router read a request that left its effort to it as.
routing.reasonbodystringyesHow the inputs led to chosen, in a sentence.
routing.routerbodystringyesThe router that decided: enso.

Failure carries the platform error shape — see Errors.

Examples

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.


AI API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.