mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-30 14:58:08 +00:00
A first-seen wallet signs a hanzo.id challenge, gets its own account and organization on the Free plan, mints a key, makes a free call and asks for a USDC deposit address: one TypeScript file, run as printed against production, drawn at /agents#headless and named first in the prompt and in llms.txt. Every page's head now names /llms.txt, /agents, the API catalog and the OpenAPI document; the Developers menu and its footer column lead with "Agents: get an API key in one call"; the API catalog lists the sign-in, key, deposit and MCP addresses. Claude-Session: https://claude.ai/code/session_017vrVus6PPBgP5YRzKV1iqW
72 lines
3.3 KiB
TypeScript
72 lines
3.3 KiB
TypeScript
import { Code } from '@/components/code'
|
|
import { HEADLESS } from '@/lib/agents'
|
|
import AgentsPage from './view'
|
|
|
|
// Every sample below was run against the live API on 2026-10-26 (LLM.md,
|
|
// "Agents"): the CLI login and token, the free chat call, the MCP server in
|
|
// Claude Code, and the decision and harness against Kai.
|
|
|
|
const KEY = `curl -fsSL https://hanzo.sh | sh
|
|
hanzo auth login # no browser here? it prints a link and a code
|
|
export HANZO_API_KEY="$(hanzo auth token)"
|
|
hanzo account keys create --name agent --type secret # a key for a server`
|
|
|
|
const CALL = `curl https://api.hanzo.ai/v1/chat/completions \\
|
|
-H "Authorization: Bearer $HANZO_API_KEY" \\
|
|
-H "Content-Type: application/json" \\
|
|
-d '{"model":"zen-free","messages":[{"role":"user","content":"Hello"}]}'`
|
|
|
|
const MCP = `claude mcp add hanzo --env HANZO_API_KEY=$HANZO_API_KEY \\
|
|
-- npx -y --package=@hanzo/mcp@latest hanzo-mcp serve`
|
|
|
|
const KAI = `curl https://api.hanzo.ai/v1/decisions \\
|
|
-H "Authorization: Bearer $HANZO_API_KEY" \\
|
|
-H "Content-Type: application/json" \\
|
|
-d '{"model":"kai",
|
|
"state":{"ticket":"The export button throws a 500 error since this morning."},
|
|
"questions":{"team":{"type":"choice",
|
|
"instructions":"Which team should handle this ticket?",
|
|
"criteria":{"billing":"charges, invoices, refunds",
|
|
"tech":"bugs, errors, outages",
|
|
"other":"anything else"}}}}'
|
|
# {"answers":{"team":{"choice":"tech","confidence":0.951, ...}},
|
|
# "usage":{"input_tokens":41,"output_tokens":0}, "latency_ms":121.2}`
|
|
|
|
const HARNESS = `git clone --depth 1 https://github.com/hanzoai/benchmarks && cd benchmarks/decision
|
|
python3 harness/run_kai.py --limit 3 --out $PWD/kai.json.gz \\
|
|
--suites app.phishing,app.support_triage,app.email_spam,app.rag_relevance
|
|
uv run --with numpy python harness/merge.py --kai $PWD/kai.json.gz --out $PWD/out
|
|
cat out/table.md # Kai beside Jev's recorded answers, suite by suite`
|
|
|
|
// Read from the campaign and event operations in api.hanzo.ai's OpenAPI
|
|
// document. A draft commits nothing; launching spends the ad budget, so the
|
|
// sample stops before it.
|
|
const CAMPAIGN = `curl "https://api.hanzo.ai/v1/event/overview?range=7d" -H "Authorization: Bearer $HANZO_API_KEY"
|
|
|
|
curl https://api.hanzo.ai/v1/campaign \\
|
|
-H "Authorization: Bearer $HANZO_API_KEY" \\
|
|
-H "Content-Type: application/json" \\
|
|
-d '{"name":"Spring launch","audience":"returning-visitors",
|
|
"content":["Variant A, written by zen-free","Variant B"],
|
|
"budget":50000,
|
|
"channels":[{"kind":"paid","platform":"meta"},{"kind":"email"}]}'
|
|
# a draft: nothing sent, no budget committed until POST /v1/campaign/{id}/launch
|
|
# then: GET /v1/campaign/{id}/metrics?range=7d (CTR, CVR, CAC, ROAS per channel)`
|
|
|
|
/** The page, with its samples highlighted where it is built (components/code). */
|
|
export default function Page() {
|
|
return (
|
|
<AgentsPage
|
|
samples={{
|
|
headless: <Code lang="ts" code={HEADLESS} />,
|
|
key: <Code lang="bash" code={KEY} />,
|
|
call: <Code lang="bash" code={CALL} />,
|
|
mcp: <Code lang="bash" code={MCP} />,
|
|
kai: <Code lang="bash" code={KAI} />,
|
|
harness: <Code lang="bash" code={HARNESS} />,
|
|
campaign: <Code lang="bash" code={CAMPAIGN} />,
|
|
}}
|
|
/>
|
|
)
|
|
}
|