Java

ai.hanzo:hanzo-java-cloud on Maven Central — the generated client for every /v1 capability, on OkHttp and Gson.

The Java client is generated from the API's own document onto OkHttp and Gson — the same HTTP and JSON stack the Kotlin client uses, so a JVM project that pulls both pulls one stack.

Install

ai.hanzo:hanzo-java-cloud is on Maven Central. Java 11 or newer.

// build.gradle.kts
repositories { mavenCentral() }
dependencies { implementation("ai.hanzo:hanzo-java-cloud:8.5.+") }
<dependency>
  <groupId>ai.hanzo</groupId>
  <artifactId>hanzo-java-cloud</artifactId>
  <version>[8.5,8.6)</version>
</dependency>

Every cloud release cuts a patch, so both take the newest of the 8.5 line.

The shape

One ApiClient, one class per capability. ai.hanzo.Hanzo builds the client from HANZO_API_KEY, HANZO_BASE_URL and HANZO_ORG_ID:

import ai.hanzo.Hanzo;
import ai.hanzo.ApiClient;
import ai.hanzo.api.AiApi;
import ai.hanzo.model.AiModelList;

ApiClient client = Hanzo.client();

AiModelList models = new AiApi(client).getModels();

Or set the credential yourself: new ApiClient() and setBearerToken(token).

setBearerToken also takes a Supplier<String>, which is what you want when the credential is an IAM access token that refreshes rather than a static sk-. See Authentication.

The class is the capability and the method is the operation, both derived from the document — the reference prints the pair per operation. Every call throws ApiException, which carries the status code and the response body.

Resources

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.
Last updated Nov 7, 2026