Call a human like you call an API.
Base URL https://kageai.me. Everything below is live on Solana devnet during the hackathon.
Quickstart
Create a project in the dashboard. You get an API key (shown once) and a webhook secret. Fund it with USDC, or skip keys entirely and pay per call over x402.
import { Kage } from "@kage/sdk"; // packages/sdk in the repo
const kage = new Kage({ apiKey: process.env.KAGE_API_KEY });
const r = await kage.askHuman({ task: "Is this reply safe to send?", content: reply });
// { status: "completed", answer: "no", agreement: 1, confidence: 0.9, humans: 1, ... }Consensus
Ask several independent humans. Nobody sees another person's answer. Kage returns the majority, the share who agreed, and a confidence weighted by each human's measured accuracy.
const r = await kage.consensus({
task: "Which Telugu reply sounds natural?",
options: ["A", "B"],
language: "te",
humans: 3,
budget: 0.30, // USDC for the round, split per human
deadline: 20, // seconds, 10-600
qualityThreshold: 0.8, // agreement needed for "completed"
maxHumans: 5, // below the threshold, add 2 more (never the same people)
maxBudget: 0.50, // hard cap across rounds
});Answer shapes: binary (yes/no, the default), choice (pass options), rating (1 to scale) and text. Pass responseSchema to pick one.
Results and statuses
{
"task_id": "…",
"status": "completed", // agreement >= quality_threshold
"answer": "B",
"agreement": 0.8, // 4 of 5 humans
"confidence": 0.74,
"votes": [{ "answer": "B", "humans": 4 }, { "answer": "A", "humans": 1 }],
"humans": 5, // across the chain, including escalations
"latency_ms": 8400,
"price_usdc": 0.1, "refund_usdc": 0,
"payment_tx": "…" // x402 settlement signature
}matching,collecting: humans are claiming seats and answering.completed: enough humans answered and agreement met your threshold.low_confidence: everyone answered, agreement is below your threshold. Escalate or decide yourself.insufficient_capacity: the deadline passed with seats unfilled. Unfilled seats are refunded.
Capacity, before you pay
Kage never hangs and never pretends. If not enough qualified humans are online, the create call answers 409 before any payment is taken. Check first for free:
await kage.findCapacity({ language: "hi", skill: "support" });
// { online: 41, available: 12 }
// POST /v1/consensus when short:
// 409 { "status": "insufficient_capacity", "available": 1, "required": 3 }The SDK returns this as a result (not an exception), so your policy decides: retry, raise the reward, escalate, or continue without a human.
Payments
Prepaid balance. Send USDC on Solana from your project's funding wallet to the Kage platform wallet, then paste the transaction signature in the dashboard. Kage verifies the transfer on-chain and credits it once. Tasks debit the balance; unfilled seats go straight back.
Per call, no account (x402). Call without an API key. The endpoint answers 402; an x402 client signs a USDC payment for exactly humans × reward and retries. The task only goes live after settlement.
const kage = new Kage({ walletSecretKey: process.env.AGENT_SECRET }); // base58, 64 bytesHumans receive 80% of each seat. Payouts to their wallets are real USDC transfers with public signatures.
Webhooks
Pass webhookUrl (public https) on a project task and Kage posts task.finished with the result. Every request is signed: x-kage-signature: t=<ms>,v1=<hex hmac-sha256("t.body")>.
import { verifyWebhook } from "@kage/sdk";
const ok = await verifyWebhook(process.env.KAGE_WEBHOOK_SECRET!, rawBody, req.headers["x-kage-signature"]);
if (!ok) return res.status(401).end(); // wrong secret, tampered, or older than 5 minutesMCP
Any MCP client gets three tools: kage_ask_human, kage_consensus, kage_find_capacity.
{
"mcpServers": {
"kage": {
"command": "bun",
"args": ["<repo>/apps/mcp/src/index.ts"],
"env": { "KAGE_API_KEY": "kage_sk_..." }
}
}
}REST reference
- POST https://kageai.me/v1/consensus · n humans (paid)
- POST https://kageai.me/v1/tasks · same body, default 1 human (paid)
- GET https://kageai.me/v1/tasks/:id?wait=20 · result, long-poll up to 25 s
- GET https://kageai.me/v1/capacity?language=&skill=&min_accuracy= · free
- GET https://kageai.me/v1/stats · public network numbers
- Body: task, content, options | response_schema, humans (1-15), budget, deadline (10-600), language, skill, min_accuracy (>= 0.95 routes to experts), quality_threshold, webhook_url, extends.
- Limits: 120 paid calls a minute per client; budget per human $0.01 to $5.