Files
zeekayandHanzo Dev 220c5251dd Point to hanzo-java/sdk, where the SDK lives
This name held the Hanzo SDK until it moved to github.com/hanzo-java/sdk. The README links there: install, quickstart, and each example.

Co-authored-by: Hanzo Dev <[email protected]>
2026-11-06 13:35:43 -08:00

3.0 KiB

Hanzo Java SDK → hanzo-java/sdk

Maven Central

The Hanzo Java SDK lives at github.com/hanzo-java/sdk: every /v1 operation of api.hanzo.ai as a typed method, generated from the API document each cloud release publishes. This repository is its old address and holds no code. Issues and pull requests go to hanzo-java/sdk.

Install

Java 11 or newer, from Maven Central:

dependencies { implementation 'ai.hanzo:hanzo-java-cloud:latest.release' }

The exact version and the Maven form are in the SDK's README.

Quickstart

import ai.hanzo.Hanzo;
import ai.hanzo.ApiClient;
import ai.hanzo.api.AccountApi;
import ai.hanzo.api.AiApi;
import ai.hanzo.model.OpenaiChatCompletionMessage;
import ai.hanzo.model.OpenaiChatCompletionRequest;

ApiClient hanzo = Hanzo.client();   // HANZO_API_KEY, HANZO_BASE_URL, HANZO_ORG_ID

new AccountApi(hanzo).getAccountKeys().getKeys()
        .forEach(key -> System.out.println(key.getType() + " " + key.getPrefix()));

var reply = new AiApi(hanzo).postChatCompletions(new OpenaiChatCompletionRequest()
        .model("zen5")
        .messages(java.util.List.of(new OpenaiChatCompletionMessage().role("user").content("Say hello."))),
        null, null);
System.out.println(reply.getChoices().get(0).getMessage().getContent());

Examples

Each a complete program in the SDK, compiled against it on every release:

flow what it does
hello GET /v1/account/keys: prove the key works
chat POST /v1/chat/completions: one completion
money GET /v1/billing/balance, GET /v1/billing/usage
store create a KV store, read it back, delete it
agent create an agent, run it, poll the run to completion
tools GET /v1/tool: the tool catalog the key reaches
kai POST /v1/decisions: a Kai decision, in the Kai cookbook

Other languages

C# · Python · TypeScript · Go · Rust · C++ · all SDKs