← Back to Leaderboard
Oopenai

openai/openai-java

Official typed Java SDK for OpenAI APIs, with OkHttp and sync, async, and streaming calls

View on GitHub ↗
AI FrameworkQuickstart ↓
Engineering Health (Methodology)
A+ · 95/100
Maintenance Activity
● Updated yesterday
Latest Release
v4.117.0
Commercial License Check
Apache-2.0 · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption20/25
Release Cadence20/20
License Clarity20/20
API
Total Stars
★ 1,572
24h Growth
+0
7d Growth
+1
Forks
275

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

openai/openai-java Star History (2024-11-17 - 2026-12-03) ALL-TIME STAR HISTORY (2024-11 – 2026-12) +1.6k in 746d · avg +2/day 1.7k 830 0 2024-11-17: ★ 12025-01-04: ★ 2712025-02-22: ★ 4692025-04-12: ★ 6552025-05-31: ★ 7952025-07-19: ★ 9052025-09-06: ★ 1,0272025-10-25: ★ 1,1242025-12-13: ★ 1,2162026-01-31: ★ 1,2882026-03-21: ★ 1,3612026-05-09: ★ 1,4192026-06-27: ★ 1,4672026-08-15: ★ 1,4912026-10-03: ★ 1,5342026-12-03: ★ 1,572 ★ 1.6k 2024-11 2025-11 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

OpenAI Java is an API client, not an inference runtime. It is implemented in Kotlin and exposes Java-facing interfaces. The Gradle repository separates the client base and runtime, typed model modules, and service modules for areas such as Responses, general APIs, beta APIs, and administration. openai-java-client-okhttp supplies the HTTP transport, with OpenAIOkHttpClient as the usual entry point.

The call path is explicit: build an immutable ResponseCreateParams, pass it to client.responses().create(...), and receive a deserialized Response. Async calls return CompletableFuture; streaming methods expose typed events through StreamResponse or AsyncStreamResponse rather than waiting for a complete body. withOptions() derives a client or service with different options while preserving the original configuration and sharing connection and thread pools.

Key Capabilities & Differentiators

The Responses API is the primary model interface. It supports synchronous calls, async calls, and incremental event consumption through createStreaming(...); streaming endpoints generally use SSE or JSONL. Structured Outputs can use a Java class via ResponseCreateParams.text(Class) or a StructuredResponseTextConfig when the application also needs to set verbosity.

Authentication can use API keys or short-lived workload identity tokens, with provider implementations for Kubernetes, Azure Managed Identity, and GCP ID tokens. The X.509 option exchanges a client certificate for short-lived tokens and caches them until refresh is needed. For Amazon Bedrock, the optional openai-java-bedrock artifact uses the standard AWS credential chain and signs each request attempt with fresh credentials. That integration targets OpenAI-compatible Bedrock APIs; it does not establish feature parity with every OpenAI endpoint.

Trade-offs & Limitations

Compared with calling REST directly, the SDK removes much of the work of maintaining request classes, response parsing, and stream consumption. The trade-off is accepting the SDK's object model, OkHttp transport, and release cadence. A small integration with tight dependency constraints or specialized wire-level requirements may be simpler with a direct HTTP client. An async method also does not by itself bound concurrency or memory use; those limits still belong in the application.

Remote inference avoids local accelerator provisioning, but network behavior, provider availability, and service charges remain operational concerns. X.509 workload identity has a concrete transport boundary: it uses isolated direct mTLS connections and does not support redirects or custom transport settings. Apache-2.0 covers the client code, not access to hosted models or the provider's terms for handling application data.

Hardware & Deployment Guide

Add com.openai:openai-java:4.116.0 through Maven or Gradle. The framework-neutral artifacts require Java 8 or later; check the artifact-specific support policy, and use the separate JDK specified by build.jdk in gradle/version-support.properties when building the repository. For ordinary API-key use, configure OPENAI_API_KEY and initialize with OpenAIOkHttpClient.fromEnv(). Configure a Bedrock region for that optional client.

Deploy the SDK inside the application: it requires outbound access to the chosen API, not local model weights or an inference server. Size the JVM and connection capacity for concurrent requests, open streams, payloads, and buffering; close streaming responses and clients at the end of their lifecycles. Version selection matters for API lifecycle changes: 4.115.0 deprecated Evals and saved prompt references, and 4.116.0 added health alert rules and notification retrieval.

Packaging: Kotlin implementation with a Java-facing com.openai:openai-java artifact and separate core runtime, model, service, and OkHttp modules.
Typed API: Immutable request and response objects, builders for construction, and toBuilder() for modified copies of builder-backed types.
Execution: Blocking methods, CompletableFuture-based async methods, and typed stream responses for SSE or JSONL endpoints.
Structured output: ResponseCreateParams.text(Class) maps output to a Java type; StructuredResponseTextConfig also exposes verbosity.
Client reuse: withOptions() scopes overrides to a derived client or service while sharing connection and thread pools.
Cloud authentication: Kubernetes, Azure, and GCP workload token providers; X.509 token exchange; optional Bedrock client that signs each attempt with fresh AWS credentials.
Best For

JVM services that need typed access to the OpenAI Responses API, manageable streaming lifecycles, or short-lived cloud workload credentials.

Skip If

You need offline or self-hosted model execution, a provider-neutral abstraction, or direct control over the transport for a small set of REST calls.

Reviewed on 2026-12-02 · Grounded in GitHub README, root file tree & releases · Newer release v4.117.0 (2026-12-03) shipped after this reviewMethodology

Quick Start & Installation

API
./scripts/check-env
./scripts/lint

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
openai-java ★1.6k+1KotlinApache-2.0Official typed Java SDK for OpenAI APIs, with OkHttp and sync, async, and stream
transformers169.6k+337PythonApache-2.0A PyTorch model-definition SDK for unified inference and training across modalit
pytorch105.9k+299Python—Python-first tensor SDK for GPU-accelerated training and inference
qlib50.8k+197PythonMITModular Python framework for quant research, from market data to backtests

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/openai/openai-java.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

openai/openai-java Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about openai-java

How should a Java service integrate and reuse the client?

Create a long-lived OpenAIOkHttpClient with fromEnv() or the builder, then pass a ResponseCreateParams instance to client.responses().create(...). Use client.async() for CompletableFuture-based calls, or createStreaming(...) to consume events as they arrive. Use withOptions() for scoped configuration changes without creating separate connection and thread pools.

What Java version and hardware does the SDK require?

The framework-neutral SDK artifacts require Java 8 or later and perform inference through a remote API, so the client host needs no inference GPU or VRAM. Size JVM heap and connection capacity for concurrent calls, open streams, payload size, and how much data the application buffers. Check the Java support policy for the exact artifacts you deploy.

Can we redistribute the SDK commercially or run it on our own infrastructure?

Apache-2.0 permits commercial use and redistribution of the SDK subject to its license conditions. You can run the Java application on your own infrastructure, but that does not self-host the model. API access, billing, and data handling are governed separately by the provider; verify those terms for the endpoint and workload you choose.

When is direct REST a better choice?

Choose the SDK when you want typed service methods, Java object mapping, and stream handling without implementing them yourself. A direct REST client is reasonable if you call only a few endpoints and need exact control over dependencies or wire behavior. In that case, your team owns serialization, error handling, and stream parsing.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining openai/openai-java? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature openai/openai-java on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare