Claude Code
Run Claude Code through api.hanzo.ai with hanzo code claude: what is routed, what is not, and how to keep your own plan.
Set up
curl -fsSL hanzo.sh | sh
hanzo login
hanzo code claudeGive it a task as one quoted argument to run it headless: hanzo code claude "fix the failing test in api/users". claude-code and cc are accepted spellings of claude.
What goes through Hanzo
With a signed-in account and no --no-route:
- Model calls go to
https://api.hanzo.ai. The wrapper points Claude Code at it withANTHROPIC_BASE_URLand sends your Hanzo token as the bearer inANTHROPIC_AUTH_TOKEN, and clears anyANTHROPIC_API_KEYin your shell so one credential is in play. The token goes to the process through its environment, never its arguments. - The model is
enso-autounless you set another with--model,ANTHROPIC_MODELormodelin~/.hanzo/settings.json. Claude Code is handed aclaude-*name so it grants the model's real context window, and the wrapper maps that name back to the Hanzo model before the request leaves the process. - Usage is metered into your org at api.hanzo.ai, so it appears in the cloud whichever machine you ran on.
- The Hanzo toolset (
hanzo-mcp, if installed or reachable withuvx) and your org's cloud tools are added to Claude Code's MCP servers. The cloud tools ride only a routed run, because only then does the process already hold your token. - The session is registered in the cloud with its machine and directory, and its messages and tool calls stream there. Pass
--no-linkto keep it local. - Claude Code's home for the run is
~/.hanzo/claude, so its saved model choice and your Hanzo settings do not overwrite each other.
What does not
- A repository's own
.mcp.jsonand.claude/settings*.jsonhooks do not load, because a repository is untrusted and its hooks would run with your token in the environment.--project-mcpopts in for a repository you trust. - With
--askthe tool asks before each action. By default the wrapper starts Claude Code with--dangerously-skip-permissions, asautoApprovein~/.hanzo/settings.jsonsays.
See usage and savings
A linked headless run prints its reported tokens, the cached share and the cost at the listed price when it ends. Any other routed run prints the cloud's count for the session window, since an interactive Claude Code reports nothing to the wrapper. Then:
hanzo console # press 6 for Savings
hanzo usage summary --range 7dKeep your own plan
hanzo code claude --no-routeClaude Code uses its own login in ~/.claude, and its environment is left as your shell has it. Hanzo meters none of that traffic and the end-of-session block says so.
Was this page useful?