Files
python-sdk/pkg/hanzo
zeekay aa18787d58 hanzo iam: address the routes IAM serves
Every command in this tree called /api/get-users, /api/set-password,
/api/add-provider and twenty-five more — the Casdoor-era surface. IAM
serves /v1/iam/<entity> and /v1/iam/password; all twenty-eight 404d. The
client id and secret rode in the query string besides, where the server
never looks and every log does.

IAM's entities all have the same five routes, so this is one
implementation of them over a table of fourteen entities rather than
fourteen hand-written command trees: 1391 lines to 300, and every entity
gains the verbs only some of them had. The credential goes in
Authorization — Basic for a confidential client, a bearer when one is
exported — and configure writes ~/.hanzo/auth.json 0600.

test_iam_cli reads IAM's own route registrations out of its Go source and
asserts every route this CLI names is one of them: 70 checked, and it is
what caught certs/get answering GET where the table said POST.
2026-08-23 12:46:01 -07:00
..

hanzo

PyPI Python Version

Python orchestration helpers for Hanzo AI, and the older Python implementation of the Hanzo CLI.

The hanzo command lives elsewhere now

The Hanzo CLI is a native binary. Install it with:

curl -fsSL https://hanzo.sh | sh
hanzo auth login

That gives you hanzo (and hanzo-node, a symlink to the same build) with one command group per Hanzo Cloud product. This package's console script is hanzo-py — deliberately not hanzo, so it cannot shadow the real CLI on your PATH:

pip install hanzo
hanzo-py --help

Nothing here is being removed. If you have scripts on hanzo-py, they keep working; new work should target the native CLI.

What's still useful here

The Python library pieces, importable without touching the CLI:

from hanzo.batch_orchestrator import BatchOrchestrator

orchestrator = BatchOrchestrator()
results = await orchestrator.run_batch([
    "Summarize the incident report",
    "Draft the follow-up email",
])
from hanzo.memory_manager import MemoryManager

memory = MemoryManager()
memory.add_to_context("user", "What changed in the last deploy?")
context = memory.get_context()
from hanzo.fallback_handler import FallbackHandler

handler = FallbackHandler()
result = await handler.handle_with_fallback(
    primary_fn=api_call,
    fallback_fn=local_inference,
)

For the typed Hanzo Cloud API client, install hanzoai.

Configuration

HANZO_API_KEY=sk-...
HANZO_BASE_URL=https://api.hanzo.ai

Model ids come from the cloud catalog, not from this file — zen5, zen5-coder, zen5-flash, zen5-mini, zen5-pro, enso, enso-flash, enso-ultra. Ask the cloud rather than hardcoding: hanzo models list.

Development

cd pkg/hanzo
uv sync --all-extras
uv build

License

Apache 2.0