Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 54483b5

Browse files
allow for v1/v2 endpoint changes in backend code
1 parent fc25791 commit 54483b5

File tree

1 file changed

+6
-3
lines changed
  • src/main/kotlin/com/cjcrafter/openai

1 file changed

+6
-3
lines changed

‎src/main/kotlin/com/cjcrafter/openai/OpenAI.kt‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class OpenAI @JvmOverloads constructor(
6464
val json = gson.toJson(request)
6565
val body: RequestBody = json.toRequestBody(mediaType)
6666
return Request.Builder()
67-
.url("https://api.openai.com/v1/$endpoint")
67+
.url("https://api.openai.com/$endpoint")
6868
.addHeader("Content-Type", "application/json")
6969
.addHeader("Authorization", "Bearer $apiKey")
7070
.apply { if (organization != null) addHeader("OpenAI-Organization", organization) }
@@ -386,8 +386,11 @@ class OpenAI @JvmOverloads constructor(
386386

387387
companion object {
388388

389-
const val COMPLETIONS_ENDPOINT = "completions"
390-
const val CHAT_ENDPOINT = "chat/completions"
389+
const val COMPLETIONS_ENDPOINT = "v1/completions"
390+
const val CHAT_ENDPOINT = "v1/chat/completions"
391+
const val IMAGE_CREATE_ENDPOINT = "v1/images/generations"
392+
const val IMAGE_EDIT_ENDPOINT = "v1/images/edits"
393+
const val IMAGE_VARIATION_ENDPOINT = "v1/images/variations"
391394

392395
/**
393396
* Returns a `Gson` object that can be used to read/write .json files.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /