chatgpt-java  by Grt1228

Java SDK for OpenAI APIs

created 2 years ago
3,453 stars

Top 14.3% on sourcepulse

GitHubView on GitHub
Project Summary

This Java SDK provides a comprehensive client for interacting with OpenAI's official APIs, targeting developers who need to integrate advanced AI capabilities like GPT-3.5/4, DALL-E 3, and TTS into their Java applications. It offers support for streaming output, GPT plugins, and network connectivity, simplifying the process of leveraging OpenAI's models.

How It Works

The SDK utilizes OkHttpClient for network requests, allowing for extensive customization of clients, including proxy settings, timeouts, and interceptors. It supports both standard and streaming API responses through OpenAiClient and OpenAiStreamClient respectively. Key features include dynamic API key management, token calculation (via tiktoken-java), and robust error handling for API key issues.

Quick Start & Requirements

Highlighted Details

  • Supports streaming output via SSE and WebSocket.
  • Implements GPT plugin functionality and tool calls.
  • Includes features for DALL-E 3 image generation and text-to-speech (TTS).
  • Offers dynamic API key management and custom key retrieval strategies.
  • Provides token calculation utilities.

Maintenance & Community

The project is community-maintained. Further community interaction and support can be found via the linked WeChat public account (chatgpt-java).

Licensing & Compatibility

The project is licensed under the Apache License 2.0, permitting commercial use and integration with closed-source applications.

Limitations & Caveats

The project is described as "unofficial" and community-maintained, implying potential for bugs or breaking changes. While it supports various OpenAI models, users should verify compatibility with the latest API versions.

Feedback? Help us improve.