Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.10.0"
".": "4.11.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 136
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-88d85ff87ad8983262af2b729762a6e05fd509468bb691529bc2f81e4ce27c69.yml
openapi_spec_hash: 46a55acbccd0147534017b92c1f4dd99
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-41f98da99f44ebe6204fce5c1dc9940f85f3472779e797b674c4fdc20306c77d.yml
openapi_spec_hash: c61259027f421f501bdc6b23cf9e430e
config_hash: 141b101c9f13b90e21af74e1686f1f41
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 4.11.0 (2025-12-12)

Full Changelog: [v4.10.0...v4.11.0](https://github.com/openai/openai-java/compare/v4.10.0...v4.11.0)

### Features

* **api:** gpt 5.2 ([de55bd3](https://github.com/openai/openai-java/commit/de55bd3ecfcf1c325a6908b8521b4fc06ed6fc7c))

## 4.10.0 (2025-12-10)

Full Changelog: [v4.9.0...v4.10.0](https://github.com/openai/openai-java/compare/v4.9.0...v4.10.0)
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

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

[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.10.0)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.10.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.10.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.11.0)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.11.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.11.0)

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

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

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

The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.10.0).
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.11.0).

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

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

```kotlin
implementation("com.openai:openai-java:4.10.0")
implementation("com.openai:openai-java:4.11.0")
```

### Maven
Expand All @@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.10.0")
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java</artifactId>
<version>4.10.0</version>
<version>4.11.0</version>
</dependency>
```

Expand Down Expand Up @@ -82,7 +82,7 @@ OpenAIClient client = OpenAIOkHttpClient.fromEnv();

ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.addUserMessage("Say this is a test")
.model(ChatModel.GPT_5_1)
.model(ChatModel.GPT_5_2)
.build();
ChatCompletion chatCompletion = client.chat().completions().create(params);
```
Expand Down Expand Up @@ -188,7 +188,7 @@ OpenAIClient client = OpenAIOkHttpClient.fromEnv();

ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.addUserMessage("Say this is a test")
.model(ChatModel.GPT_5_1)
.model(ChatModel.GPT_5_2)
.build();
CompletableFuture<ChatCompletion> chatCompletion = client.async().chat().completions().create(params);
```
Expand All @@ -209,7 +209,7 @@ OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv();

ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.addUserMessage("Say this is a test")
.model(ChatModel.GPT_5_1)
.model(ChatModel.GPT_5_2)
.build();
CompletableFuture<ChatCompletion> chatCompletion = client.chat().completions().create(params);
```
Expand Down Expand Up @@ -1143,7 +1143,7 @@ import com.openai.models.chat.completions.ChatCompletionCreateParams;

ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.addUserMessage("Say this is a test")
.model(ChatModel.GPT_5_1)
.model(ChatModel.GPT_5_2)
.build();
HttpResponseFor<ChatCompletion> chatCompletion = client.chat().completions().withRawResponse().create(params);

Expand Down Expand Up @@ -1342,7 +1342,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht
#### Gradle

```kotlin
implementation("com.openai:openai-java-spring-boot-starter:4.10.0")
implementation("com.openai:openai-java-spring-boot-starter:4.11.0")
```

#### Maven
Expand All @@ -1351,7 +1351,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.10.0")
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java-spring-boot-starter</artifactId>
<version>4.10.0</version>
<version>4.11.0</version>
</dependency>
```

Expand Down Expand Up @@ -1616,7 +1616,7 @@ import com.openai.models.chat.completions.ChatCompletionCreateParams;

ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.messages(JsonValue.from(42))
.model(ChatModel.GPT_5_1)
.model(ChatModel.GPT_5_2)
.build();
```

Expand Down Expand Up @@ -1669,7 +1669,7 @@ import com.openai.models.ChatModel;
import com.openai.models.chat.completions.ChatCompletionCreateParams;

ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.model(ChatModel.GPT_5_1)
.model(ChatModel.GPT_5_2)
.messages(JsonMissing.of())
.build();
```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "com.openai"
version = "4.10.0" // x-release-please-version
version = "4.11.0" // x-release-please-version
}

subprojects {
Expand Down
30 changes: 30 additions & 0 deletions openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ class ChatModel @JsonCreator private constructor(private val value: JsonField<St

companion object {

@JvmField val GPT_5_2 = of("gpt-5.2")

@JvmField val GPT_5_2_2025_12_11 = of("gpt-5.2-2025-12-11")

@JvmField val GPT_5_2_CHAT_LATEST = of("gpt-5.2-chat-latest")

@JvmField val GPT_5_2_PRO = of("gpt-5.2-pro")

@JvmField val GPT_5_2_PRO_2025_12_11 = of("gpt-5.2-pro-2025-12-11")

@JvmField val GPT_5_1 = of("gpt-5.1")

@JvmField val GPT_5_1_2025_11_13 = of("gpt-5.1-2025-11-13")
Expand Down Expand Up @@ -161,6 +171,11 @@ class ChatModel @JsonCreator private constructor(private val value: JsonField<St

/** An enum containing [ChatModel]'s known values. */
enum class Known {
GPT_5_2,
GPT_5_2_2025_12_11,
GPT_5_2_CHAT_LATEST,
GPT_5_2_PRO,
GPT_5_2_PRO_2025_12_11,
GPT_5_1,
GPT_5_1_2025_11_13,
GPT_5_1_CODEX,
Expand Down Expand Up @@ -240,6 +255,11 @@ class ChatModel @JsonCreator private constructor(private val value: JsonField<St
* - It was constructed with an arbitrary value using the [of] method.
*/
enum class Value {
GPT_5_2,
GPT_5_2_2025_12_11,
GPT_5_2_CHAT_LATEST,
GPT_5_2_PRO,
GPT_5_2_PRO_2025_12_11,
GPT_5_1,
GPT_5_1_2025_11_13,
GPT_5_1_CODEX,
Expand Down Expand Up @@ -320,6 +340,11 @@ class ChatModel @JsonCreator private constructor(private val value: JsonField<St
*/
fun value(): Value =
when (this) {
GPT_5_2 -> Value.GPT_5_2
GPT_5_2_2025_12_11 -> Value.GPT_5_2_2025_12_11
GPT_5_2_CHAT_LATEST -> Value.GPT_5_2_CHAT_LATEST
GPT_5_2_PRO -> Value.GPT_5_2_PRO
GPT_5_2_PRO_2025_12_11 -> Value.GPT_5_2_PRO_2025_12_11
GPT_5_1 -> Value.GPT_5_1
GPT_5_1_2025_11_13 -> Value.GPT_5_1_2025_11_13
GPT_5_1_CODEX -> Value.GPT_5_1_CODEX
Expand Down Expand Up @@ -400,6 +425,11 @@ class ChatModel @JsonCreator private constructor(private val value: JsonField<St
*/
fun known(): Known =
when (this) {
GPT_5_2 -> Known.GPT_5_2
GPT_5_2_2025_12_11 -> Known.GPT_5_2_2025_12_11
GPT_5_2_CHAT_LATEST -> Known.GPT_5_2_CHAT_LATEST
GPT_5_2_PRO -> Known.GPT_5_2_PRO
GPT_5_2_PRO_2025_12_11 -> Known.GPT_5_2_PRO_2025_12_11
GPT_5_1 -> Known.GPT_5_1
GPT_5_1_2025_11_13 -> Known.GPT_5_1_2025_11_13
GPT_5_1_CODEX -> Known.GPT_5_1_CODEX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand All @@ -77,7 +77,8 @@ private constructor(
* A summary of the reasoning performed by the model. This can be useful for debugging and
* understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.
*
* `concise` is only supported for `computer-use-preview` models.
* `concise` is supported for `computer-use-preview` models and all reasoning models after
* `gpt-5`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -154,7 +155,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*/
fun effort(effort: ReasoningEffort?) = effort(JsonField.ofNullable(effort))

Expand Down Expand Up @@ -201,7 +202,8 @@ private constructor(
* A summary of the reasoning performed by the model. This can be useful for debugging and
* understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.
*
* `concise` is only supported for `computer-use-preview` models.
* `concise` is supported for `computer-use-preview` models and all reasoning models after
* `gpt-5`.
*/
fun summary(summary: Summary?) = summary(JsonField.ofNullable(summary))

Expand Down Expand Up @@ -422,7 +424,8 @@ private constructor(
* A summary of the reasoning performed by the model. This can be useful for debugging and
* understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.
*
* `concise` is only supported for `computer-use-preview` models.
* `concise` is supported for `computer-use-preview` models and all reasoning models after
* `gpt-5`.
*/
class Summary @JsonCreator private constructor(private val value: JsonField<String>) : Enum {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.openai.errors.OpenAIInvalidDataException
* reasoning values in gpt-5.1.
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*/
class ReasoningEffort @JsonCreator private constructor(private val value: JsonField<String>) :
Enum {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -413,7 +413,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*/
fun reasoningEffort(reasoningEffort: ReasoningEffort?) = apply {
body.reasoningEffort(reasoningEffort)
Expand Down Expand Up @@ -883,7 +883,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -1222,7 +1222,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
* support `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*/
fun reasoningEffort(reasoningEffort: ReasoningEffort?) =
reasoningEffort(JsonField.ofNullable(reasoningEffort))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -407,7 +407,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*/
fun reasoningEffort(reasoningEffort: ReasoningEffort?) = apply {
body.reasoningEffort(reasoningEffort)
Expand Down Expand Up @@ -877,7 +877,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -1209,7 +1209,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
* support `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*/
fun reasoningEffort(reasoningEffort: ReasoningEffort?) =
reasoningEffort(JsonField.ofNullable(reasoningEffort))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -702,7 +702,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*/
fun reasoningEffort(reasoningEffort: ReasoningEffort?) = apply {
body.reasoningEffort(reasoningEffort)
Expand Down Expand Up @@ -1302,7 +1302,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support
* `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -1852,7 +1852,7 @@ private constructor(
* - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
* support `none`.
* - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
* - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
* - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
*/
fun reasoningEffort(reasoningEffort: ReasoningEffort?) =
reasoningEffort(JsonField.ofNullable(reasoningEffort))
Expand Down
Loading