mirror of
https://github.com/hanzoai/site.git
synced 2026-11-21 01:07:08 +00:00
1 line
5.7 KiB
JSON
1 line
5.7 KiB
JSON
{"text":["Models","Kai Guide","Hanzo decision model · 0 output tokens","How to Use Kai","Send a state and typed questions to","with",". Kai answers each question with a probability for every answer it allows, and writes no text.","POST /v1/decisions","model: \"kai\"","Get an API key","Read the reference","Questions","Three question types","Name each question; its answer comes back under the same name.","choice","Send",": option → description, or a list of options.","criteria","Get","(one per option, summing to 1),","probabilities","confidence","score",": the levels, lowest first.","(the expected level index),","by level index.","legend","noul",": a yes/no question.","instructions",": P(true). kai-1.3, the default, does not read a noul’s","Call it","One request, three questions","Every response also carries id, model, usage (output_tokens is 0), routing (the checkpoint that answered: kai-1.3 for the model id kai), state_hash and latency_ms.","curl","-sS","--fail-with-body","https://api.hanzo.ai/v1/decisions","-H","Authorization: Bearer","HANZO_API_KEY","Content-Type: application/json","-d","\"model\": \"kai\",","\"state\": \"Customer email: Cancel my plan immediately. Your service was down during our product launch.\",","\"questions\": {","\"department\": {","\"type\": \"choice\",","\"instructions\": \"Route ticket to appropriate team\",","\"criteria\": {","\"executive_escalations\": \"high-value customer cancellation threats\",","\"support\": \"general technical inquiries\",","\"billing\": \"standard invoice updates\"","},","\"urgency\": {","\"type\": \"score\",","\"instructions\": \"Rate ticket urgency\",","\"criteria\": [\"low\", \"normal\", \"high\", \"critical\"]","\"churn_risk\": {","\"type\": \"noul\",","\"instructions\": \"Is this account at risk of churning?\"","# pip install hanzoai","import","os","from","hanzoai","cloud","ApiClient","Configuration","api","AiApi","models","ai_decisions_request","AiDecisionsRequest","ai = AiApi","access_token=os","environ","])))","decision = ai","post_decisions","from_dict","({","model","kai","state","ticket_id","4821","text","Can I get an extension on my payment due date?","questions","team","type","Which team handles this?","billing","invoices and payments","support","technical issues","is_churn_risk","Is the user churning?","}))","print","decision","answers","].","// npm install hanzoai","const","ai = new","new","accessToken","process.env.HANZO_API_KEY","data","await","ai.","postDecisions","aiDecisionsRequest","pull_request","104","diff_lines","480","files","auth.ts","token.go","risk","Rate security risk of code change","low: documentation or cosmetic","medium: internal logic","high: security or auth paths","],","})","console.","log","decision.answers.risk.score","decision.answers.risk.probabilities","Limits","What a request may hold","Model","The model id","answers from kai-1.3, the default. Ask for","by id for the unified version: one encoder and one head, trained on long states. Ask for","by id for the agentic preview: whether a tool fits a request, and whether to call one at all.","kai-1.4","kai-1.5","Up to 100 a request; 101 is refused with 422.","State","kai-1.3, the default, was trained on 1,024 tokens of state beside each question. Up to 32,768 is answered with","and is unreliable: a fact at the end of a 3,982-token state read 0.507.","was trained on long states and marks no read up to 32,768 extrapolated. Past 32,768 the answer is 422","routing.extrapolated: true","state_too_long","Time","One yes/no question takes <1 ms of server time at p50 in production on GPU (0.27 ms cached in process). Every response reports its own","latency_ms","Price","$0.021 per million input tokens; output is free. Jev costs $0.042.","Recipes & Blueprints","Composable Decision Recipes","Modular Rust structs and TypeScript workflows that sit inside your pipelines: retail triage, industrial diagnostics, confidence routing, and agent loops.","recipes::retail","Shelf inventory triage, return fraud checks, and corporate pricing safety guardrails.","recipes::industrial","Multi-criteria powertrain trade studies and telemetry equipment readiness gating.","recipes::routing","Confidence margin gates that stand on high-certainty decisions and escalate low-confidence queries to Zen.","recipes::zen","OpenAI-compatible request builders and SSE stream accumulators for reasoning thought tokens.","recipes::kata","Autonomous test-and-repair agent state machine gating code patch generation vs human review.","recipes::gen","Conversational assistant harness managing multi-turn history and Model Context Protocol (MCP) dispatch.","Read the Recipes Guide","View All Cookbook Pipelines","Kai recipes on GitHub ↗","Coming from Jev","Change the URL, the key and the model","Kai takes the request body Jev takes. The same endpoint also serves typesafe/jev-1.13 with a Hanzo key, at Jev’s price.","# Jev on OpenRouter","https://openrouter.ai/api/alpha/decisions","OPENROUTER_API_KEY","{\"model\": \"typesafe/jev-1.13\", \"state\": \"…\", \"questions\": {…}}","# Kai on Hanzo: the same body","{\"model\": \"kai\", \"state\": \"…\", \"questions\": {…}}","What differs: Kai answers at most","100","questions a request, refuses a state past","32,768","tokens with","422",", and kai-1.3, the default, ignores a noul’s criteria. OpenAI’s Decisions body (","and a list of questions) is refused.","input","On the frozen harness, kai-1.4 averaged 84.4% accuracy against Jev’s 76.6% across the 11 suites it leads, both models on the same questions.","The runs →"],"links":["/models","https://platform.hanzo.ai/api-keys","https://docs.hanzo.ai/docs/decisions","https://docs.hanzo.ai/docs/guides/cookbook/recipes","https://docs.hanzo.ai/docs/guides/cookbook","https://github.com/hanzoai/kai/tree/main/recipes","/kai#benchmarks"]} |