openai-java logo

openai-java

Free

4.8k

FreeFree tier
Inputs: textOutputs: text, image, audio
Type
Open Source

About openai-java

OpenAI-Java is an open-source Java library that provides a client interface for OpenAI's GPT APIs, including GPT-3, ChatGPT, and GPT-4. It offers a set of artifacts: an API module with request/response POJOs, a client module built on Retrofit for making HTTP calls, and a service module that simplifies usage by wrapping the client. The library supports a wide range of OpenAI endpoints such as Completions, Chat Completions, Edits, Embeddings, Audio, Files, Fine-tuning, Images, Moderations, and Assistants. However, as of June 6, 2024, the project has been archived and is no longer maintained, though the repository remains available for forking and modification. Users should note that OpenAI has deprecated all Engine-based APIs, and the library may not be compatible with the latest OpenAI API changes.

Key Features

Java client for OpenAI GPT APIs (GPT-3, ChatGPT, GPT-4)
Modular design with separate API, client, and service artifacts
Supports multiple OpenAI endpoints: Completions, Chat, Edits, Embeddings, Audio, Files, Fine-tuning, Images, Moderations, Assistants
Gradle and Maven integration for easy dependency management
Includes an example project demonstrating usage
Open-source with permissive license (MIT)

Pros & Cons

Pros
  • Open-source and free to use (MIT license)
  • Modular architecture allows flexible use of API, client, or service components
  • Covers a broad range of OpenAI API endpoints
  • Well-documented with example code and Gradle/Maven setup instructions
  • Lightweight and easy to integrate into existing Java projects
Cons
  • Project is archived and no longer maintained as of June 2024
  • May not be compatible with the latest OpenAI API changes or deprecations
  • Requires manual forking and updates to stay current with OpenAI API evolution
  • Limited to Java ecosystem; no support for other languages
  • Depends on external libraries like Retrofit for HTTP communication

Best For

Integrating OpenAI language models into Java applicationsBuilding chatbots or conversational agents using ChatGPT/GPT-4Automating content generation, summarization, or translation tasksImplementing image generation or audio transcription via OpenAI APIsDeveloping fine-tuning pipelines for custom models

FAQ

Is OpenAI-Java still maintained?
Based on the repository notice, the project was archived on June 6, 2024, and is no longer maintained. The code remains available for forking and modification, but no further updates or support are provided.
What OpenAI APIs does this library support?
According to the repository, it supports Models, Completions, Chat Completions, Edits, Embeddings, Audio, Files, Fine-tuning, Images, Moderations, and Assistants. Some endpoints like Engines and Legacy Fine-Tunes are deprecated by OpenAI.
How do I add OpenAI-Java to my project?
You can add it via Gradle using 'implementation com.theokanning.openai-gpt3-java:{api|client|service}:version' or via Maven with the appropriate groupId, artifactId, and version. The exact version should be checked on the repository's releases page.
Does this library work with the latest OpenAI API?
The library may not be fully compatible with the latest OpenAI API changes due to its archived status. Users should verify compatibility and consider forking the project to apply updates as needed.
Is there any cost to use OpenAI-Java?
The library itself is open-source and free. However, using OpenAI's APIs through this library requires an OpenAI API key and may incur usage charges based on OpenAI's pricing.