openai/openai-java
The official Java library for the OpenAI API
What it solves
It provides a structured, type-safe way for Java developers to interact with the OpenAI REST API, removing the need to manually handle HTTP requests and JSON deserialization when integrating AI models into Java applications.
How it works
The library acts as a Java SDK that wraps the OpenAI REST API. It uses a builder pattern to create immutable request parameters and provides both synchronous and asynchronous clients (via OpenAIClient and OpenAIClientAsync). It supports various authentication methods, including standard API keys, environment variables, and cloud-native workload identity authentication for Kubernetes, Azure, and GCP.
Who it’s for
Java developers building applications that require integration with OpenAI's models, including those deploying to cloud environments or using Amazon Bedrock for OpenAI-compatible APIs.
Highlights
- Flexible Authentication: Supports API keys, system properties, environment variables, and workload identity (K8s, Azure, GCP) including X.509 certificates.
- Async and Streaming: Offers
CompletableFuturefor asynchronous execution and dedicated streaming methods for real-time response processing. - Amazon Bedrock Support: Includes an optional artifact for calling OpenAI-compatible APIs on Amazon Bedrock using AWS credentials.
- Immutability: All SDK classes are immutable and use builders for safe object construction and modification.
相关
- 项目
- 项目
- 项目
- 项目
- 项目