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

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 @@
{
".": "2.12.3"
".": "2.12.4"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 88
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a473967d1766dc155994d932fbc4a5bcbd1c140a37c20d0a4065e1bf0640536d.yml
openapi_spec_hash: 67cdc62b0d6c8b1de29b7dc54b265749
config_hash: 7b53f96f897ca1b3407a5341a6f820db
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-de3e91790d0b9f3ce26d679ac07079880ccc695bd8c878f961c4d577a5025a2e.yml
openapi_spec_hash: 4b44e3f287583d01fbe7b10cd943254a
config_hash: 06b9a88561844d60d8efa4eaabf5fa3c
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2.12.4 (2025-07-11)

Full Changelog: [v2.12.3...v2.12.4](https://github.com/openai/openai-java/compare/v2.12.3...v2.12.4)

### Chores

* **api:** specification cleanup ([6fc0efd](https://github.com/openai/openai-java/commit/6fc0efdb8735f8bb4d51631f195634bbb14ea3c4))
* **internal:** manual updates ([53059a7](https://github.com/openai/openai-java/commit/53059a72d301bc3bd7d65ab31609e8509505b2f7))

## 2.12.3 (2025-07-11)

Full Changelog: [v2.12.2...v2.12.3](https://github.com/openai/openai-java/compare/v2.12.2...v2.12.3)
Expand Down
10 changes: 5 additions & 5 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/2.12.3)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/2.12.3/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/2.12.3)
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/2.12.4)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/2.12.4/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/2.12.4)

<!-- 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/2.12.3).
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/2.12.4).

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

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

```kotlin
implementation("com.openai:openai-java:2.12.3")
implementation("com.openai:openai-java:2.12.4")
```

### Maven
Expand All @@ -31,7 +31,7 @@ implementation("com.openai:openai-java:2.12.3")
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java</artifactId>
<version>2.12.3</version>
<version>2.12.4</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 = "2.12.3" // x-release-please-version
version = "2.12.4" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ private constructor(
* Alias for calling [usage] with the following:
* ```java
* Usage.Duration.builder()
* .duration(duration)
* .seconds(seconds)
* .build()
* ```
*/
fun durationUsage(duration: Double) =
usage(Usage.Duration.builder().duration(duration).build())
fun durationUsage(seconds: Double) =
usage(Usage.Duration.builder().seconds(seconds).build())

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
Expand Down Expand Up @@ -1230,18 +1230,18 @@ private constructor(
/** Usage statistics for models billed by audio input duration. */
class Duration
private constructor(
private val duration: JsonField<Double>,
private val seconds: JsonField<Double>,
private val type: JsonValue,
private val additionalProperties: MutableMap<String, JsonValue>,
) {

@JsonCreator
private constructor(
@JsonProperty("duration")
@JsonProperty("seconds")
@ExcludeMissing
duration: JsonField<Double> = JsonMissing.of(),
seconds: JsonField<Double> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
) : this(duration, type, mutableMapOf())
) : this(seconds, type, mutableMapOf())

/**
* Duration of the input audio in seconds.
Expand All @@ -1250,7 +1250,7 @@ private constructor(
* unexpectedly missing or null (e.g. if the server responded with an unexpected
* value).
*/
fun duration(): Double = duration.getRequired("duration")
fun seconds(): Double = seconds.getRequired("seconds")

/**
* The type of the usage object. Always `duration` for this variant.
Expand All @@ -1266,12 +1266,11 @@ private constructor(
@JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type

/**
* Returns the raw JSON value of [duration].
* Returns the raw JSON value of [seconds].
*
* Unlike [duration], this method doesn't throw if the JSON field has an unexpected
* type.
* Unlike [seconds], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField<Double> = duration
@JsonProperty("seconds") @ExcludeMissing fun _seconds(): JsonField<Double> = seconds

@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
Expand All @@ -1292,7 +1291,7 @@ private constructor(
*
* The following fields are required:
* ```java
* .duration()
* .seconds()
* ```
*/
@JvmStatic fun builder() = Builder()
Expand All @@ -1301,28 +1300,28 @@ private constructor(
/** A builder for [Duration]. */
class Builder internal constructor() {

private var duration: JsonField<Double>? = null
private var seconds: JsonField<Double>? = null
private var type: JsonValue = JsonValue.from("duration")
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(duration: Duration) = apply {
this.duration = duration.duration
seconds = duration.seconds
type = duration.type
additionalProperties = duration.additionalProperties.toMutableMap()
}

/** Duration of the input audio in seconds. */
fun duration(duration: Double) = duration(JsonField.of(duration))
fun seconds(seconds: Double) = seconds(JsonField.of(seconds))

/**
* Sets [Builder.duration] to an arbitrary JSON value.
* Sets [Builder.seconds] to an arbitrary JSON value.
*
* You should usually call [Builder.duration] with a well-typed [Double] value
* You should usually call [Builder.seconds] with a well-typed [Double] value
* instead. This method is primarily for setting the field to an undocumented or not
* yet supported value.
*/
fun duration(duration: JsonField<Double>) = apply { this.duration = duration }
fun seconds(seconds: JsonField<Double>) = apply { this.seconds = seconds }

/**
* Sets the field to an arbitrary JSON value.
Expand Down Expand Up @@ -1367,14 +1366,14 @@ private constructor(
*
* The following fields are required:
* ```java
* .duration()
* .seconds()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): Duration =
Duration(
checkRequired("duration", duration),
checkRequired("seconds", seconds),
type,
additionalProperties.toMutableMap(),
)
Expand All @@ -1387,7 +1386,7 @@ private constructor(
return@apply
}

duration()
seconds()
_type().let {
if (it != JsonValue.from("duration")) {
throw OpenAIInvalidDataException("'type' is invalid, received $it")
Expand All @@ -1412,25 +1411,25 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
(if (duration.asKnown().isPresent) 1 else 0) +
(if (seconds.asKnown().isPresent) 1 else 0) +
type.let { if (it == JsonValue.from("duration")) 1 else 0 }

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Duration && duration == other.duration && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is Duration && seconds == other.seconds && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */
}

/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(duration, type, additionalProperties) }
private val hashCode: Int by lazy { Objects.hash(seconds, type, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int = hashCode

override fun toString() =
"Duration{duration=$duration, type=$type, additionalProperties=$additionalProperties}"
"Duration{seconds=$seconds, type=$type, additionalProperties=$additionalProperties}"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,26 +368,24 @@ private constructor(
/** Usage statistics for models billed by audio input duration. */
class Usage
private constructor(
private val duration: JsonField<Double>,
private val seconds: JsonField<Double>,
private val type: JsonValue,
private val additionalProperties: MutableMap<String, JsonValue>,
) {

@JsonCreator
private constructor(
@JsonProperty("duration")
@ExcludeMissing
duration: JsonField<Double> = JsonMissing.of(),
@JsonProperty("seconds") @ExcludeMissing seconds: JsonField<Double> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
) : this(duration, type, mutableMapOf())
) : this(seconds, type, mutableMapOf())

/**
* Duration of the input audio in seconds.
*
* @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).
*/
fun duration(): Double = duration.getRequired("duration")
fun seconds(): Double = seconds.getRequired("seconds")

/**
* The type of the usage object. Always `duration` for this variant.
Expand All @@ -403,11 +401,11 @@ private constructor(
@JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type

/**
* Returns the raw JSON value of [duration].
* Returns the raw JSON value of [seconds].
*
* Unlike [duration], this method doesn't throw if the JSON field has an unexpected type.
* Unlike [seconds], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField<Double> = duration
@JsonProperty("seconds") @ExcludeMissing fun _seconds(): JsonField<Double> = seconds

@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
Expand All @@ -428,7 +426,7 @@ private constructor(
*
* The following fields are required:
* ```java
* .duration()
* .seconds()
* ```
*/
@JvmStatic fun builder() = Builder()
Expand All @@ -437,28 +435,28 @@ private constructor(
/** A builder for [Usage]. */
class Builder internal constructor() {

private var duration: JsonField<Double>? = null
private var seconds: JsonField<Double>? = null
private var type: JsonValue = JsonValue.from("duration")
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(usage: Usage) = apply {
duration = usage.duration
seconds = usage.seconds
type = usage.type
additionalProperties = usage.additionalProperties.toMutableMap()
}

/** Duration of the input audio in seconds. */
fun duration(duration: Double) = duration(JsonField.of(duration))
fun seconds(seconds: Double) = seconds(JsonField.of(seconds))

/**
* Sets [Builder.duration] to an arbitrary JSON value.
* Sets [Builder.seconds] to an arbitrary JSON value.
*
* You should usually call [Builder.duration] with a well-typed [Double] value instead.
* You should usually call [Builder.seconds] with a well-typed [Double] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun duration(duration: JsonField<Double>) = apply { this.duration = duration }
fun seconds(seconds: JsonField<Double>) = apply { this.seconds = seconds }

/**
* Sets the field to an arbitrary JSON value.
Expand Down Expand Up @@ -500,17 +498,13 @@ private constructor(
*
* The following fields are required:
* ```java
* .duration()
* .seconds()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): Usage =
Usage(
checkRequired("duration", duration),
type,
additionalProperties.toMutableMap(),
)
Usage(checkRequired("seconds", seconds), type, additionalProperties.toMutableMap())
}

private var validated: Boolean = false
Expand All @@ -520,7 +514,7 @@ private constructor(
return@apply
}

duration()
seconds()
_type().let {
if (it != JsonValue.from("duration")) {
throw OpenAIInvalidDataException("'type' is invalid, received $it")
Expand All @@ -545,25 +539,25 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
(if (duration.asKnown().isPresent) 1 else 0) +
(if (seconds.asKnown().isPresent) 1 else 0) +
type.let { if (it == JsonValue.from("duration")) 1 else 0 }

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Usage && duration == other.duration && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is Usage && seconds == other.seconds && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */
}

/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(duration, type, additionalProperties) }
private val hashCode: Int by lazy { Objects.hash(seconds, type, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int = hashCode

override fun toString() =
"Usage{duration=$duration, type=$type, additionalProperties=$additionalProperties}"
"Usage{seconds=$seconds, type=$type, additionalProperties=$additionalProperties}"
}

override fun equals(other: Any?): Boolean {
Expand Down
Loading