# ChatGPT4J
ChatGPT Java SDK. Official OpenAI API.
[![Maven Central](https://img.shields.io/maven-central/v/io.github.aminovmaksim/chatgpt4j)](https://maven-badges.herokuapp.com/maven-central/io.github.aminovmaksim/chatgpt4j)
---
### How to install
#### Maven
```xml
<dependency>
<groupId>io.github.aminovmaksim</groupId>
<artifactId>chatgpt4j</artifactId>
<version>1.0.3</version>
</dependency>
```
#### Gradle
```groovy
implementation 'io.github.aminovmaksim:chatgpt4j:1.0.3'
```
---
## How to use
- Initialize the client
```java
ChatGPTClient client = ChatGPTClient.builder()
.apiKey("YOUR_KEY")
.requestTimeout(30000L) // optional, default is 60000 ms
.baseUrl("https://api.openai.com/v1") // optional
.build();
```
You can get your api key [here](https://platform.openai.com/account/api-keys)
- Send a message
```java
ChatRequest request = new ChatRequest("Write an essay about AI revolution");
request.setModel(ModelType.GPT_3_5_TURBO.getName());
ChatResponse response = client.sendChat(request);
System.out.println(response.getChoices().get(0).getMessage().getContent());
```
---
### GPT-4
Join waitlist [here](https://openai.com/waitlist/gpt-4-api)
---
## Disclaimers
Project currently in develop, feel free to contact me [@aminovmaksim](https://github.com/aminovmaksim)
没有合适的资源?快使用搜索试试~ 我知道了~
ChatGPT4J ChatGPT Java SDK. Official OpenAI API
共13个文件
java:8个
xml:1个
md:1个
需积分: 0 0 下载量 181 浏览量
2024-05-15
21:10:05
上传
评论
收藏 12KB ZIP 举报
温馨提示
How to install Maven <dependency> <groupId>io.github.aminovmaksim</groupId> <artifactId>chatgpt4j</artifactId> <version>1.0.3</version> </dependency> How to use Initialize the client ChatGPTClient client = ChatGPTClient.builder() .apiKey("YOUR_KEY") .requestTimeout(30000L) // optional, default is 60000 ms .baseUrl("https://api.openai.com/v1") // optional .build();
资源推荐
资源详情
资源评论
收起资源包目录
ChatGPT4J-main.zip (13个子文件)
ChatGPT4J-main
pom.xml 8KB
.java-version 4B
src
test
java
io
github
aminovmaksim
chatgpt4j
ClientTest.java 1023B
main
java
io
github
aminovmaksim
chatgpt4j
ChatGPTClientException.java 191B
model
ChatMessage.java 438B
ChatRequest.java 2KB
ChatResponse.java 1KB
enums
MessageRole.java 310B
ModelType.java 340B
ChatGPTClient.java 3KB
LICENSE 1KB
.gitignore 284B
README.md 1KB
共 13 条
- 1
资源评论
胖子开发工程师
- 粉丝: 84
- 资源: 40
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2023-04-06-项目笔记 - 第一百五十四阶段 - 4.4.2.152全局变量的作用域-152 -2024.06.04
- 松哥解协议松哥解协议松哥解协议松哥解协议松哥解协议
- 618节日618节日618节日
- tensorflow-gpu-2.9.1-cp37-cp37m-win-amd64.whl
- tensorflow-gpu-2.9.0-cp37-cp37m-win-amd64.whl
- tensorflow-gpu-2.9.0-cp39-cp39-win-amd64.whl
- lcd daimalcd daima
- 电影领域-推荐算法-个性化内容-观影决策-电影推荐小程序.zip
- 电气控制PLC考试题库
- 如何使用MATLAB简介
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功