SDKs
TypeScript SDK
The Hanzo TypeScript SDK — @hanzo/ai for the AI/agents library and @hanzo/sdk for the full Cloud SDK. Node, Deno, Bun, browser.
TypeScript SDK
Two first-class packages, both generally available on npm. Runs on Node, Deno, Bun, and the browser.
@hanzo/ai — AI lib
npm i @hanzo/ai. The AI-first library — models, agents, tools, streaming.
Source: hanzo-js/ai.
@hanzo/sdk — Cloud SDK
npm i @hanzo/sdk. The full, generated client for the entire Open AI Cloud
(/v1/*). OpenAI-compatible surface. Source: hanzo-js/sdk.
Install
npm i @hanzo/aiSet your key once:
export HANZO_API_KEY="hk-..." # from console.hanzo.aiQuick start — Cloud SDK
import Hanzo from '@hanzo/sdk';
const client = new Hanzo({ apiKey: process.env.HANZO_API_KEY });
const response = await client.chat.completions.create({
model: 'zen5',
messages: [{ role: 'user', content: 'Explain quantum computing' }],
});
console.log(response.choices[0].message.content);Streaming
const stream = await client.chat.completions.create({
model: 'zen5-coder',
messages: [{ role: 'user', content: 'Write a haiku about AI' }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}Quick start — AI lib
import { Agent } from '@hanzo/ai';
const agent = new Agent({ model: 'zen5', tools: ['search', 'shell'] });
const result = await agent.run('Summarize the latest release notes.');
console.log(result.output);Base URL
Every service is reachable at https://api.hanzo.ai/v1. The client defaults
there; override with baseURL for a self-hosted gateway.
Configuration
const client = new Hanzo({
apiKey: process.env.HANZO_API_KEY,
baseURL: 'https://api.hanzo.ai/v1', // default
timeout: 60_000,
maxRetries: 2,
});Resources
- AI lib — hanzo-js/ai ·
@hanzo/aion npm - Cloud SDK — hanzo-js/sdk ·
@hanzo/sdkon npm - Umbrella — hanzoai/sdk
- API reference — every
/v1endpoint →
How is this guide?
Last updated on