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.5.0"
".": "4.6.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 134
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f59befea071ed7729cbb7bce219e7f837eccfdb57e01698514e6a0bd6052ff60.yml
openapi_spec_hash: 49da48619d37932b2e257c532078b2bb
config_hash: 1af83449a09a3b4f276444dbcdd3eb67
configured_endpoints: 135
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-812a10f8fb54c584efc914422b574cb3f43dc238b5733b13f6a0b2308b7d9910.yml
openapi_spec_hash: 0222041ba12a5ff6b94924a834fa91a2
config_hash: 50ee3382a63c021a9f821a935950e926
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 4.6.0 (2025-10-20)

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

### Features

* **api:** Add responses.input_tokens.count ([4cc3097](https://github.com/openai/openai-java/commit/4cc3097bbcc97071d41ba46d114ac24045e7e1f0))


### Bug Fixes

* **api:** internal openapi updates ([faead94](https://github.com/openai/openai-java/commit/faead94dc548f0ae623c6a132b84459d7fb4bb23))

## 4.5.0 (2025-10-17)

Full Changelog: [v4.4.0...v4.5.0](https://github.com/openai/openai-java/compare/v4.4.0...v4.5.0)
Expand Down
14 changes: 7 additions & 7 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.5.0)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.5.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.5.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.6.0)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.6.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.6.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.5.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.6.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.5.0")
implementation("com.openai:openai-java:4.6.0")
```

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

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.5.0")
implementation("com.openai:openai-java-spring-boot-starter:4.6.0")
```

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

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.5.0" // x-release-please-version
version = "4.6.0" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,16 @@ private constructor(
private val _json: JsonValue? = null,
) {

/** Unconstrained free-form text. */
fun text(): Optional<JsonValue> = Optional.ofNullable(text)

/** A grammar defined by the user. */
fun grammar(): Optional<Grammar> = Optional.ofNullable(grammar)

fun isText(): Boolean = text != null

fun isGrammar(): Boolean = grammar != null

/** Unconstrained free-form text. */
fun asText(): JsonValue = text.getOrThrow("text")

/** A grammar defined by the user. */
fun asGrammar(): Grammar = grammar.getOrThrow("grammar")

fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
Expand Down Expand Up @@ -134,11 +130,9 @@ private constructor(

companion object {

/** Unconstrained free-form text. */
@JvmStatic
fun ofText() = CustomToolInputFormat(text = JsonValue.from(mapOf("type" to "text")))

/** A grammar defined by the user. */
@JvmStatic fun ofGrammar(grammar: Grammar) = CustomToolInputFormat(grammar = grammar)
}

Expand All @@ -148,10 +142,8 @@ private constructor(
*/
interface Visitor<out T> {

/** Unconstrained free-form text. */
fun visitText(text: JsonValue): T

/** A grammar defined by the user. */
fun visitGrammar(grammar: Grammar): T

/**
Expand Down Expand Up @@ -210,7 +202,6 @@ private constructor(
}
}

/** A grammar defined by the user. */
class Grammar
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ private constructor(
fun background(): Optional<Background> = body.background()

/**
* Control how much effort the model will exert to match the style and features, especially
* facial features, of input images. This parameter is only supported for `gpt-image-1`.
* Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -431,9 +429,7 @@ private constructor(
}

/**
* Control how much effort the model will exert to match the style and features, especially
* facial features, of input images. This parameter is only supported for `gpt-image-1`.
* Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
*/
fun inputFidelity(inputFidelity: InputFidelity?) = apply {
body.inputFidelity(inputFidelity)
Expand Down Expand Up @@ -907,9 +903,7 @@ private constructor(
fun background(): Optional<Background> = background.value.getOptional("background")

/**
* Control how much effort the model will exert to match the style and features, especially
* facial features, of input images. This parameter is only supported for `gpt-image-1`.
* Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -1303,10 +1297,7 @@ private constructor(
}

/**
* Control how much effort the model will exert to match the style and features,
* especially facial features, of input images. This parameter is only supported for
* `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`.
* Defaults to `low`.
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
*/
fun inputFidelity(inputFidelity: InputFidelity?) =
inputFidelity(MultipartField.of(inputFidelity))
Expand Down Expand Up @@ -1990,9 +1981,7 @@ private constructor(
}

/**
* Control how much effort the model will exert to match the style and features, especially
* facial features, of input images. This parameter is only supported for `gpt-image-1`.
* Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
*/
class InputFidelity @JsonCreator private constructor(private val value: JsonField<String>) :
Enum {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

/**
* A custom tool that processes input using a specified format. Learn more about
* [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools).
*/
class CustomTool
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ private constructor(
fun logs(): String = logs.getRequired("logs")

/**
* The type of the output. Always 'logs'.
* The type of the output. Always `logs`.
*
* Expected to always return the following:
* ```java
Expand Down Expand Up @@ -804,7 +804,7 @@ private constructor(
) : this(type, url, mutableMapOf())

/**
* The type of the output. Always 'image'.
* The type of the output. Always `image`.
*
* Expected to always return the following:
* ```java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ private constructor(
fun button(): Button = button.getRequired("button")

/**
* Specifies the event type. For a click action, this property is always set to `click`.
* Specifies the event type. For a click action, this property is always `click`.
*
* Expected to always return the following:
* ```java
Expand Down Expand Up @@ -1744,7 +1744,7 @@ private constructor(
(path.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
type.let { if (it == JsonValue.from("drag")) 1 else 0 }

/** A series of x/y coordinate pairs in the drag path. */
/** An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`. */
class Path
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
Expand Down Expand Up @@ -2991,18 +2991,18 @@ private constructor(
/**
* The type of the pending safety check.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun code(): String = code.getRequired("code")
fun code(): Optional<String> = code.getOptional("code")

/**
* Details about the pending safety check.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun message(): String = message.getRequired("message")
fun message(): Optional<String> = message.getOptional("message")

/**
* Returns the raw JSON value of [id].
Expand Down Expand Up @@ -3045,8 +3045,6 @@ private constructor(
* The following fields are required:
* ```java
* .id()
* .code()
* .message()
* ```
*/
@JvmStatic fun builder() = Builder()
Expand All @@ -3056,8 +3054,8 @@ private constructor(
class Builder internal constructor() {

private var id: JsonField<String>? = null
private var code: JsonField<String>? = null
private var message: JsonField<String>? = null
private var code: JsonField<String> = JsonMissing.of()
private var message: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
Expand All @@ -3081,7 +3079,10 @@ private constructor(
fun id(id: JsonField<String>) = apply { this.id = id }

/** The type of the pending safety check. */
fun code(code: String) = code(JsonField.of(code))
fun code(code: String?) = code(JsonField.ofNullable(code))

/** Alias for calling [Builder.code] with `code.orElse(null)`. */
fun code(code: Optional<String>) = code(code.getOrNull())

/**
* Sets [Builder.code] to an arbitrary JSON value.
Expand All @@ -3093,7 +3094,10 @@ private constructor(
fun code(code: JsonField<String>) = apply { this.code = code }

/** Details about the pending safety check. */
fun message(message: String) = message(JsonField.of(message))
fun message(message: String?) = message(JsonField.ofNullable(message))

/** Alias for calling [Builder.message] with `message.orElse(null)`. */
fun message(message: Optional<String>) = message(message.getOrNull())

/**
* Sets [Builder.message] to an arbitrary JSON value.
Expand Down Expand Up @@ -3131,17 +3135,15 @@ private constructor(
* The following fields are required:
* ```java
* .id()
* .code()
* .message()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): PendingSafetyCheck =
PendingSafetyCheck(
checkRequired("id", id),
checkRequired("code", code),
checkRequired("message", message),
code,
message,
additionalProperties.toMutableMap(),
)
}
Expand Down
Loading
Loading