Java client library for OpenAI API
Top 73.0% on sourcepulse
This Java library, openai4j, provides a comprehensive client for interacting with the OpenAI API, targeting Java developers who need to integrate advanced AI capabilities into their applications. It offers full support for all OpenAI models and features, including chat, vision, audio, and the latest Assistants API, simplifying complex API interactions with an easy-to-use interface.
How It Works
Built upon Retrofit, openai4j facilitates seamless API communication. It supports both synchronous and asynchronous calls, allowing developers to choose the interaction pattern that best suits their application's needs. The library emphasizes flexibility, enabling customization of the OpenAiService
with custom HTTP clients, interceptors, and base URLs, including support for environment variable configuration of API keys and base URLs.
Quick Start & Requirements
implementation 'io.github.lambdua:service:0.22.92'
<dependency>
<groupId>io.github.lambdua</groupId>
<artifactId>service</artifactId>
<version>0.22.92</version>
</dependency>
OPENAI_API_KEY
environment variable).example
package.Highlighted Details
OpenAiService
, including custom timeouts and HTTP clients.Maintenance & Community
The project is a fork of TheoKanning/openai-java
and aims to incorporate the latest API features. Contributions are welcomed via GitHub Issues and Pull Requests.
Licensing & Compatibility
Released under the MIT License, permitting commercial use and integration with closed-source applications.
Limitations & Caveats
The library is marked as unofficial. While it aims for comprehensive coverage, users should verify compatibility with the latest OpenAI API specifications.
1 month ago
1 day