Files

1 line
10 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"text":["For agents","Hanzo for agents: free to start, pay as you go","Sign up free with a wallet. Get an API key free. A small free allowance to try it. Top up in USDC or USDT over the API to raise your limits and pay as you go. No human required.","Sign up headless","Read the docs","Headless","01 / 05","Sign up with a wallet","Sign a one-time challenge from hanzo.id. A first-seen wallet gets its own account and organization.","Get a key","POST /v1/account/keys with that token. It is shown once.","Make a first call","POST /v1/chat/completions. GET /v1/billing/tier says what the free allowance has left.","Top up in USDC or USDT","POST /v1/billing/crypto/deposit returns the address to send to; the balance is credited when the chain confirms.","Pay as you go","Each call is billed from your balance at its model’s rate in GET /v1/pricing.","One command installs the whole stack","The CLI, the coding agent, the MCP server and the inference engine are native Rust binaries. npm installs a small launcher; each binary downloads, checksum-verified, the first time it runs. Any OS, Windows included.","Install","Copy","npm i -g hanzo # any OS; or: curl -fsSL https://hanzo.sh | sh hanzo auth login # a person approves once; headless agents use a key hanzo # a coding session in this repo (fetches the agent) hanzo mcp # the MCP server over stdio (fetched on first run) hanzo engine serve <model> # local inference (fetched on first run) # Register the MCP server with nothing installed first: claude mcp add --scope user hanzo -- npx -y hanzo mcp","The five steps, as one script","Every step is one request. This file makes them all, as it was run against production.","// No human required: sign up with a wallet, get a key, call the API, top up in USDC or USDT.","// A first-seen wallet gets its own Hanzo account and organization, with a small free allowance to try it.","// npm i @hanzo/ai viem · node agent.ts (Node 22.18+; set HANZO_WALLET_KEY to use your own wallet)","import","Hanzo","from","@hanzo/ai","generatePrivateKey","privateKeyToAccount","viem/accounts","createHash","randomBytes","node:crypto","const","ID =","https://hanzo.id","API =","https://api.hanzo.ai","CLIENT =","hanzo-ai","// Your agent's own wallet, or a fresh one. The key never leaves this process.","account =","((","process.env.HANZO_WALLET_KEY","as","0x","${","string","}`","??","())","// 1. Sign up with a wallet: get a challenge, sign it, verify (POST /v1/iam/web3/verify), exchange for a token.","nonce =","await","fetch","`${","ID","/v1/iam/web3/nonce?chain=evm&address=","account","address","then","=>","r.","json","message =","nonce","data","domain","wants you to sign in with your Ethereum account:","account.address","''","...","nonce.data.statement ?","nonce.data.statement","[]),","URI:","uri","Version:","version","Nonce:","Issued At:","issuedAt","join","\\n","signature =","account.","signMessage","({","message","})","// Verify the signed challenge: a first-seen wallet gets an account and an organization of its own.","verifier =","32","toString","base64url","challenge =","sha256","update","verifier","digest","code","/v1/iam/web3/verify","method","POST","headers","Content-Type","application/json","},","body","JSON.","stringify","clientId","CLIENT","chain","evm","scheme","secp256k1-eip191","signature","type","redirectUri","http://localhost:3000/callback","scope","openid profile email","codeChallenge","challenge","codeChallengeMethod","S256","}),","token =","/v1/iam/oauth/token","application/x-www-form-urlencoded","new","URLSearchParams","grant_type","authorization_code","client_id","code_verifier","redirect_uri","// 2. Get an API key (POST /v1/account/keys) that outlives the token. Shown once.","hanzo = new","apiKey","token.access_token","baseURL","API","key","hanzo.account.keys.","create","name","agent","secret","// 3. Use AI (POST /v1/chat/completions) with the Hanzo SDK — OpenAI-compatible, one line.","client = new","chat =","client.chat.completions.","model","zen-free","messages","[{","role","user","content","Reply with the single word: ready","}],","console.","log","chat","chat.choices","?.message?.content","free left today:","chat.headers?.","get","?.","x-ratelimit-remaining","))","// Or make a Kai decision — typed, calibrated, zero output tokens.","decision =","client.decisions.","kai","state","ticket","The export button throws a 500 error since this morning.","questions","team","choice","instructions","Which team should handle this ticket?","criteria","billing","charges, invoices, refunds","tech","bugs, errors, outages","other","anything else","decision","decision.answers","input tokens:","decision.usage.input_tokens","latency:","decision.latency_ms +","ms","// 4. Top up in USDC or Card (POST /v1/billing/crypto/deposit · GET /v1/billing/crypto/options · GET /v1/billing/tier).","deposit =","client.billing.crypto.","deposit","base","token","usdc","amountCents","500","send to","deposit.depositAddress","then poll","/v1/billing/crypto/deposit/","id","HANZO_API_KEY=","+ key.","slice","12","… (store the whole key; it is shown once)","Keep the wallet key and the API key in your secret store: the wallet is the account, and the API key is shown once. A deposit address lasts 24 hours and is credited when the chain confirms; send only the token and chain it names.","Paste this into your agent","What Hanzo is, the base URL, how to discover the API and the headless path, in one block an agent keeps in its context.","Agent prompt","Hanzo (https://hanzo.ai) is the AI operating system for business: one API for every model, Kai decisions and agents, with one key. Building business software since 2014. Techstars '17. Sign up free with a wallet. Get an API key free. A small free allowance to try it. Top up in USDC or USDT over the API to raise your limits and pay as you go. No human required. Base URL: https://api.hanzo.ai/v1 (chat completions in the OpenAI shape). Discover: GET https://api.hanzo.ai/v1 lists every capability, GET https://api.hanzo.ai/v1/<capability> its operations, and https://api.hanzo.ai/v1/openapi.json is the whole spec. No key needed for any of the three. 1. Sign up with a wallet: GET https://hanzo.id/v1/iam/web3/nonce?chain=evm&address=<address>, sign the CAIP-122 message it describes with EIP-191 personal_sign, POST https://hanzo.id/v1/iam/web3/verify (clientId \"hanzo-ai\", chain \"evm\", scheme \"secp256k1-eip191\", type \"code\" with a PKCE challenge), then exchange the code at https://hanzo.id/v1/iam/oauth/token. A first-seen wallet gets its own account and organization. A Solana wallet asks with chain=solana, writes \"Solana account\" in the message, and sends chain \"solana\", scheme \"ed25519\" and its signature as base64, never base58. 2. Get a key: POST https://api.hanzo.ai/v1/account/keys {\"name\":\"agent\",\"type\":\"secret\"} with that token. The key is shown once. 3. Read your allowance: GET https://api.hanzo.ai/v1/billing/tier with the key says your plan, what it allows and what is left; GET https://api.hanzo.ai/v1/billing/plans lists every plan and price. 4. Top up: GET https://api.hanzo.ai/v1/billing/crypto/options, then POST https://api.hanzo.ai/v1/billing/crypto/deposit {\"chain\":\"base\",\"token\":\"usdc\",\"amountCents\":2000}. Send that token on that chain to the address it returns, and GET https://api.hanzo.ai/v1/billing/crypto/deposit/<id> until it says succeeded. 5. Call: POST https://api.hanzo.ai/v1/chat/completions {\"model\":\"zen-free\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]} with Authorization: Bearer <key>. The whole path as one TypeScript file: https://hanzo.ai/agents#headless. Every request spelled out: https://docs.hanzo.ai/docs/agents. Talk to people at Hanzo: https://cal.com/hanzo. Tools: `npm i -g hanzo` installs the whole native stack on any OS: `hanzo` (the CLI), `hanzo dev` (the coding agent), `hanzo mcp` (the MCP server over stdio) and `hanzo engine serve <model>` (local inference), each binary fetched on first use. To give yourself the MCP tools without installing anything: `npx -y hanzo mcp`. Skills index: https://hanzoskills.com/llms.txt (install with `npx skills add https://hanzoskills.com/hanzo.md`). Hanzo Improvement Proposals: https://hips.hanzo.ai/llms.txt.","Agents SDK","llms.txt","Book a call","Questions","What is free?","Signing up, the API key and a small free allowance to try it. GET /v1/billing/tier, with your key, says what your account allows and what is left, and every answer carries X-RateLimit-Remaining. A person on the Free plan gets free model requests and Kai decisions; the request after the allowance answers 429 until its window resets.","What does it cost after that?","You pay as you go from the balance you top up: each call is billed at its model’s rate in GET /v1/pricing. Kai is $0.021 per million input tokens, and its output is free. Plans for people start at $8 a month, and GET /v1/billing/plans lists every one.","Can an agent sign up without a person?","Yes. With a wallet it needs no inbox and no person: it signs a one-time challenge from hanzo.id, a first-seen wallet gets its own account and organization, and it mints a key with the token it gets back. The whole flow is the script above. An agent with an inbox can sign up by email code instead, and one with neither has its person approve a device code once.","How does an agent pay?","Over the API in stablecoins: GET /v1/billing/crypto/options lists the chains (today Base, Ethereum and Solana) and the tokens (USDC and USDT) the rail accepts, POST /v1/billing/crypto/deposit returns the address to send to, and GET /v1/billing/crypto/deposit/{id} says when it is credited. Cards, Apple Pay and Google Pay go through the checkout at hanzo.ai/pay, which needs a browser.","How do I keep an agent from overspending?","Give each agent its own key with a monthly budget in cents and a rate in requests a minute: past the budget a call answers 402, past the rate 429. A session can carry its own cap, set with POST /v1/agent/sessions/{id}/budget, and a session that reaches it pauses until the cap is raised.","Which tools can my agent use?","The native Hanzo MCP server, over stdio from one line in Claude Code, Codex, Cursor and Zed: npx -y hanzo mcp. It carries the Kai decision tools beside files, shell, git, code search, the browser and the computer.","02 / 05","03 / 05","04 / 05","05 / 05"],"links":["#headless","https://docs.hanzo.ai/docs/agents","/agents/sdk","/llms.txt","https://cal.com/hanzo"]}