@@ -4,6 +4,30 @@ works by wrapping HTTPS requests with java variables, making the generated resul
44
55Feel free to use, modify, and distribute this code as needed.
66
7+ # Installation
8+ For Gradle projects, add this to your ` build.gradle ` file in the dependencies block:
9+ ``` groovy
10+ dependencies {
11+ implementation 'com.cjcrafter:openai:1.0.0'
12+ }
13+ ```
14+ Or, if you are using Kotlin DSL (` build.gradle.kts ` ), add this to your dependencies block:
15+ ``` kotlin
16+ dependencies {
17+ implementation(" com.cjcrafter:openai:1.0.0" )
18+ }
19+ ```
20+ For Maven projects, add this to your ` pom.xml ` file in the ` <dependencies> ` block:
21+ ``` xml
22+ <dependency >
23+ <groupId >com.cjcrafter</groupId >
24+ <artifactId >openai</artifactId >
25+ <version >1.0.0</version >
26+ </dependency >
27+ ```
28+ See the [ maven repository] ( https://central.sonatype.com/artifact/com.cjcrafter/openai/1.0.0 ) for gradle/ant/etc.
29+
30+
731# Working Example
832``` java
933import java.io.IOException ;
@@ -41,43 +65,6 @@ public class Main {
4165}
4266```
4367
44- # Installation
45- 1 . Add [ okhttp] ( https://square.github.io/okhttp/ ) and [ gson] ( https://github.com/google/gson ) as dependencies (see below)
46- 2 . Drag and drop the [ ` ChatBot.java ` ] ( https://github.com/CJCrafter/ChatGPT-Java-API/blob/master/ChatBot.java ) file into your project
47-
48- Maven:
49- ``` xml
50- <dependencies >
51- <dependency >
52- <groupId >com.squareup.okhttp3</groupId >
53- <artifactId >okhttp</artifactId >
54- <version >4.9.2</version >
55- </dependency >
56- <dependency >
57- <groupId >com.google.code.gson</groupId >
58- <artifactId >gson</artifactId >
59- <version >2.8.9</version >
60- </dependency >
61- </dependencies >
62- ```
63-
64- Gradle KTS:
65- ``` gradle
66- repositories {
67- mavenCentral()
68- }
69-
70- dependencies {
71- implementation("com.squareup.okhttp3:okhttp:4.9.2")
72- implementation("com.google.code.gson:gson:2.8.9")
73- }
74- ```
75-
76- # More
77- 1 . I also wrote a [ Kotlin Version] ( ) of the API.
78- 2 . Need inspiration for prompts? Check out [ awesome prompts] ( https://github.com/f/awesome-chatgpt-prompts ) .
79- 3 . Looking for the official API? OpenAI only officially supports [ python] ( https://github.com/openai/openai-python ) .
80-
8168# Support
8269If I have saved you time, please consider [ sponsoring me] ( https://github.com/sponsors/CJCrafter ) .
8370If you cannot financially support me, consider leaving a star on the repository and sharing it. Thanks!
0 commit comments