Skip to content

Commit b8fe68a

Browse files
release: 1.1.0 (#428)
* feat(client): support setting base URL via env var (#427) * release: 1.1.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 0917876 commit b8fe68a

36 files changed

+63
-69
lines changed

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.0.0"
2+
".": "1.1.0"
33
}

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 1.1.0 (2025-04-09)
4+
5+
Full Changelog: [v1.0.0...v1.1.0](https://github.com/openai/openai-java/compare/v1.0.0...v1.1.0)
6+
7+
### Features
8+
9+
* **client:** support setting base URL via env var ([#427](https://github.com/openai/openai-java/issues/427)) ([d462b34](https://github.com/openai/openai-java/commit/d462b3476e032ea02fa45c4afde19e1b62455224))
10+
311
## 1.0.0 (2025-04-09)
412

513
Full Changelog: [v0.45.0...v1.0.0](https://github.com/openai/openai-java/compare/v0.45.0...v1.0.0)

README.md

+17-16
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
<!-- x-release-please-start-version -->
44

5-
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/1.0.0)
6-
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/1.0.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/1.0.0)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/1.1.0)
6+
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/1.1.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/1.1.0)
77

88
<!-- x-release-please-end -->
99

1010
The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https://platform.openai.com/docs) from applications written in Java.
1111

1212
<!-- x-release-please-start-version -->
1313

14-
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/1.0.0).
14+
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/1.1.0).
1515

1616
<!-- x-release-please-end -->
1717

@@ -22,7 +22,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor
2222
### Gradle
2323

2424
```kotlin
25-
implementation("com.openai:openai-java:1.0.0")
25+
implementation("com.openai:openai-java:1.1.0")
2626
```
2727

2828
### Maven
@@ -31,7 +31,7 @@ implementation("com.openai:openai-java:1.0.0")
3131
<dependency>
3232
<groupId>com.openai</groupId>
3333
<artifactId>openai-java</artifactId>
34-
<version>1.0.0</version>
34+
<version>1.1.0</version>
3535
</dependency>
3636
```
3737

@@ -73,7 +73,7 @@ import com.openai.models.ChatModel;
7373
import com.openai.models.chat.completions.ChatCompletion;
7474
import com.openai.models.chat.completions.ChatCompletionCreateParams;
7575

76-
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` environment variables
76+
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID`, `OPENAI_PROJECT_ID` and `OPENAI_BASE_URL` environment variables
7777
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
7878

7979
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
@@ -91,7 +91,7 @@ Configure the client using environment variables:
9191
import com.openai.client.OpenAIClient;
9292
import com.openai.client.okhttp.OpenAIOkHttpClient;
9393

94-
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` environment variables
94+
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID`, `OPENAI_PROJECT_ID` and `OPENAI_BASE_URL` environment variables
9595
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
9696
```
9797

@@ -113,19 +113,20 @@ import com.openai.client.OpenAIClient;
113113
import com.openai.client.okhttp.OpenAIOkHttpClient;
114114

115115
OpenAIClient client = OpenAIOkHttpClient.builder()
116-
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` environment variables
116+
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID`, `OPENAI_PROJECT_ID` and `OPENAI_BASE_URL` environment variables
117117
.fromEnv()
118118
.apiKey("My API Key")
119119
.build();
120120
```
121121

122122
See this table for the available options:
123123

124-
| Setter | Environment variable | Required | Default value |
125-
| -------------- | -------------------- | -------- | ------------- |
126-
| `apiKey` | `OPENAI_API_KEY` | true | - |
127-
| `organization` | `OPENAI_ORG_ID` | false | - |
128-
| `project` | `OPENAI_PROJECT_ID` | false | - |
124+
| Setter | Environment variable | Required | Default value |
125+
| -------------- | -------------------- | -------- | ----------------------------- |
126+
| `apiKey` | `OPENAI_API_KEY` | true | - |
127+
| `organization` | `OPENAI_ORG_ID` | false | - |
128+
| `project` | `OPENAI_PROJECT_ID` | false | - |
129+
| `baseUrl` | `OPENAI_BASE_URL` | true | `"https://api.openai.com/v1"` |
129130

130131
> [!TIP]
131132
> Don't create more than one client in the same application. Each client has a connection pool and
@@ -157,7 +158,7 @@ import com.openai.models.chat.completions.ChatCompletion;
157158
import com.openai.models.chat.completions.ChatCompletionCreateParams;
158159
import java.util.concurrent.CompletableFuture;
159160

160-
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` environment variables
161+
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID`, `OPENAI_PROJECT_ID` and `OPENAI_BASE_URL` environment variables
161162
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
162163

163164
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
@@ -177,7 +178,7 @@ import com.openai.models.chat.completions.ChatCompletion;
177178
import com.openai.models.chat.completions.ChatCompletionCreateParams;
178179
import java.util.concurrent.CompletableFuture;
179180

180-
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` environment variables
181+
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID`, `OPENAI_PROJECT_ID` and `OPENAI_BASE_URL` environment variables
181182
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
182183

183184
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
@@ -600,7 +601,7 @@ OpenAI client builder but with the Azure-specific configuration.
600601

601602
```java
602603
OpenAIClient client = OpenAIOkHttpClient.builder()
603-
// Gets the API key from the `AZURE_OPENAI_KEY` environment variable
604+
// Gets the API key and endpoint from the `AZURE_OPENAI_KEY` and `OPENAI_BASE_URL` environment variables, respectively
604605
.fromEnv()
605606
// Set the Azure Entra ID
606607
.credential(BearerTokenCredential.create(AuthenticationUtil.getBearerTokenSupplier(

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88

99
allprojects {
1010
group = "com.openai"
11-
version = "1.0.0" // x-release-please-version
11+
version = "1.1.0" // x-release-please-version
1212
}
1313

1414
subprojects {

openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt

+2-6
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@ class OpenAIOkHttpClient private constructor() {
3232
class Builder internal constructor() {
3333

3434
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
35-
private var baseUrl: String = ClientOptions.PRODUCTION_URL
3635
private var timeout: Timeout = Timeout.default()
3736
private var proxy: Proxy? = null
3837

39-
fun baseUrl(baseUrl: String) = apply {
40-
clientOptions.baseUrl(baseUrl)
41-
this.baseUrl = baseUrl
42-
}
38+
fun baseUrl(baseUrl: String) = apply { clientOptions.baseUrl(baseUrl) }
4339

4440
/**
4541
* Whether to throw an exception if any of the Jackson versions detected at runtime are
@@ -192,7 +188,7 @@ class OpenAIOkHttpClient private constructor() {
192188
clientOptions
193189
.httpClient(
194190
OkHttpClient.builder()
195-
.baseUrl(baseUrl)
191+
.baseUrl(clientOptions.baseUrl())
196192
.timeout(timeout)
197193
.proxy(proxy)
198194
.build()

openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt

+2-6
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@ class OpenAIOkHttpClientAsync private constructor() {
3232
class Builder internal constructor() {
3333

3434
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
35-
private var baseUrl: String = ClientOptions.PRODUCTION_URL
3635
private var timeout: Timeout = Timeout.default()
3736
private var proxy: Proxy? = null
3837

39-
fun baseUrl(baseUrl: String) = apply {
40-
clientOptions.baseUrl(baseUrl)
41-
this.baseUrl = baseUrl
42-
}
38+
fun baseUrl(baseUrl: String) = apply { clientOptions.baseUrl(baseUrl) }
4339

4440
/**
4541
* Whether to throw an exception if any of the Jackson versions detected at runtime are
@@ -192,7 +188,7 @@ class OpenAIOkHttpClientAsync private constructor() {
192188
clientOptions
193189
.httpClient(
194190
OkHttpClient.builder()
195-
.baseUrl(baseUrl)
191+
.baseUrl(clientOptions.baseUrl())
196192
.timeout(timeout)
197193
.proxy(proxy)
198194
.build()

openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt

+3-10
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,14 @@ private constructor(
232232

233233
fun removeAllQueryParams(keys: Set<String>) = apply { queryParams.removeAll(keys) }
234234

235+
fun baseUrl(): String = baseUrl
236+
235237
fun fromEnv() = apply {
238+
System.getenv("OPENAI_BASE_URL")?.let { baseUrl(it) }
236239
val openAIKey = System.getenv("OPENAI_API_KEY")
237240
val openAIOrgId = System.getenv("OPENAI_ORG_ID")
238241
val openAIProjectId = System.getenv("OPENAI_PROJECT_ID")
239242
val azureOpenAIKey = System.getenv("AZURE_OPENAI_KEY")
240-
val azureEndpoint = System.getenv("AZURE_OPENAI_ENDPOINT")
241243

242244
when {
243245
!openAIKey.isNullOrEmpty() && !azureOpenAIKey.isNullOrEmpty() -> {
@@ -252,15 +254,6 @@ private constructor(
252254
}
253255
!azureOpenAIKey.isNullOrEmpty() -> {
254256
credential(AzureApiKeyCredential.create(azureOpenAIKey))
255-
baseUrl(azureEndpoint)
256-
}
257-
!azureEndpoint.isNullOrEmpty() -> {
258-
// Both 'openAIKey' and 'azureOpenAIKey' are not set.
259-
// Only 'azureEndpoint' is set here, and user still needs to call method
260-
// '.credential(BearerTokenCredential(Supplier<String>))'
261-
// to get the token through the supplier, which requires Azure Entra ID as a
262-
// dependency.
263-
baseUrl(azureEndpoint)
264257
}
265258
}
266259
}

openai-java-example/src/main/java/com/openai/example/AssistantAsyncExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private AssistantAsyncExample() {}
2323
public static void main(String[] args) {
2424
// Configures using one of:
2525
// - The `OPENAI_API_KEY` environment variable
26-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
26+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
2727
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
2828

2929
CompletableFuture<Assistant> assistantFuture = client.beta()

openai-java-example/src/main/java/com/openai/example/AssistantExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private AssistantExample() {}
1919
public static void main(String[] args) throws Exception {
2020
// Configures using one of:
2121
// - The `OPENAI_API_KEY` environment variable
22-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
22+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
2323
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
2424

2525
Assistant assistant = client.beta()

openai-java-example/src/main/java/com/openai/example/AudioTranscriptionsAsyncExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private AudioTranscriptionsAsyncExample() {}
1313
public static void main(String[] args) throws Exception {
1414
// Configures using one of:
1515
// - The `OPENAI_API_KEY` environment variable
16-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
16+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1717
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
1818

1919
ClassLoader classloader = Thread.currentThread().getContextClassLoader();

openai-java-example/src/main/java/com/openai/example/AudioTranscriptionsExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private AudioTranscriptionsExample() {}
1414
public static void main(String[] args) throws Exception {
1515
// Configures using one of:
1616
// - The `OPENAI_API_KEY` environment variable
17-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
17+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1818
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
1919

2020
ClassLoader classloader = Thread.currentThread().getContextClassLoader();

openai-java-example/src/main/java/com/openai/example/CompletionsAsyncExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private CompletionsAsyncExample() {}
1111
public static void main(String[] args) {
1212
// Configures using one of:
1313
// - The `OPENAI_API_KEY` environment variable
14-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
14+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1515
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
1616

1717
ChatCompletionCreateParams createParams = ChatCompletionCreateParams.builder()

openai-java-example/src/main/java/com/openai/example/CompletionsConversationAsyncExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private CompletionsConversationAsyncExample() {}
1717
public static void main(String[] args) {
1818
// Configures using one of:
1919
// - The `OPENAI_API_KEY` environment variable
20-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
20+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
2121
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
2222

2323
// Use a builder so that we can append more messages to it below.

openai-java-example/src/main/java/com/openai/example/CompletionsConversationExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ private CompletionsConversationExample() {}
1616
public static void main(String[] args) {
1717
// Configures using one of:
1818
// - The `OPENAI_API_KEY` environment variable
19-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
19+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
2020
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
2121

2222
// Use a builder so that we can append more messages to it below.

openai-java-example/src/main/java/com/openai/example/CompletionsExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private CompletionsExample() {}
1111
public static void main(String[] args) {
1212
// Configures using one of:
1313
// - The `OPENAI_API_KEY` environment variable
14-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
14+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1515
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
1616

1717
ChatCompletionCreateParams createParams = ChatCompletionCreateParams.builder()

openai-java-example/src/main/java/com/openai/example/CompletionsImageUrlExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ private CompletionsImageUrlExample() {}
1818
public static void main(String[] args) throws URISyntaxException, InterruptedException, IOException {
1919
// Configures using one of:
2020
// - The `OPENAI_API_KEY` environment variable
21-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
21+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
2222
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
2323

2424
ClassLoader classloader = Thread.currentThread().getContextClassLoader();

openai-java-example/src/main/java/com/openai/example/CompletionsStreamingAsyncExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private CompletionsStreamingAsyncExample() {}
1111
public static void main(String[] args) {
1212
// Configures using one of:
1313
// - The `OPENAI_API_KEY` environment variable
14-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
14+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1515
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
1616

1717
ChatCompletionCreateParams createParams = ChatCompletionCreateParams.builder()

openai-java-example/src/main/java/com/openai/example/CompletionsStreamingCancellationAsyncExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private CompletionsStreamingCancellationAsyncExample() {}
1313
public static void main(String[] args) {
1414
// Configures using one of:
1515
// - The `OPENAI_API_KEY` environment variable
16-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
16+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1717
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
1818

1919
ChatCompletionCreateParams createParams = ChatCompletionCreateParams.builder()

openai-java-example/src/main/java/com/openai/example/CompletionsStreamingCancellationExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private CompletionsStreamingCancellationExample() {}
1313
public static void main(String[] args) {
1414
// Configures using one of:
1515
// - The `OPENAI_API_KEY` environment variable
16-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
16+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1717
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
1818

1919
ChatCompletionCreateParams createParams = ChatCompletionCreateParams.builder()

openai-java-example/src/main/java/com/openai/example/CompletionsStreamingExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private CompletionsStreamingExample() {}
1313
public static void main(String[] args) {
1414
// Configures using one of:
1515
// - The `OPENAI_API_KEY` environment variable
16-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
16+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1717
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
1818

1919
ChatCompletionCreateParams createParams = ChatCompletionCreateParams.builder()

openai-java-example/src/main/java/com/openai/example/EmbeddingsAsyncExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private EmbeddingsAsyncExample() {}
1111
public static void main(String[] args) {
1212
// Configures using one of:
1313
// - The `OPENAI_API_KEY` environment variable
14-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
14+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1515
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
1616

1717
EmbeddingCreateParams createParams = EmbeddingCreateParams.builder()

openai-java-example/src/main/java/com/openai/example/EmbeddingsExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private EmbeddingsExample() {}
1111
public static void main(String[] args) {
1212
// Configures using one of:
1313
// - The `OPENAI_API_KEY` environment variable
14-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
14+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1515
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
1616

1717
EmbeddingCreateParams createParams = EmbeddingCreateParams.builder()

openai-java-example/src/main/java/com/openai/example/FunctionCallingAsyncExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private FunctionCallingAsyncExample() {}
2121
public static void main(String[] args) {
2222
// Configures using one of:
2323
// - The `OPENAI_API_KEY` environment variable
24-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
24+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
2525
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
2626

2727
ChatCompletionCreateParams.Builder createParamsBuilder = ChatCompletionCreateParams.builder()

openai-java-example/src/main/java/com/openai/example/FunctionCallingExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private FunctionCallingExample() {}
2121
public static void main(String[] args) {
2222
// Configures using one of:
2323
// - The `OPENAI_API_KEY` environment variable
24-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
24+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
2525
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
2626

2727
// Use a builder so that we can append more messages to it below.

openai-java-example/src/main/java/com/openai/example/ModelListAsyncExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private ModelListAsyncExample() {}
1111
public static void main(String[] args) {
1212
// Configures using one of:
1313
// - The `OPENAI_API_KEY` environment variable
14-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
14+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1515
OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();
1616

1717
CompletableFuture<ModelListPageAsync> pageFuture = client.models().list();

openai-java-example/src/main/java/com/openai/example/ModelListExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private ModelListExample() {}
99
public static void main(String[] args) {
1010
// Configures using one of:
1111
// - The `OPENAI_API_KEY` environment variable
12-
// - The `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY` environment variables
12+
// - The `OPENAI_BASE_URL` and `AZURE_OPENAI_KEY` environment variables
1313
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
1414

1515
client.models().list().autoPager().forEach(model -> System.out.println(model.id()));

0 commit comments

Comments
 (0)