Hanzo Java SDK → hanzo-java/sdk
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.
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.
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());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 |