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
hanzo chat completionsimport { Configuration, AiApi } from 'hanzoai';
const api = new AiApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postChatCompletions();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()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.AiAPI.PostChatCompletions(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::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.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + 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"The door reaches ai through the ai tool, which names its 294 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_models"
}
}
}'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?