Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4480971
codegen metadata
stainless-app[bot] Jan 28, 2026
ae1ff0c
codegen metadata
stainless-app[bot] Jan 28, 2026
5bb79e6
codegen metadata
stainless-app[bot] Jan 28, 2026
ea064a2
codegen metadata
stainless-app[bot] Jan 29, 2026
33e620d
codegen metadata
stainless-app[bot] Jan 29, 2026
c2c0caa
codegen metadata
stainless-app[bot] Jan 29, 2026
241e0ff
codegen metadata
stainless-app[bot] Jan 29, 2026
21064f4
codegen metadata
stainless-app[bot] Jan 29, 2026
e9fa9ec
codegen metadata
stainless-app[bot] Jan 29, 2026
d208d80
codegen metadata
stainless-app[bot] Jan 29, 2026
351125b
codegen metadata
stainless-app[bot] Jan 29, 2026
8ce2dba
codegen metadata
stainless-app[bot] Jan 29, 2026
caf7ba0
codegen metadata
stainless-app[bot] Jan 29, 2026
1dd16e1
codegen metadata
stainless-app[bot] Jan 29, 2026
2e5a3a7
codegen metadata
stainless-app[bot] Jan 29, 2026
c888948
codegen metadata
stainless-app[bot] Jan 29, 2026
3cfd010
codegen metadata
stainless-app[bot] Jan 29, 2026
ecc02ba
codegen metadata
stainless-app[bot] Jan 29, 2026
8bf67c3
codegen metadata
stainless-app[bot] Jan 30, 2026
b1f3984
codegen metadata
stainless-app[bot] Jan 30, 2026
417102b
codegen metadata
stainless-app[bot] Jan 30, 2026
53e9694
codegen metadata
stainless-app[bot] Jan 30, 2026
1a688f5
codegen metadata
stainless-app[bot] Jan 30, 2026
62368f2
codegen metadata
stainless-app[bot] Jan 30, 2026
bdaf186
codegen metadata
stainless-app[bot] Jan 30, 2026
7046bb0
chore(internal): allow passing args to `./scripts/test`
stainless-app[bot] Jan 31, 2026
700e78b
chore(internal): upgrade AssertJ
stainless-app[bot] Feb 7, 2026
516867f
feat(api): api update
stainless-app[bot] Feb 10, 2026
bfba32f
chore(internal): update `TestServerExtension` comment
stainless-app[bot] Feb 18, 2026
3bb5be8
chore(internal): make `OkHttp` constructor internal
stainless-app[bot] Feb 19, 2026
f5d9ecf
feat(client): add connection pooling option
stainless-app[bot] Feb 19, 2026
ced1658
chore(internal): remove mock server code
stainless-app[bot] Feb 20, 2026
638f89e
chore: update mock server docs
stainless-app[bot] Feb 20, 2026
680bdff
chore: make `Properties` more resilient to `null`
stainless-app[bot] Feb 24, 2026
a731078
chore: drop apache dependency
stainless-app[bot] Feb 24, 2026
289645a
chore(internal): expand imports
stainless-app[bot] Feb 25, 2026
9e96831
chore(internal): codegen related update
stainless-app[bot] Mar 7, 2026
157af95
chore(internal): bump palantir-java-format
stainless-app[bot] Mar 7, 2026
518e89e
chore(ci): skip uploading artifacts on stainless-internal branches
stainless-app[bot] Mar 8, 2026
3724180
chore: update placeholder string
stainless-app[bot] Mar 8, 2026
590dc56
fix(client): incorrect `Retry-After` parsing
stainless-app[bot] Mar 11, 2026
631e85b
chore(internal): tweak CI branches
stainless-app[bot] Mar 17, 2026
921f2d2
chore(internal): update retry delay tests
stainless-app[bot] Mar 18, 2026
9c703a8
fix(client): allow updating header/query affecting fields in `toBuild…
stainless-app[bot] Mar 18, 2026
78b3416
release: 0.1.0-alpha.4
stainless-app[bot] Mar 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 14 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
Expand Down Expand Up @@ -65,14 +67,18 @@ jobs:
run: ./scripts/build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/hanzo-ai-java'
if: |-
github.repository == 'stainless-sdks/hanzo-ai-java' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload Maven artifacts
if: github.repository == 'stainless-sdks/hanzo-ai-java'
if: |-
github.repository == 'stainless-sdks/hanzo-ai-java' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.3"
".": "0.1.0-alpha.4"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 187
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hanzo-industries-inc%2Fhanzo-ai-971e209e1a47262e17483e5ac0d91e8013d10237ac89d6392ffabb5912ce83b9.yml
openapi_spec_hash: 029e800ed42f138d5b63bb4f40181c55
configured_endpoints: 188
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hanzo-industries-inc%2Fhanzo-ai-d0c3bcb70e093f6a3686ec328c34326cfb56a6aca336e00d6320816879a16c53.yml
openapi_spec_hash: 9b3181f901ec76a860173f57341b7f62
config_hash: e927bafd76a1eace11894efc3517d245
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## 0.1.0-alpha.4 (2026-03-18)

Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/hanzoai/java-sdk/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)

### Features

* **api:** api update ([516867f](https://github.com/hanzoai/java-sdk/commit/516867ff30ef49f05b4ea521ece41b859bfdc69a))
* **client:** add connection pooling option ([f5d9ecf](https://github.com/hanzoai/java-sdk/commit/f5d9ecf6a189cebacb90e0112e38f74f7c21b4c6))


### Bug Fixes

* **client:** allow updating header/query affecting fields in `toBuilder()` ([9c703a8](https://github.com/hanzoai/java-sdk/commit/9c703a8e00802819887c375f51b71379d03d81a9))
* **client:** incorrect `Retry-After` parsing ([590dc56](https://github.com/hanzoai/java-sdk/commit/590dc56b689c59917603c02b19cf606df04d0ca5))


### Chores

* **ci:** skip uploading artifacts on stainless-internal branches ([518e89e](https://github.com/hanzoai/java-sdk/commit/518e89ecbc5dc90d189312727e28ba1a29cc2932))
* drop apache dependency ([a731078](https://github.com/hanzoai/java-sdk/commit/a7310782fb45257f66b1b2b9a4c997c5dce4fcb7))
* **internal:** allow passing args to `./scripts/test` ([7046bb0](https://github.com/hanzoai/java-sdk/commit/7046bb0f7bd5dab1e7c68276cbd44d829067ec20))
* **internal:** bump palantir-java-format ([157af95](https://github.com/hanzoai/java-sdk/commit/157af950ef5a51a3dbec7df93d6543a4c2af6c17))
* **internal:** codegen related update ([9e96831](https://github.com/hanzoai/java-sdk/commit/9e96831d0175f7ea2c1bbcb16ee4d8ee9feb07a4))
* **internal:** expand imports ([289645a](https://github.com/hanzoai/java-sdk/commit/289645a44cbec69d268cc2fc119ad26495716667))
* **internal:** make `OkHttp` constructor internal ([3bb5be8](https://github.com/hanzoai/java-sdk/commit/3bb5be8732a6b7092ae8adaf39883b346cd15d2b))
* **internal:** remove mock server code ([ced1658](https://github.com/hanzoai/java-sdk/commit/ced165845717b3674b54b54f0de1673d5bea9fb8))
* **internal:** tweak CI branches ([631e85b](https://github.com/hanzoai/java-sdk/commit/631e85b0a6d859f5207bcc6ef95494ae7aad9fd0))
* **internal:** update `TestServerExtension` comment ([bfba32f](https://github.com/hanzoai/java-sdk/commit/bfba32f48b43a0b7f5f9cc7a487e0847659e5a87))
* **internal:** update retry delay tests ([921f2d2](https://github.com/hanzoai/java-sdk/commit/921f2d275c90cffa959fc6e520281cfa1832be08))
* **internal:** upgrade AssertJ ([700e78b](https://github.com/hanzoai/java-sdk/commit/700e78b1d30fc27e7f6fb9f8b6e10e83c79302d0))
* make `Properties` more resilient to `null` ([680bdff](https://github.com/hanzoai/java-sdk/commit/680bdff1158b01efb4d08e4aa511298be9f7b1a0))
* update mock server docs ([638f89e](https://github.com/hanzoai/java-sdk/commit/638f89ea6bd52a27a072c6ab5835441558e5e444))
* update placeholder string ([3724180](https://github.com/hanzoai/java-sdk/commit/37241806179aeb9f18c29f38a7b47d20b3e8512f))

## 0.1.0-alpha.3 (2026-01-28)

Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/hanzoai/java-sdk/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
Expand Down
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/ai.hanzo.api/hanzo-java)](https://central.sonatype.com/artifact/ai.hanzo.api/hanzo-java/0.1.0-alpha.3)
[![javadoc](https://javadoc.io/badge2/ai.hanzo.api/hanzo-java/0.1.0-alpha.3/javadoc.svg)](https://javadoc.io/doc/ai.hanzo.api/hanzo-java/0.1.0-alpha.3)
[![Maven Central](https://img.shields.io/maven-central/v/ai.hanzo.api/hanzo-java)](https://central.sonatype.com/artifact/ai.hanzo.api/hanzo-java/0.1.0-alpha.4)
[![javadoc](https://javadoc.io/badge2/ai.hanzo.api/hanzo-java/0.1.0-alpha.4/javadoc.svg)](https://javadoc.io/doc/ai.hanzo.api/hanzo-java/0.1.0-alpha.4)

<!-- x-release-please-end -->

Expand All @@ -24,7 +24,7 @@ Use the Hanzo MCP Server to enable AI assistants to interact with this API, allo

<!-- x-release-please-start-version -->

The REST API documentation can be found on [docs.hanzo.ai](https://docs.hanzo.ai). Javadocs are available on [javadoc.io](https://javadoc.io/doc/ai.hanzo.api/hanzo-java/0.1.0-alpha.3).
The REST API documentation can be found on [docs.hanzo.ai](https://docs.hanzo.ai). Javadocs are available on [javadoc.io](https://javadoc.io/doc/ai.hanzo.api/hanzo-java/0.1.0-alpha.4).

<!-- x-release-please-end -->

Expand All @@ -35,7 +35,7 @@ The REST API documentation can be found on [docs.hanzo.ai](https://docs.hanzo.ai
### Gradle

```kotlin
implementation("ai.hanzo.api:hanzo-java:0.1.0-alpha.3")
implementation("ai.hanzo.api:hanzo-java:0.1.0-alpha.4")
```

### Maven
Expand All @@ -44,7 +44,7 @@ implementation("ai.hanzo.api:hanzo-java:0.1.0-alpha.3")
<dependency>
<groupId>ai.hanzo.api</groupId>
<artifactId>hanzo-java</artifactId>
<version>0.1.0-alpha.3</version>
<version>0.1.0-alpha.4</version>
</dependency>
```

Expand Down Expand Up @@ -404,6 +404,25 @@ HanzoClient client = HanzoOkHttpClient.builder()
.build();
```

### Connection pooling

To customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:

```java
import ai.hanzo.api.client.HanzoClient;
import ai.hanzo.api.client.okhttp.HanzoOkHttpClient;
import java.time.Duration;

HanzoClient client = HanzoOkHttpClient.builder()
.fromEnv()
// If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.
.maxIdleConnections(10)
.keepAliveDuration(Duration.ofMinutes(2))
.build();
```

If both options are unset, OkHttp's default connection pool settings are used.

### HTTPS

> [!NOTE]
Expand Down Expand Up @@ -503,7 +522,7 @@ import ai.hanzo.api.core.JsonValue;
import ai.hanzo.api.models.model.ModelCreateParams;

ModelCreateParams params = ModelCreateParams.builder()
.litellmParams(ModelCreateParams.LitellmParams.builder()
.llmParams(ModelCreateParams.LlmParams.builder()
.putAdditionalProperty("secretProperty", JsonValue.from("42"))
.build())
.build();
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "ai.hanzo.api"
version = "0.1.0-alpha.3" // x-release-please-version
version = "0.1.0-alpha.4" // x-release-please-version
}

subprojects {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/hanzo.java.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tasks.withType<Test>().configureEach {

val palantir by configurations.creating
dependencies {
palantir("com.palantir.javaformat:palantir-java-format:2.73.0")
palantir("com.palantir.javaformat:palantir-java-format:2.89.0")
}

fun registerPalantir(
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/hanzo.publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ configure<MavenPublishBaseExtension> {
)

pom {
name.set("LiteLLM API")
description.set("Proxy Server to call 100+ LLMs in the OpenAI format.\n[**Customize Swagger Docs**](https://docs.litellm.ai/docs/proxy/enterprise#swagger-docs---custom-routes--branding)\n\n👉 [`LiteLLM Admin Panel on /ui`](/ui). Create, Edit Keys with SSO. Having\nissues? Try [`Fallback Login`](/fallback/login)\n\n💸 [`LiteLLM Model Cost Map`](https://models.litellm.ai/).\n\n🔎 [`LiteLLM Model Hub`](/ui/model_hub_table). See available models on the\nproxy. [**Docs**](https://docs.litellm.ai/docs/proxy/ai_hub)")
name.set("Hanzo API")
description.set("API documentation for Hanzo")
url.set("https://docs.hanzo.ai")

licenses {
Expand Down
2 changes: 1 addition & 1 deletion hanzo-java-client-okhttp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ dependencies {
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")

testImplementation(kotlin("test"))
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.assertj:assertj-core:3.27.7")
testImplementation("com.github.tomakehurst:wiremock-jre8:2.35.2")
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class HanzoOkHttpClient private constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var dispatcherExecutorService: ExecutorService? = null
private var proxy: Proxy? = null
private var maxIdleConnections: Int? = null
private var keepAliveDuration: Duration? = null
private var sslSocketFactory: SSLSocketFactory? = null
private var trustManager: X509TrustManager? = null
private var hostnameVerifier: HostnameVerifier? = null
Expand Down Expand Up @@ -75,6 +77,46 @@ class HanzoOkHttpClient private constructor() {
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
fun proxy(proxy: Optional<Proxy>) = proxy(proxy.getOrNull())

/**
* The maximum number of idle connections kept by the underlying OkHttp connection pool.
*
* If this is set, then [keepAliveDuration] must also be set.
*
* If unset, then OkHttp's default is used.
*/
fun maxIdleConnections(maxIdleConnections: Int?) = apply {
this.maxIdleConnections = maxIdleConnections
}

/**
* Alias for [Builder.maxIdleConnections].
*
* This unboxed primitive overload exists for backwards compatibility.
*/
fun maxIdleConnections(maxIdleConnections: Int) =
maxIdleConnections(maxIdleConnections as Int?)

/**
* Alias for calling [Builder.maxIdleConnections] with `maxIdleConnections.orElse(null)`.
*/
fun maxIdleConnections(maxIdleConnections: Optional<Int>) =
maxIdleConnections(maxIdleConnections.getOrNull())

/**
* The keep-alive duration for idle connections in the underlying OkHttp connection pool.
*
* If this is set, then [maxIdleConnections] must also be set.
*
* If unset, then OkHttp's default is used.
*/
fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
this.keepAliveDuration = keepAliveDuration
}

/** Alias for calling [Builder.keepAliveDuration] with `keepAliveDuration.orElse(null)`. */
fun keepAliveDuration(keepAliveDuration: Optional<Duration>) =
keepAliveDuration(keepAliveDuration.getOrNull())

/**
* The socket factory used to secure HTTPS connections.
*
Expand Down Expand Up @@ -324,6 +366,8 @@ class HanzoOkHttpClient private constructor() {
OkHttpClient.builder()
.timeout(clientOptions.timeout())
.proxy(proxy)
.maxIdleConnections(maxIdleConnections)
.keepAliveDuration(keepAliveDuration)
.dispatcherExecutorService(dispatcherExecutorService)
.sslSocketFactory(sslSocketFactory)
.trustManager(trustManager)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class HanzoOkHttpClientAsync private constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var dispatcherExecutorService: ExecutorService? = null
private var proxy: Proxy? = null
private var maxIdleConnections: Int? = null
private var keepAliveDuration: Duration? = null
private var sslSocketFactory: SSLSocketFactory? = null
private var trustManager: X509TrustManager? = null
private var hostnameVerifier: HostnameVerifier? = null
Expand Down Expand Up @@ -75,6 +77,46 @@ class HanzoOkHttpClientAsync private constructor() {
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
fun proxy(proxy: Optional<Proxy>) = proxy(proxy.getOrNull())

/**
* The maximum number of idle connections kept by the underlying OkHttp connection pool.
*
* If this is set, then [keepAliveDuration] must also be set.
*
* If unset, then OkHttp's default is used.
*/
fun maxIdleConnections(maxIdleConnections: Int?) = apply {
this.maxIdleConnections = maxIdleConnections
}

/**
* Alias for [Builder.maxIdleConnections].
*
* This unboxed primitive overload exists for backwards compatibility.
*/
fun maxIdleConnections(maxIdleConnections: Int) =
maxIdleConnections(maxIdleConnections as Int?)

/**
* Alias for calling [Builder.maxIdleConnections] with `maxIdleConnections.orElse(null)`.
*/
fun maxIdleConnections(maxIdleConnections: Optional<Int>) =
maxIdleConnections(maxIdleConnections.getOrNull())

/**
* The keep-alive duration for idle connections in the underlying OkHttp connection pool.
*
* If this is set, then [maxIdleConnections] must also be set.
*
* If unset, then OkHttp's default is used.
*/
fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
this.keepAliveDuration = keepAliveDuration
}

/** Alias for calling [Builder.keepAliveDuration] with `keepAliveDuration.orElse(null)`. */
fun keepAliveDuration(keepAliveDuration: Optional<Duration>) =
keepAliveDuration(keepAliveDuration.getOrNull())

/**
* The socket factory used to secure HTTPS connections.
*
Expand Down Expand Up @@ -324,6 +366,8 @@ class HanzoOkHttpClientAsync private constructor() {
OkHttpClient.builder()
.timeout(clientOptions.timeout())
.proxy(proxy)
.maxIdleConnections(maxIdleConnections)
.keepAliveDuration(keepAliveDuration)
.dispatcherExecutorService(dispatcherExecutorService)
.sslSocketFactory(sslSocketFactory)
.trustManager(trustManager)
Expand Down
Loading
Loading