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

Addresshttps://api.hanzo.ai/v1/ai/mcp/decisions
MethodPOST
OperationaiDecide
AuthAuthorization: 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).

FieldInTypeRequiredDescription
handlebodystring—Handle decides over a state this org observed earlier, in place of State and Questions.
modelbodystring—Model is kai, Kai's versioned id kai-<12 hex>, or Jev by its vendor id (typesafe/jev-1.13, ~typesafe/jev-latest).
observebodystring—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.
questionsbodyobject—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.*bodyany—
statebodyany—State is what the questions are about: a string, an object or an array, kept as written.

Response

StatusBodyMeaning
200aiDecisionok
defaultproblem-detailsrefused

200 body — 9 fields.

FieldInTypeAlwaysDescription
decisionbodyany—Decision is POST /v1/decisions' own answer: id, model, provider, answers, usage (the billed input tokens), routing, state_hash and latency_ms.
receiptbodyaiReceipt—
receipt.classbodystring—Class is the model's class as billed: premium, ours or free (X-Hanzo-Usage-Class).
receipt.fallbackbodystring—Fallback is the model that answered in place of the one asked, in limited mode (X-Hanzo-Fallback).
receipt.paid_bybodystring—PaidBy is plan, credits or free (X-Hanzo-Paid-By); absent when the answer named no payer, as a free model's does.
receipt.reasonbodystring—Reason is the refusal code that sent the request to the fallback (X-Hanzo-Usage-Reason).
receipt.routedbodystring—Routed is the model auto resolved to (X-Routed-Model).
receipt.servedbodystring—Served is the model that answered (X-Hanzo-Served).
receipt.usagebodystring—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.


AI API · All Hanzo APIs · Interactive reference

Was this page useful?