# ChatGPT Java
[![Maven Central](https://img.shields.io/maven-central/v/com.lilittlecat/chatgpt?style=for-the-badge)](https://central.sonatype.com/artifact/com.lilittlecat/chatgpt/1.0.0)
A Java client for the [ChatGPT API](https://platform.openai.com/docs/guides/chat).
## Change Log
### 1.0.2
- 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](https://search.maven.org/remote_content?g=com.lilittlecat&a=chatgpt&v=LATEST) or grab via [Maven](https://central.sonatype.dev/artifact/com.lilittlecat/chatgpt/1.0.0):
```xml
<dependency>
<groupId>com.lilittlecat</groupId>
<artifactId>chatgpt</artifactId>
<version>1.0.1</version>
</dependency>
```
or Gradle:
```groovy
implementation 'com.lilittlecat:chatgpt:1.0.1'
```
## Usage
```java
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](./src/test/java/ChatGPTTest.java).
## Happy coding
没有合适的资源?快使用搜索试试~ 我知道了~
ChatGPT Java
需积分: 5 3 下载量 176 浏览量
2023-07-16
15:20:39
上传
评论
收藏 214KB GZ 举报
温馨提示
共17个文件
java:11个
xml:1个
gitignore:1个
A Java client for the ChatGPT API ChatGPT Java is a Java client for the ChatGPT API. Use official API with model gpt-3.5-turbo.
资源推荐
资源详情
资源评论
收起资源包目录
v1.0.2.tar.gz (17个子文件)
LiLittleCat-ChatGPT-fba1a39
media
session-token.png 207KB
pom.xml 9KB
.github
workflows
maven-publish.yml 1KB
src
test
java
ChatGPTTest.java 2KB
main
java
com
lilittlecat
chatgpt
unoffical
UnofficialChatGPT.java 7KB
OpenAi.java 14KB
offical
ChatGPT.java 7KB
entity
Message.java 447B
ChatCompletionRequestBody.java 5KB
Model.java 788B
Constant.java 666B
ChatCompletionResponseBody.java 2KB
exception
BizException.java 579B
Error.java 1KB
LICENSE 1KB
.gitignore 499B
README.md 1KB
共 17 条
- 1
资源评论
xuanwenchao
- 粉丝: 1927
- 资源: 68
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功