@@ -4,6 +4,30 @@ works by wrapping HTTPS requests with java variables, making the generated resul
4
4
5
5
Feel free to use, modify, and distribute this code as needed.
6
6
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
+
7
31
# Working Example
8
32
``` java
9
33
import java.io.IOException ;
@@ -41,43 +65,6 @@ public class Main {
41
65
}
42
66
```
43
67
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
-
81
68
# Support
82
69
If I have saved you time, please consider [ sponsoring me] ( https://github.com/sponsors/CJCrafter ) .
83
70
If you cannot financially support me, consider leaving a star on the repository and sharing it. Thanks!
0 commit comments