chatgpt-java  by PlexPt

Java SDK for ChatGPT API integration

created 2 years ago
3,635 stars

Top 13.6% on sourcepulse

GitHubView on GitHub
Project Summary

This Java SDK provides a straightforward way for developers to integrate with OpenAI's ChatGPT API, supporting models like GPT-3.5, GPT-4, and GPT-4o. It's designed for ease of use, enabling quick implementation of AI-powered features in Java applications, including support for function calling and streaming responses.

How It Works

The SDK leverages standard HTTP client libraries to interact with the OpenAI API. It abstracts the complexities of request formatting, response parsing, and error handling. Key features include support for streaming responses via a ChatGPTStream class and a ConsoleStreamListener for real-time output, as well as robust handling of function calls with detailed parameter definitions. The design prioritizes a fluent builder pattern for easy configuration of API keys, proxies, and timeouts.

Quick Start & Requirements

  • Install: Maven dependency: com.github.plexpt:chatgpt:6.0.0.
  • Prerequisites: Java Development Kit (JDK).
  • Setup: Minimal setup required, primarily configuring API keys and optional proxy settings.
  • Docs: Demo

Highlighted Details

  • Supports GPT-3.5, GPT-4, GPT-4o, and GPT-4o-mini.
  • Implements function calling, streaming responses, and context management.
  • Offers multi-key rotation and proxy support for regional access.
  • Includes token counting utility.

Maintenance & Community

  • Active development with version 6.0.0.
  • QQ Group: 645132635.

Licensing & Compatibility

  • License: Not explicitly stated in the README.
  • Compatibility: Designed for Java applications. Usage in certain regions is restricted by OpenAI.

Limitations & Caveats

The README notes that using proxies carries some risk of account suspension. Access is restricted from specific countries, including China (and its territories), Russia, and others. Users without foreign credit cards may face difficulties with OpenAI account top-ups.

Health Check
Last commit

7 months ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
12 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.