Skip to content

A Java client for the ChatGPT API. ChatGPT 的一个 Java 客户端。

License

Notifications You must be signed in to change notification settings

LiLittleCat/ChatGPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT Java

Maven Central

A Java client for the ChatGPT API.

Change Log

1.0.3 - 2023-12-04

1.0.2 - 2023-04-24

  • Support message history

1.0.1

  • Support GPT-4
  • Add custom API host

1.0.0

  • Use official API with model gpt-3.5-turbo
  • Support proxy

0.1.0

  • Initial release
  • Use unofficial API

Download

Download the latest JAR or grab via Maven:

<dependency>
  <groupId>com.lilittlecat</groupId>
  <artifactId>chatgpt</artifactId>
  <version>1.0.2</version>
</dependency>

or Gradle:

implementation 'com.lilittlecat:chatgpt:1.0.2'

Usage

import com.lilittlecat.chatgpt.offical.ChatGPT;

public class Main {
   public static void main(String[] args) {
      ChatGPT chatGPT = new ChatGPT("YOUR API KEY");
      String hello = chatGPT.ask("hello");
      System.out.println(hello); // will be "\n\nHello! How may I assist you today?"
   }
}

More examples can be found in the test.

Happy coding

About

A Java client for the ChatGPT API. ChatGPT 的一个 Java 客户端。

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages