Create decisions — POST /v1/ai/mcp/decisions
Runs one decision — the caller's own POST /v1/decisions, gated and billed exactly as that route is — and answers the decision, which model served it and who paid.
POST /v1/ai/mcp/decisions
| Address | https://api.hanzo.ai/v1/ai/mcp/decisions |
| Method | POST |
| Operation | aiDecide |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Runs one decision — the caller's own POST /v1/decisions, gated and billed exactly as that route is — and answers the decision, which model served it and who paid. A refusal names its code and what lifts it, never an amount.
Request
6 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
handle | body | string | — | Handle decides over a state this org observed earlier, in place of State and Questions. |
model | body | string | — | Model is kai, Kai's versioned id kai-<12 hex>, or Jev by its vendor id (typesafe/jev-1.13, ~typesafe/jev-latest). |
observe | body | string | — | Observe holds the state under this id (1 to 128 of A-Z a-z 0-9 . _ -), so a later decision can name it as its Handle. |
questions | body | object | — | Questions are 1 to 100 named questions, each {"type": "choice"|"noul"|"score", "instructions"?, "criteria"?}; a choice names at least 2 labels and a score at least 1 level. |
questions.* | body | any | — | |
state | body | any | — | State is what the questions are about: a string, an object or an array, kept as written. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | aiDecision | ok |
default | problem-details | refused |
200 body — 9 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
decision | body | any | — | Decision is POST /v1/decisions' own answer: id, model, provider, answers, usage (the billed input tokens), routing, state_hash and latency_ms. |
receipt | body | aiReceipt | — | |
receipt.class | body | string | — | Class is the model's class as billed: premium, ours or free (X-Hanzo-Usage-Class). |
receipt.fallback | body | string | — | Fallback is the model that answered in place of the one asked, in limited mode (X-Hanzo-Fallback). |
receipt.paid_by | body | string | — | PaidBy is plan, credits or free (X-Hanzo-Paid-By); absent when the answer named no payer, as a free model's does. |
receipt.reason | body | string | — | Reason is the refusal code that sent the request to the fallback (X-Hanzo-Usage-Reason). |
receipt.routed | body | string | — | Routed is the model auto resolved to (X-Routed-Model). |
receipt.served | body | string | — | Served is the model that answered (X-Hanzo-Served). |
receipt.usage | body | string | — | Usage is where that class stands for the payer: ok, near or limited (X-Hanzo-Usage). |
Failure carries the platform error shape — see Errors.
Examples
hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.
import { Configuration, AiApi } from 'hanzoai';
const api = new AiApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.aiDecide({ handle: "<handle>", model: "<model>" });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).ai_decide(handle="<handle>", model="<model>")cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.AiAPI.AiDecide(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::ai_decide(&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).aiDecide();curl -X POST https://api.hanzo.ai/v1/ai/mcp/decisions \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"handle": "<handle>",
"model": "<model>"
}'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.