mirror of
https://github.com/hanzoai/agent.git
synced 2026-10-30 15:05:34 +00:00
Both clients defaulted to another company. Go's DefaultConfig read
OPENAI_API_KEY and api.openai.com; TypeScript's provider resolved to 'openai'
and its type union named ten third parties without naming Hanzo at all — so
the type itself said Hanzo was not a provider of its own SDK. A caller who set
an API key and nothing else sent that key elsewhere, and the examples in this
repo had to write the address out by hand to avoid teaching it.
Now HANZO_API_KEY selects api.hanzo.ai in Go, and `hanzo` is both a member of
the TypeScript union and the value an unset provider resolves to. It speaks the
OpenAI dialect, so it needs an address rather than a client.
Every explicit choice still does what it did. A third-party key selects that
provider's endpoint and a model it serves; naming a provider selects it.
OpenRouter still wins over OpenAI where both keys are present, which is the
precedence this package already had — their test named it, and my first attempt
inverted it.
The model default moves with the address, because "gpt-4o" against
api.hanzo.ai is not a request anybody can serve. zen3-vl, which is the default
the MCP runtime already carries, so the estate answers with one model rather
than each client picking its own.
TypeScript's two switches now share one provider-to-address function. They both
route the same four providers through the same client, and a copy of that
mapping in each is how they come to disagree about where `hanzo` lives.
The tests are hermetic now. They cleared three environment variables and not
HANZO_API_KEY, so once that variable meant something the suite passed or failed
according to the developer's shell. t.Setenv clears it and restores whatever
was there.
Both examples shrink to the short form, which is the point: `ai.NewClient(nil)`
and `new AIClient({ apiKey })` now reach our stack with nothing else said.
Co-authored-by: Hanzo Dev <[email protected]>