diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 25e9535f2..ea3d667ed 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.35.0"
+ ".": "4.36.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 74bb7cc4f..6359ad060 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 232
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-08cb8ed18dfe4a9fa518e278576d3cfe5710cb5c22789cf80826c900569bcf56.yml
-openapi_spec_hash: 20f820c94f54741b75d719f6a7371c12
-config_hash: f291a449469edfe61a28424e548899b2
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-50d816559ef0935e64d07789ff936a2b762e26ab0714a2fa6bc06d06d4484294.yml
+openapi_spec_hash: c5d8f37edbf66c1fef627d787b4c54fd
+config_hash: b64135fff1fe9cf4069b9ecf59ae8b07
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 34f266d61..18b285fb8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog
+## 4.36.0 (2026-05-13)
+
+Full Changelog: [v4.35.0...v4.36.0](https://github.com/openai/openai-java/compare/v4.35.0...v4.36.0)
+
+### Features
+
+* **api:** add service_tier parameter to response compact method ([c72b807](https://github.com/openai/openai-java/commit/c72b807908abb11b86f782bf93bcd26e18d6ab06))
+* **api:** realtime 2 ([8057452](https://github.com/openai/openai-java/commit/80574522eec0c84dad8e4e0a2a1e582f9d962850))
+
## 4.35.0 (2026-05-07)
Full Changelog: [v4.34.0...v4.35.0](https://github.com/openai/openai-java/compare/v4.34.0...v4.35.0)
diff --git a/README.md b/README.md
index 5cdfe2939..8ed9b76a3 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/4.35.0)
-[](https://javadoc.io/doc/com.openai/openai-java/4.35.0)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/4.36.0)
+[](https://javadoc.io/doc/com.openai/openai-java/4.36.0)
@@ -11,7 +11,7 @@ The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https://
-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.35.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.36.0).
@@ -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.35.0")
+implementation("com.openai:openai-java:4.36.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.35.0")
com.openaiopenai-java
- 4.35.0
+ 4.36.0
```
@@ -172,7 +172,6 @@ import com.openai.client.okhttp.OpenAIOkHttpClient;
SubjectTokenProvider provider = K8sServiceAccountTokenProvider.builder().build();
WorkloadIdentity workloadIdentity = WorkloadIdentity.builder()
- .clientId("your-client-id")
.identityProviderId("your-identity-provider-id")
.serviceAccountId("your-service-account-id")
.provider(provider)
@@ -1434,7 +1433,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.35.0")
+implementation("com.openai:openai-java-spring-boot-starter:4.36.0")
```
#### Maven
@@ -1443,7 +1442,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.35.0")
com.openaiopenai-java-spring-boot-starter
- 4.35.0
+ 4.36.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index cf1932e56..13b4e5b0b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "4.35.0" // x-release-please-version
+ version = "4.36.0" // x-release-please-version
}
subprojects {
diff --git a/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentity.kt b/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentity.kt
index efbbb0533..cd0108e41 100644
--- a/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentity.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentity.kt
@@ -6,7 +6,7 @@ import com.openai.core.checkRequired
class WorkloadIdentity
private constructor(
/** A unique string that identifies the client. */
- @get:JvmName("clientId") val clientId: String,
+ @get:JvmName("clientId") val clientId: String?,
/** Identity provider resource id in WIFAPI. */
@get:JvmName("identityProviderId") val identityProviderId: String,
/** Service account id to bind the verified external identity to. */
@@ -58,7 +58,7 @@ private constructor(
fun build(): WorkloadIdentity =
WorkloadIdentity(
- checkRequired("clientId", clientId),
+ clientId,
checkRequired("identityProviderId", identityProviderId),
checkRequired("serviceAccountId", serviceAccountId),
checkRequired("provider", provider),
diff --git a/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt b/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt
index 1066c3605..51d97e950 100644
--- a/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/auth/WorkloadIdentityAuth.kt
@@ -251,15 +251,12 @@ internal class WorkloadIdentityAuth(
SubjectTokenType.ID -> ID_TOKEN_TYPE
}
- val requestBody =
- mapOf(
- "grant_type" to TOKEN_EXCHANGE_GRANT_TYPE,
- "client_id" to config.clientId,
- "subject_token" to subjectToken,
- "subject_token_type" to subjectTokenTypeURN,
- "identity_provider_id" to config.identityProviderId,
- "service_account_id" to config.serviceAccountId,
- )
+ val requestBody = mutableMapOf("grant_type" to TOKEN_EXCHANGE_GRANT_TYPE)
+ config.clientId?.let { requestBody["client_id"] = it }
+ requestBody["subject_token"] = subjectToken
+ requestBody["subject_token_type"] = subjectTokenTypeURN
+ requestBody["identity_provider_id"] = config.identityProviderId
+ requestBody["service_account_id"] = config.serviceAccountId
val jsonBody = jsonMapper.writeValueAsBytes(requestBody)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/AudioTranscription.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/AudioTranscription.kt
index ae575fd8e..fc169a9e2 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/AudioTranscription.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/AudioTranscription.kt
@@ -15,10 +15,12 @@ import com.openai.errors.OpenAIInvalidDataException
import java.util.Collections
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
class AudioTranscription
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
+ private val delay: JsonField,
private val language: JsonField,
private val model: JsonField,
private val prompt: JsonField,
@@ -27,10 +29,21 @@ private constructor(
@JsonCreator
private constructor(
+ @JsonProperty("delay") @ExcludeMissing delay: JsonField = JsonMissing.of(),
@JsonProperty("language") @ExcludeMissing language: JsonField = JsonMissing.of(),
@JsonProperty("model") @ExcludeMissing model: JsonField = JsonMissing.of(),
@JsonProperty("prompt") @ExcludeMissing prompt: JsonField = JsonMissing.of(),
- ) : this(language, model, prompt, mutableMapOf())
+ ) : this(delay, language, model, prompt, mutableMapOf())
+
+ /**
+ * Controls how long the model waits before emitting transcription text. Higher values can
+ * improve transcription accuracy at the cost of latency. Only supported with
+ * `gpt-realtime-whisper` in GA Realtime sessions.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun delay(): Optional = delay.getOptional("delay")
/**
* The language of the input audio. Supplying the input language in
@@ -44,9 +57,9 @@ private constructor(
/**
* The model to use for transcription. Current options are `whisper-1`,
- * `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, and
- * `gpt-4o-transcribe-diarize`. Use `gpt-4o-transcribe-diarize` when you need diarization with
- * speaker labels.
+ * `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`,
+ * `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when
+ * you need diarization with speaker labels.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -58,13 +71,21 @@ private constructor(
* `whisper-1`, the
* [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
* For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free
- * text string, for example "expect words related to technology".
+ * text string, for example "expect words related to technology". Prompt is not supported with
+ * `gpt-realtime-whisper` in GA Realtime sessions.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun prompt(): Optional = prompt.getOptional("prompt")
+ /**
+ * Returns the raw JSON value of [delay].
+ *
+ * Unlike [delay], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("delay") @ExcludeMissing fun _delay(): JsonField = delay
+
/**
* Returns the raw JSON value of [language].
*
@@ -107,6 +128,7 @@ private constructor(
/** A builder for [AudioTranscription]. */
class Builder internal constructor() {
+ private var delay: JsonField = JsonMissing.of()
private var language: JsonField = JsonMissing.of()
private var model: JsonField = JsonMissing.of()
private var prompt: JsonField = JsonMissing.of()
@@ -114,12 +136,28 @@ private constructor(
@JvmSynthetic
internal fun from(audioTranscription: AudioTranscription) = apply {
+ delay = audioTranscription.delay
language = audioTranscription.language
model = audioTranscription.model
prompt = audioTranscription.prompt
additionalProperties = audioTranscription.additionalProperties.toMutableMap()
}
+ /**
+ * Controls how long the model waits before emitting transcription text. Higher values can
+ * improve transcription accuracy at the cost of latency. Only supported with
+ * `gpt-realtime-whisper` in GA Realtime sessions.
+ */
+ fun delay(delay: Delay) = delay(JsonField.of(delay))
+
+ /**
+ * Sets [Builder.delay] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.delay] with a well-typed [Delay] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun delay(delay: JsonField) = apply { this.delay = delay }
+
/**
* The language of the input audio. Supplying the input language in
* [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format
@@ -137,9 +175,9 @@ private constructor(
/**
* The model to use for transcription. Current options are `whisper-1`,
- * `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, and
- * `gpt-4o-transcribe-diarize`. Use `gpt-4o-transcribe-diarize` when you need diarization
- * with speaker labels.
+ * `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`,
+ * `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize`
+ * when you need diarization with speaker labels.
*/
fun model(model: Model) = model(JsonField.of(model))
@@ -164,7 +202,8 @@ private constructor(
* `whisper-1`, the
* [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
* For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a
- * free text string, for example "expect words related to technology".
+ * free text string, for example "expect words related to technology". Prompt is not
+ * supported with `gpt-realtime-whisper` in GA Realtime sessions.
*/
fun prompt(prompt: String) = prompt(JsonField.of(prompt))
@@ -201,7 +240,7 @@ private constructor(
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): AudioTranscription =
- AudioTranscription(language, model, prompt, additionalProperties.toMutableMap())
+ AudioTranscription(delay, language, model, prompt, additionalProperties.toMutableMap())
}
private var validated: Boolean = false
@@ -219,6 +258,7 @@ private constructor(
return@apply
}
+ delay().ifPresent { it.validate() }
language()
model()
prompt()
@@ -240,15 +280,173 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
- (if (language.asKnown().isPresent) 1 else 0) +
+ (delay.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (language.asKnown().isPresent) 1 else 0) +
(if (model.asKnown().isPresent) 1 else 0) +
(if (prompt.asKnown().isPresent) 1 else 0)
+ /**
+ * Controls how long the model waits before emitting transcription text. Higher values can
+ * improve transcription accuracy at the cost of latency. Only supported with
+ * `gpt-realtime-whisper` in GA Realtime sessions.
+ */
+ class Delay @JsonCreator private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val MINIMAL = of("minimal")
+
+ @JvmField val LOW = of("low")
+
+ @JvmField val MEDIUM = of("medium")
+
+ @JvmField val HIGH = of("high")
+
+ @JvmField val XHIGH = of("xhigh")
+
+ @JvmStatic fun of(value: String) = Delay(JsonField.of(value))
+ }
+
+ /** An enum containing [Delay]'s known values. */
+ enum class Known {
+ MINIMAL,
+ LOW,
+ MEDIUM,
+ HIGH,
+ XHIGH,
+ }
+
+ /**
+ * An enum containing [Delay]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Delay] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ MINIMAL,
+ LOW,
+ MEDIUM,
+ HIGH,
+ XHIGH,
+ /** An enum member indicating that [Delay] was instantiated with an unknown value. */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ MINIMAL -> Value.MINIMAL
+ LOW -> Value.LOW
+ MEDIUM -> Value.MEDIUM
+ HIGH -> Value.HIGH
+ XHIGH -> Value.XHIGH
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ MINIMAL -> Known.MINIMAL
+ LOW -> Known.LOW
+ MEDIUM -> Known.MEDIUM
+ HIGH -> Known.HIGH
+ XHIGH -> Known.XHIGH
+ else -> throw OpenAIInvalidDataException("Unknown Delay: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging
+ * and generally doesn't throw.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { OpenAIInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Delay = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Delay && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
/**
* The model to use for transcription. Current options are `whisper-1`,
- * `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, and
- * `gpt-4o-transcribe-diarize`. Use `gpt-4o-transcribe-diarize` when you need diarization with
- * speaker labels.
+ * `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`,
+ * `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when
+ * you need diarization with speaker labels.
*/
class Model @JsonCreator private constructor(private val value: JsonField) : Enum {
@@ -275,6 +473,8 @@ private constructor(
@JvmField val GPT_4O_TRANSCRIBE_DIARIZE = of("gpt-4o-transcribe-diarize")
+ @JvmField val GPT_REALTIME_WHISPER = of("gpt-realtime-whisper")
+
@JvmStatic fun of(value: String) = Model(JsonField.of(value))
}
@@ -285,6 +485,7 @@ private constructor(
GPT_4O_MINI_TRANSCRIBE_2025_12_15,
GPT_4O_TRANSCRIBE,
GPT_4O_TRANSCRIBE_DIARIZE,
+ GPT_REALTIME_WHISPER,
}
/**
@@ -302,6 +503,7 @@ private constructor(
GPT_4O_MINI_TRANSCRIBE_2025_12_15,
GPT_4O_TRANSCRIBE,
GPT_4O_TRANSCRIBE_DIARIZE,
+ GPT_REALTIME_WHISPER,
/** An enum member indicating that [Model] was instantiated with an unknown value. */
_UNKNOWN,
}
@@ -320,6 +522,7 @@ private constructor(
GPT_4O_MINI_TRANSCRIBE_2025_12_15 -> Value.GPT_4O_MINI_TRANSCRIBE_2025_12_15
GPT_4O_TRANSCRIBE -> Value.GPT_4O_TRANSCRIBE
GPT_4O_TRANSCRIBE_DIARIZE -> Value.GPT_4O_TRANSCRIBE_DIARIZE
+ GPT_REALTIME_WHISPER -> Value.GPT_REALTIME_WHISPER
else -> Value._UNKNOWN
}
@@ -339,6 +542,7 @@ private constructor(
GPT_4O_MINI_TRANSCRIBE_2025_12_15 -> Known.GPT_4O_MINI_TRANSCRIBE_2025_12_15
GPT_4O_TRANSCRIBE -> Known.GPT_4O_TRANSCRIBE
GPT_4O_TRANSCRIBE_DIARIZE -> Known.GPT_4O_TRANSCRIBE_DIARIZE
+ GPT_REALTIME_WHISPER -> Known.GPT_REALTIME_WHISPER
else -> throw OpenAIInvalidDataException("Unknown Model: $value")
}
@@ -409,6 +613,7 @@ private constructor(
}
return other is AudioTranscription &&
+ delay == other.delay &&
language == other.language &&
model == other.model &&
prompt == other.prompt &&
@@ -416,11 +621,11 @@ private constructor(
}
private val hashCode: Int by lazy {
- Objects.hash(language, model, prompt, additionalProperties)
+ Objects.hash(delay, language, model, prompt, additionalProperties)
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "AudioTranscription{language=$language, model=$model, prompt=$prompt, additionalProperties=$additionalProperties}"
+ "AudioTranscription{delay=$delay, language=$language, model=$model, prompt=$prompt, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigInput.kt
index b93ce9159..285bf9cce 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigInput.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioConfigInput.kt
@@ -88,6 +88,9 @@ private constructor(
* score a low probability of turn end and wait longer for the user to continue speaking. This
* can be useful for more natural conversations, but may have a higher latency.
*
+ * For `gpt-realtime-whisper` transcription sessions, turn detection must be set to `null`; VAD
+ * is not supported.
+ *
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
@@ -244,6 +247,9 @@ private constructor(
* model will score a low probability of turn end and wait longer for the user to continue
* speaking. This can be useful for more natural conversations, but may have a higher
* latency.
+ *
+ * For `gpt-realtime-whisper` transcription sessions, turn detection must be set to `null`;
+ * VAD is not supported.
*/
fun turnDetection(turnDetection: RealtimeAudioInputTurnDetection?) =
turnDetection(JsonField.ofNullable(turnDetection))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioInputTurnDetection.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioInputTurnDetection.kt
index 2ec4b51bb..2164fc2a8 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioInputTurnDetection.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeAudioInputTurnDetection.kt
@@ -39,6 +39,9 @@ import kotlin.jvm.optionals.getOrNull
* based on this probability. For example, if user audio trails off with "uhhm", the model will
* score a low probability of turn end and wait longer for the user to continue speaking. This can
* be useful for more natural conversations, but may have a higher latency.
+ *
+ * For `gpt-realtime-whisper` transcription sessions, turn detection must be set to `null`; VAD is
+ * not supported.
*/
@JsonDeserialize(using = RealtimeAudioInputTurnDetection.Deserializer::class)
@JsonSerialize(using = RealtimeAudioInputTurnDetection.Serializer::class)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeReasoning.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeReasoning.kt
new file mode 100644
index 000000000..a5e8d7100
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeReasoning.kt
@@ -0,0 +1,175 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.realtime
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.openai.core.ExcludeMissing
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. */
+class RealtimeReasoning
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val effort: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("effort")
+ @ExcludeMissing
+ effort: JsonField = JsonMissing.of()
+ ) : this(effort, mutableMapOf())
+
+ /**
+ * Constrains effort on reasoning for reasoning-capable Realtime models such as
+ * `gpt-realtime-2`.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun effort(): Optional = effort.getOptional("effort")
+
+ /**
+ * Returns the raw JSON value of [effort].
+ *
+ * Unlike [effort], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("effort")
+ @ExcludeMissing
+ fun _effort(): JsonField = effort
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [RealtimeReasoning]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [RealtimeReasoning]. */
+ class Builder internal constructor() {
+
+ private var effort: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(realtimeReasoning: RealtimeReasoning) = apply {
+ effort = realtimeReasoning.effort
+ additionalProperties = realtimeReasoning.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Constrains effort on reasoning for reasoning-capable Realtime models such as
+ * `gpt-realtime-2`.
+ */
+ fun effort(effort: RealtimeReasoningEffort) = effort(JsonField.of(effort))
+
+ /**
+ * Sets [Builder.effort] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.effort] with a well-typed [RealtimeReasoningEffort]
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun effort(effort: JsonField) = apply { this.effort = effort }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [RealtimeReasoning].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): RealtimeReasoning =
+ RealtimeReasoning(effort, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): RealtimeReasoning = apply {
+ if (validated) {
+ return@apply
+ }
+
+ effort().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (effort.asKnown().getOrNull()?.validity() ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is RealtimeReasoning &&
+ effort == other.effort &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(effort, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "RealtimeReasoning{effort=$effort, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeReasoningEffort.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeReasoningEffort.kt
new file mode 100644
index 000000000..f7fc390f9
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeReasoningEffort.kt
@@ -0,0 +1,164 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.realtime
+
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.openai.core.Enum
+import com.openai.core.JsonField
+import com.openai.errors.OpenAIInvalidDataException
+
+/**
+ * Constrains effort on reasoning for reasoning-capable Realtime models such as `gpt-realtime-2`.
+ */
+class RealtimeReasoningEffort
+@JsonCreator
+private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't match
+ * any known member, and you want to know that value. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new members that the SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val MINIMAL = of("minimal")
+
+ @JvmField val LOW = of("low")
+
+ @JvmField val MEDIUM = of("medium")
+
+ @JvmField val HIGH = of("high")
+
+ @JvmField val XHIGH = of("xhigh")
+
+ @JvmStatic fun of(value: String) = RealtimeReasoningEffort(JsonField.of(value))
+ }
+
+ /** An enum containing [RealtimeReasoningEffort]'s known values. */
+ enum class Known {
+ MINIMAL,
+ LOW,
+ MEDIUM,
+ HIGH,
+ XHIGH,
+ }
+
+ /**
+ * An enum containing [RealtimeReasoningEffort]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [RealtimeReasoningEffort] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the SDK
+ * is on an older version than the API, then the API may respond with new members that the SDK
+ * is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ MINIMAL,
+ LOW,
+ MEDIUM,
+ HIGH,
+ XHIGH,
+ /**
+ * An enum member indicating that [RealtimeReasoningEffort] was instantiated with an unknown
+ * value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if
+ * the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want to
+ * throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ MINIMAL -> Value.MINIMAL
+ LOW -> Value.LOW
+ MEDIUM -> Value.MEDIUM
+ HIGH -> Value.HIGH
+ XHIGH -> Value.XHIGH
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't want
+ * to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known member.
+ */
+ fun known(): Known =
+ when (this) {
+ MINIMAL -> Known.MINIMAL
+ LOW -> Known.LOW
+ MEDIUM -> Known.MEDIUM
+ HIGH -> Known.HIGH
+ XHIGH -> Known.XHIGH
+ else -> throw OpenAIInvalidDataException("Unknown RealtimeReasoningEffort: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging and
+ * generally doesn't throw.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value does not have the expected
+ * primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { OpenAIInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): RealtimeReasoningEffort = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is RealtimeReasoningEffort && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt
index 628ef17b7..cf36c463a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt
@@ -45,7 +45,9 @@ private constructor(
private val maxOutputTokens: JsonField,
private val metadata: JsonField,
private val outputModalities: JsonField>,
+ private val parallelToolCalls: JsonField,
private val prompt: JsonField,
+ private val reasoning: JsonField,
private val toolChoice: JsonField,
private val tools: JsonField>,
private val additionalProperties: MutableMap,
@@ -72,9 +74,15 @@ private constructor(
@JsonProperty("output_modalities")
@ExcludeMissing
outputModalities: JsonField> = JsonMissing.of(),
+ @JsonProperty("parallel_tool_calls")
+ @ExcludeMissing
+ parallelToolCalls: JsonField = JsonMissing.of(),
@JsonProperty("prompt")
@ExcludeMissing
prompt: JsonField = JsonMissing.of(),
+ @JsonProperty("reasoning")
+ @ExcludeMissing
+ reasoning: JsonField = JsonMissing.of(),
@JsonProperty("tool_choice")
@ExcludeMissing
toolChoice: JsonField = JsonMissing.of(),
@@ -87,7 +95,9 @@ private constructor(
maxOutputTokens,
metadata,
outputModalities,
+ parallelToolCalls,
prompt,
+ reasoning,
toolChoice,
tools,
mutableMapOf(),
@@ -173,6 +183,16 @@ private constructor(
fun outputModalities(): Optional> =
outputModalities.getOptional("output_modalities")
+ /**
+ * Whether the model may call multiple tools in parallel. Only supported by reasoning Realtime
+ * models such as `gpt-realtime-2`.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun parallelToolCalls(): Optional =
+ parallelToolCalls.getOptional("parallel_tool_calls")
+
/**
* Reference to a prompt template and its variables.
* [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
@@ -182,6 +202,14 @@ private constructor(
*/
fun prompt(): Optional = prompt.getOptional("prompt")
+ /**
+ * Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun reasoning(): Optional = reasoning.getOptional("reasoning")
+
/**
* How the model chooses tools. Provide one of the string modes or force a specific function/MCP
* tool.
@@ -259,6 +287,16 @@ private constructor(
@ExcludeMissing
fun _outputModalities(): JsonField> = outputModalities
+ /**
+ * Returns the raw JSON value of [parallelToolCalls].
+ *
+ * Unlike [parallelToolCalls], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("parallel_tool_calls")
+ @ExcludeMissing
+ fun _parallelToolCalls(): JsonField = parallelToolCalls
+
/**
* Returns the raw JSON value of [prompt].
*
@@ -266,6 +304,15 @@ private constructor(
*/
@JsonProperty("prompt") @ExcludeMissing fun _prompt(): JsonField = prompt
+ /**
+ * Returns the raw JSON value of [reasoning].
+ *
+ * Unlike [reasoning], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("reasoning")
+ @ExcludeMissing
+ fun _reasoning(): JsonField = reasoning
+
/**
* Returns the raw JSON value of [toolChoice].
*
@@ -312,7 +359,9 @@ private constructor(
private var maxOutputTokens: JsonField = JsonMissing.of()
private var metadata: JsonField = JsonMissing.of()
private var outputModalities: JsonField>? = null
+ private var parallelToolCalls: JsonField = JsonMissing.of()
private var prompt: JsonField = JsonMissing.of()
+ private var reasoning: JsonField = JsonMissing.of()
private var toolChoice: JsonField = JsonMissing.of()
private var tools: JsonField>? = null
private var additionalProperties: MutableMap = mutableMapOf()
@@ -327,7 +376,9 @@ private constructor(
metadata = realtimeResponseCreateParams.metadata
outputModalities =
realtimeResponseCreateParams.outputModalities.map { it.toMutableList() }
+ parallelToolCalls = realtimeResponseCreateParams.parallelToolCalls
prompt = realtimeResponseCreateParams.prompt
+ reasoning = realtimeResponseCreateParams.reasoning
toolChoice = realtimeResponseCreateParams.toolChoice
tools = realtimeResponseCreateParams.tools.map { it.toMutableList() }
additionalProperties = realtimeResponseCreateParams.additionalProperties.toMutableMap()
@@ -611,6 +662,24 @@ private constructor(
}
}
+ /**
+ * Whether the model may call multiple tools in parallel. Only supported by reasoning
+ * Realtime models such as `gpt-realtime-2`.
+ */
+ fun parallelToolCalls(parallelToolCalls: Boolean) =
+ parallelToolCalls(JsonField.of(parallelToolCalls))
+
+ /**
+ * Sets [Builder.parallelToolCalls] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.parallelToolCalls] with a well-typed [Boolean] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun parallelToolCalls(parallelToolCalls: JsonField) = apply {
+ this.parallelToolCalls = parallelToolCalls
+ }
+
/**
* Reference to a prompt template and its variables.
* [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
@@ -629,6 +698,20 @@ private constructor(
*/
fun prompt(prompt: JsonField) = apply { this.prompt = prompt }
+ /** Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. */
+ fun reasoning(reasoning: RealtimeReasoning) = reasoning(JsonField.of(reasoning))
+
+ /**
+ * Sets [Builder.reasoning] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.reasoning] with a well-typed [RealtimeReasoning] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun reasoning(reasoning: JsonField) = apply {
+ this.reasoning = reasoning
+ }
+
/**
* How the model chooses tools. Provide one of the string modes or force a specific
* function/MCP tool.
@@ -721,7 +804,9 @@ private constructor(
maxOutputTokens,
metadata,
(outputModalities ?: JsonMissing.of()).map { it.toImmutable() },
+ parallelToolCalls,
prompt,
+ reasoning,
toolChoice,
(tools ?: JsonMissing.of()).map { it.toImmutable() },
additionalProperties.toMutableMap(),
@@ -750,7 +835,9 @@ private constructor(
maxOutputTokens().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
outputModalities().ifPresent { it.forEach { it.validate() } }
+ parallelToolCalls()
prompt().ifPresent { it.validate() }
+ reasoning().ifPresent { it.validate() }
toolChoice().ifPresent { it.validate() }
tools().ifPresent { it.forEach { it.validate() } }
validated = true
@@ -778,7 +865,9 @@ private constructor(
(maxOutputTokens.asKnown().getOrNull()?.validity() ?: 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(outputModalities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (parallelToolCalls.asKnown().isPresent) 1 else 0) +
(prompt.asKnown().getOrNull()?.validity() ?: 0) +
+ (reasoning.asKnown().getOrNull()?.validity() ?: 0) +
(toolChoice.asKnown().getOrNull()?.validity() ?: 0) +
(tools.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
@@ -1958,7 +2047,9 @@ private constructor(
maxOutputTokens == other.maxOutputTokens &&
metadata == other.metadata &&
outputModalities == other.outputModalities &&
+ parallelToolCalls == other.parallelToolCalls &&
prompt == other.prompt &&
+ reasoning == other.reasoning &&
toolChoice == other.toolChoice &&
tools == other.tools &&
additionalProperties == other.additionalProperties
@@ -1973,7 +2064,9 @@ private constructor(
maxOutputTokens,
metadata,
outputModalities,
+ parallelToolCalls,
prompt,
+ reasoning,
toolChoice,
tools,
additionalProperties,
@@ -1983,5 +2076,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "RealtimeResponseCreateParams{audio=$audio, conversation=$conversation, input=$input, instructions=$instructions, maxOutputTokens=$maxOutputTokens, metadata=$metadata, outputModalities=$outputModalities, prompt=$prompt, toolChoice=$toolChoice, tools=$tools, additionalProperties=$additionalProperties}"
+ "RealtimeResponseCreateParams{audio=$audio, conversation=$conversation, input=$input, instructions=$instructions, maxOutputTokens=$maxOutputTokens, metadata=$metadata, outputModalities=$outputModalities, parallelToolCalls=$parallelToolCalls, prompt=$prompt, reasoning=$reasoning, toolChoice=$toolChoice, tools=$tools, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSession.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSession.kt
index 52a26105f..ff46ab439 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSession.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSession.kt
@@ -323,6 +323,9 @@ private constructor(
* score a low probability of turn end and wait longer for the user to continue speaking. This
* can be useful for more natural conversations, but may have a higher latency.
*
+ * For `gpt-realtime-whisper` transcription sessions, turn detection must be set to `null`; VAD
+ * is not supported.
+ *
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
@@ -952,6 +955,9 @@ private constructor(
* model will score a low probability of turn end and wait longer for the user to continue
* speaking. This can be useful for more natural conversations, but may have a higher
* latency.
+ *
+ * For `gpt-realtime-whisper` transcription sessions, turn detection must be set to `null`;
+ * VAD is not supported.
*/
fun turnDetection(turnDetection: TurnDetection?) =
turnDetection(JsonField.ofNullable(turnDetection))
@@ -2920,6 +2926,9 @@ private constructor(
* based on this probability. For example, if user audio trails off with "uhhm", the model will
* score a low probability of turn end and wait longer for the user to continue speaking. This
* can be useful for more natural conversations, but may have a higher latency.
+ *
+ * For `gpt-realtime-whisper` transcription sessions, turn detection must be set to `null`; VAD
+ * is not supported.
*/
@JsonDeserialize(using = TurnDetection.Deserializer::class)
@JsonSerialize(using = TurnDetection.Serializer::class)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequest.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequest.kt
index b1c7187d3..e3e989d02 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequest.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSessionCreateRequest.kt
@@ -45,7 +45,9 @@ private constructor(
private val maxOutputTokens: JsonField,
private val model: JsonField,
private val outputModalities: JsonField>,
+ private val parallelToolCalls: JsonField,
private val prompt: JsonField,
+ private val reasoning: JsonField,
private val toolChoice: JsonField,
private val tools: JsonField>,
private val tracing: JsonField,
@@ -72,9 +74,15 @@ private constructor(
@JsonProperty("output_modalities")
@ExcludeMissing
outputModalities: JsonField> = JsonMissing.of(),
+ @JsonProperty("parallel_tool_calls")
+ @ExcludeMissing
+ parallelToolCalls: JsonField = JsonMissing.of(),
@JsonProperty("prompt")
@ExcludeMissing
prompt: JsonField = JsonMissing.of(),
+ @JsonProperty("reasoning")
+ @ExcludeMissing
+ reasoning: JsonField = JsonMissing.of(),
@JsonProperty("tool_choice")
@ExcludeMissing
toolChoice: JsonField = JsonMissing.of(),
@@ -95,7 +103,9 @@ private constructor(
maxOutputTokens,
model,
outputModalities,
+ parallelToolCalls,
prompt,
+ reasoning,
toolChoice,
tools,
tracing,
@@ -181,6 +191,16 @@ private constructor(
fun outputModalities(): Optional> =
outputModalities.getOptional("output_modalities")
+ /**
+ * Whether the model may call multiple tools in parallel. Only supported by reasoning Realtime
+ * models such as `gpt-realtime-2`.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun parallelToolCalls(): Optional =
+ parallelToolCalls.getOptional("parallel_tool_calls")
+
/**
* Reference to a prompt template and its variables.
* [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
@@ -190,6 +210,14 @@ private constructor(
*/
fun prompt(): Optional = prompt.getOptional("prompt")
+ /**
+ * Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun reasoning(): Optional = reasoning.getOptional("reasoning")
+
/**
* How the model chooses tools. Provide one of the string modes or force a specific function/MCP
* tool.
@@ -291,6 +319,16 @@ private constructor(
@ExcludeMissing
fun _outputModalities(): JsonField> = outputModalities
+ /**
+ * Returns the raw JSON value of [parallelToolCalls].
+ *
+ * Unlike [parallelToolCalls], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("parallel_tool_calls")
+ @ExcludeMissing
+ fun _parallelToolCalls(): JsonField = parallelToolCalls
+
/**
* Returns the raw JSON value of [prompt].
*
@@ -298,6 +336,15 @@ private constructor(
*/
@JsonProperty("prompt") @ExcludeMissing fun _prompt(): JsonField = prompt
+ /**
+ * Returns the raw JSON value of [reasoning].
+ *
+ * Unlike [reasoning], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("reasoning")
+ @ExcludeMissing
+ fun _reasoning(): JsonField = reasoning
+
/**
* Returns the raw JSON value of [toolChoice].
*
@@ -364,7 +411,9 @@ private constructor(
private var maxOutputTokens: JsonField = JsonMissing.of()
private var model: JsonField = JsonMissing.of()
private var outputModalities: JsonField>? = null
+ private var parallelToolCalls: JsonField = JsonMissing.of()
private var prompt: JsonField = JsonMissing.of()
+ private var reasoning: JsonField = JsonMissing.of()
private var toolChoice: JsonField = JsonMissing.of()
private var tools: JsonField>? = null
private var tracing: JsonField = JsonMissing.of()
@@ -381,7 +430,9 @@ private constructor(
model = realtimeSessionCreateRequest.model
outputModalities =
realtimeSessionCreateRequest.outputModalities.map { it.toMutableList() }
+ parallelToolCalls = realtimeSessionCreateRequest.parallelToolCalls
prompt = realtimeSessionCreateRequest.prompt
+ reasoning = realtimeSessionCreateRequest.reasoning
toolChoice = realtimeSessionCreateRequest.toolChoice
tools = realtimeSessionCreateRequest.tools.map { it.toMutableList() }
tracing = realtimeSessionCreateRequest.tracing
@@ -547,6 +598,24 @@ private constructor(
}
}
+ /**
+ * Whether the model may call multiple tools in parallel. Only supported by reasoning
+ * Realtime models such as `gpt-realtime-2`.
+ */
+ fun parallelToolCalls(parallelToolCalls: Boolean) =
+ parallelToolCalls(JsonField.of(parallelToolCalls))
+
+ /**
+ * Sets [Builder.parallelToolCalls] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.parallelToolCalls] with a well-typed [Boolean] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun parallelToolCalls(parallelToolCalls: JsonField) = apply {
+ this.parallelToolCalls = parallelToolCalls
+ }
+
/**
* Reference to a prompt template and its variables.
* [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
@@ -565,6 +634,20 @@ private constructor(
*/
fun prompt(prompt: JsonField) = apply { this.prompt = prompt }
+ /** Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. */
+ fun reasoning(reasoning: RealtimeReasoning) = reasoning(JsonField.of(reasoning))
+
+ /**
+ * Sets [Builder.reasoning] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.reasoning] with a well-typed [RealtimeReasoning] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun reasoning(reasoning: JsonField) = apply {
+ this.reasoning = reasoning
+ }
+
/**
* How the model chooses tools. Provide one of the string modes or force a specific
* function/MCP tool.
@@ -752,7 +835,9 @@ private constructor(
maxOutputTokens,
model,
(outputModalities ?: JsonMissing.of()).map { it.toImmutable() },
+ parallelToolCalls,
prompt,
+ reasoning,
toolChoice,
(tools ?: JsonMissing.of()).map { it.toImmutable() },
tracing,
@@ -787,7 +872,9 @@ private constructor(
maxOutputTokens().ifPresent { it.validate() }
model()
outputModalities().ifPresent { it.forEach { it.validate() } }
+ parallelToolCalls()
prompt().ifPresent { it.validate() }
+ reasoning().ifPresent { it.validate() }
toolChoice().ifPresent { it.validate() }
tools().ifPresent { it.forEach { it.validate() } }
tracing().ifPresent { it.validate() }
@@ -817,7 +904,9 @@ private constructor(
(maxOutputTokens.asKnown().getOrNull()?.validity() ?: 0) +
(if (model.asKnown().isPresent) 1 else 0) +
(outputModalities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (parallelToolCalls.asKnown().isPresent) 1 else 0) +
(prompt.asKnown().getOrNull()?.validity() ?: 0) +
+ (reasoning.asKnown().getOrNull()?.validity() ?: 0) +
(toolChoice.asKnown().getOrNull()?.validity() ?: 0) +
(tools.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(tracing.asKnown().getOrNull()?.validity() ?: 0) +
@@ -1194,6 +1283,8 @@ private constructor(
@JvmField val GPT_REALTIME_1_5 = of("gpt-realtime-1.5")
+ @JvmField val GPT_REALTIME_2 = of("gpt-realtime-2")
+
@JvmField val GPT_REALTIME_2025_08_28 = of("gpt-realtime-2025-08-28")
@JvmField val GPT_4O_REALTIME_PREVIEW = of("gpt-4o-realtime-preview")
@@ -1234,6 +1325,7 @@ private constructor(
enum class Known {
GPT_REALTIME,
GPT_REALTIME_1_5,
+ GPT_REALTIME_2,
GPT_REALTIME_2025_08_28,
GPT_4O_REALTIME_PREVIEW,
GPT_4O_REALTIME_PREVIEW_2024_10_01,
@@ -1262,6 +1354,7 @@ private constructor(
enum class Value {
GPT_REALTIME,
GPT_REALTIME_1_5,
+ GPT_REALTIME_2,
GPT_REALTIME_2025_08_28,
GPT_4O_REALTIME_PREVIEW,
GPT_4O_REALTIME_PREVIEW_2024_10_01,
@@ -1291,6 +1384,7 @@ private constructor(
when (this) {
GPT_REALTIME -> Value.GPT_REALTIME
GPT_REALTIME_1_5 -> Value.GPT_REALTIME_1_5
+ GPT_REALTIME_2 -> Value.GPT_REALTIME_2
GPT_REALTIME_2025_08_28 -> Value.GPT_REALTIME_2025_08_28
GPT_4O_REALTIME_PREVIEW -> Value.GPT_4O_REALTIME_PREVIEW
GPT_4O_REALTIME_PREVIEW_2024_10_01 -> Value.GPT_4O_REALTIME_PREVIEW_2024_10_01
@@ -1322,6 +1416,7 @@ private constructor(
when (this) {
GPT_REALTIME -> Known.GPT_REALTIME
GPT_REALTIME_1_5 -> Known.GPT_REALTIME_1_5
+ GPT_REALTIME_2 -> Known.GPT_REALTIME_2
GPT_REALTIME_2025_08_28 -> Known.GPT_REALTIME_2025_08_28
GPT_4O_REALTIME_PREVIEW -> Known.GPT_4O_REALTIME_PREVIEW
GPT_4O_REALTIME_PREVIEW_2024_10_01 -> Known.GPT_4O_REALTIME_PREVIEW_2024_10_01
@@ -1552,7 +1647,9 @@ private constructor(
maxOutputTokens == other.maxOutputTokens &&
model == other.model &&
outputModalities == other.outputModalities &&
+ parallelToolCalls == other.parallelToolCalls &&
prompt == other.prompt &&
+ reasoning == other.reasoning &&
toolChoice == other.toolChoice &&
tools == other.tools &&
tracing == other.tracing &&
@@ -1569,7 +1666,9 @@ private constructor(
maxOutputTokens,
model,
outputModalities,
+ parallelToolCalls,
prompt,
+ reasoning,
toolChoice,
tools,
tracing,
@@ -1581,5 +1680,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "RealtimeSessionCreateRequest{type=$type, audio=$audio, include=$include, instructions=$instructions, maxOutputTokens=$maxOutputTokens, model=$model, outputModalities=$outputModalities, prompt=$prompt, toolChoice=$toolChoice, tools=$tools, tracing=$tracing, truncation=$truncation, additionalProperties=$additionalProperties}"
+ "RealtimeSessionCreateRequest{type=$type, audio=$audio, include=$include, instructions=$instructions, maxOutputTokens=$maxOutputTokens, model=$model, outputModalities=$outputModalities, parallelToolCalls=$parallelToolCalls, prompt=$prompt, reasoning=$reasoning, toolChoice=$toolChoice, tools=$tools, tracing=$tracing, truncation=$truncation, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInput.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInput.kt
index 4aec9e955..4122bc5ac 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInput.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInput.kt
@@ -89,6 +89,9 @@ private constructor(
* score a low probability of turn end and wait longer for the user to continue speaking. This
* can be useful for more natural conversations, but may have a higher latency.
*
+ * For `gpt-realtime-whisper` transcription sessions, turn detection must be set to `null`; VAD
+ * is not supported.
+ *
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
@@ -253,6 +256,9 @@ private constructor(
* model will score a low probability of turn end and wait longer for the user to continue
* speaking. This can be useful for more natural conversations, but may have a higher
* latency.
+ *
+ * For `gpt-realtime-whisper` transcription sessions, turn detection must be set to `null`;
+ * VAD is not supported.
*/
fun turnDetection(turnDetection: RealtimeTranscriptionSessionAudioInputTurnDetection?) =
turnDetection(JsonField.ofNullable(turnDetection))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInputTurnDetection.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInputTurnDetection.kt
index 0c3a7189c..a705437a5 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInputTurnDetection.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranscriptionSessionAudioInputTurnDetection.kt
@@ -39,6 +39,9 @@ import kotlin.jvm.optionals.getOrNull
* based on this probability. For example, if user audio trails off with "uhhm", the model will
* score a low probability of turn end and wait longer for the user to continue speaking. This can
* be useful for more natural conversations, but may have a higher latency.
+ *
+ * For `gpt-realtime-whisper` transcription sessions, turn detection must be set to `null`; VAD is
+ * not supported.
*/
@JsonDeserialize(using = RealtimeTranscriptionSessionAudioInputTurnDetection.Deserializer::class)
@JsonSerialize(using = RealtimeTranscriptionSessionAudioInputTurnDetection.Serializer::class)
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdatedEvent.kt
index 5f5cd2305..5b123fab3 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdatedEvent.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/TranscriptionSessionUpdatedEvent.kt
@@ -322,8 +322,6 @@ private constructor(
inputAudioFormat.getOptional("input_audio_format")
/**
- * Configuration of the transcription model.
- *
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
@@ -474,7 +472,6 @@ private constructor(
this.inputAudioFormat = inputAudioFormat
}
- /** Configuration of the transcription model. */
fun inputAudioTranscription(inputAudioTranscription: AudioTranscription) =
inputAudioTranscription(JsonField.of(inputAudioTranscription))
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponse.kt
index e28e6c050..3f51fb359 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/ClientSecretCreateResponse.kt
@@ -161,12 +161,12 @@ private constructor(
* Alias for calling [session] with the following:
* ```java
* RealtimeSessionCreateResponse.builder()
- * .clientSecret(clientSecret)
+ * .id(id)
* .build()
* ```
*/
- fun realtimeSession(clientSecret: RealtimeSessionClientSecret) =
- session(RealtimeSessionCreateResponse.builder().clientSecret(clientSecret).build())
+ fun realtimeSession(id: String) =
+ session(RealtimeSessionCreateResponse.builder().id(id).build())
/** Alias for calling [session] with `Session.ofTranscription(transcription)`. */
fun session(transcription: RealtimeTranscriptionSessionCreateResponse) =
@@ -275,10 +275,7 @@ private constructor(
private val _json: JsonValue? = null,
) {
- /**
- * A new Realtime session configuration, with an ephemeral key. Default TTL for keys is one
- * minute.
- */
+ /** A Realtime session configuration object. */
fun realtime(): Optional = Optional.ofNullable(realtime)
/** A Realtime transcription session configuration object. */
@@ -289,10 +286,7 @@ private constructor(
fun isTranscription(): Boolean = transcription != null
- /**
- * A new Realtime session configuration, with an ephemeral key. Default TTL for keys is one
- * minute.
- */
+ /** A Realtime session configuration object. */
fun asRealtime(): RealtimeSessionCreateResponse = realtime.getOrThrow("realtime")
/** A Realtime transcription session configuration object. */
@@ -420,10 +414,7 @@ private constructor(
companion object {
- /**
- * A new Realtime session configuration, with an ephemeral key. Default TTL for keys is
- * one minute.
- */
+ /** A Realtime session configuration object. */
@JvmStatic
fun ofRealtime(realtime: RealtimeSessionCreateResponse) = Session(realtime = realtime)
@@ -438,10 +429,7 @@ private constructor(
*/
interface Visitor {
- /**
- * A new Realtime session configuration, with an ephemeral key. Default TTL for keys is
- * one minute.
- */
+ /** A Realtime session configuration object. */
fun visitRealtime(realtime: RealtimeSessionCreateResponse): T
/** A Realtime transcription session configuration object. */
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionClientSecret.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionClientSecret.kt
deleted file mode 100644
index 3928ac73c..000000000
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionClientSecret.kt
+++ /dev/null
@@ -1,225 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.openai.models.realtime.clientsecrets
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter
-import com.fasterxml.jackson.annotation.JsonAnySetter
-import com.fasterxml.jackson.annotation.JsonCreator
-import com.fasterxml.jackson.annotation.JsonProperty
-import com.openai.core.ExcludeMissing
-import com.openai.core.JsonField
-import com.openai.core.JsonMissing
-import com.openai.core.JsonValue
-import com.openai.core.checkRequired
-import com.openai.errors.OpenAIInvalidDataException
-import java.util.Collections
-import java.util.Objects
-
-/** Ephemeral key returned by the API. */
-class RealtimeSessionClientSecret
-@JsonCreator(mode = JsonCreator.Mode.DISABLED)
-private constructor(
- private val expiresAt: JsonField,
- private val value: JsonField,
- private val additionalProperties: MutableMap,
-) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("expires_at") @ExcludeMissing expiresAt: JsonField = JsonMissing.of(),
- @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
- ) : this(expiresAt, value, mutableMapOf())
-
- /**
- * Timestamp for when the token expires. Currently, all tokens expire after one minute.
- *
- * @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 expiresAt(): Long = expiresAt.getRequired("expires_at")
-
- /**
- * Ephemeral key usable in client environments to authenticate connections to the Realtime API.
- * Use this in client-side environments rather than a standard API token, which should only be
- * used server-side.
- *
- * @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 value(): String = value.getRequired("value")
-
- /**
- * Returns the raw JSON value of [expiresAt].
- *
- * Unlike [expiresAt], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("expires_at") @ExcludeMissing fun _expiresAt(): JsonField = expiresAt
-
- /**
- * Returns the raw JSON value of [value].
- *
- * Unlike [value], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value
-
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of [RealtimeSessionClientSecret].
- *
- * The following fields are required:
- * ```java
- * .expiresAt()
- * .value()
- * ```
- */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [RealtimeSessionClientSecret]. */
- class Builder internal constructor() {
-
- private var expiresAt: JsonField? = null
- private var value: JsonField? = null
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(realtimeSessionClientSecret: RealtimeSessionClientSecret) = apply {
- expiresAt = realtimeSessionClientSecret.expiresAt
- value = realtimeSessionClientSecret.value
- additionalProperties = realtimeSessionClientSecret.additionalProperties.toMutableMap()
- }
-
- /** Timestamp for when the token expires. Currently, all tokens expire after one minute. */
- fun expiresAt(expiresAt: Long) = expiresAt(JsonField.of(expiresAt))
-
- /**
- * Sets [Builder.expiresAt] to an arbitrary JSON value.
- *
- * You should usually call [Builder.expiresAt] with a well-typed [Long] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun expiresAt(expiresAt: JsonField) = apply { this.expiresAt = expiresAt }
-
- /**
- * Ephemeral key usable in client environments to authenticate connections to the Realtime
- * API. Use this in client-side environments rather than a standard API token, which should
- * only be used server-side.
- */
- fun value(value: String) = value(JsonField.of(value))
-
- /**
- * Sets [Builder.value] to an arbitrary JSON value.
- *
- * You should usually call [Builder.value] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun value(value: JsonField) = apply { this.value = value }
-
- fun additionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.clear()
- putAllAdditionalProperties(additionalProperties)
- }
-
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- additionalProperties.put(key, value)
- }
-
- fun putAllAdditionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.putAll(additionalProperties)
- }
-
- fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
-
- fun removeAllAdditionalProperties(keys: Set) = apply {
- keys.forEach(::removeAdditionalProperty)
- }
-
- /**
- * Returns an immutable instance of [RealtimeSessionClientSecret].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .expiresAt()
- * .value()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
- */
- fun build(): RealtimeSessionClientSecret =
- RealtimeSessionClientSecret(
- checkRequired("expiresAt", expiresAt),
- checkRequired("value", value),
- additionalProperties.toMutableMap(),
- )
- }
-
- private var validated: Boolean = false
-
- /**
- * Validates that the types of all values in this object match their expected types recursively.
- *
- * This method is _not_ forwards compatible with new types from the API for existing fields.
- *
- * @throws OpenAIInvalidDataException if any value type in this object doesn't match its
- * expected type.
- */
- fun validate(): RealtimeSessionClientSecret = apply {
- if (validated) {
- return@apply
- }
-
- expiresAt()
- value()
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: OpenAIInvalidDataException) {
- false
- }
-
- /**
- * Returns a score indicating how many valid values are contained in this object recursively.
- *
- * Used for best match union deserialization.
- */
- @JvmSynthetic
- internal fun validity(): Int =
- (if (expiresAt.asKnown().isPresent) 1 else 0) + (if (value.asKnown().isPresent) 1 else 0)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is RealtimeSessionClientSecret &&
- expiresAt == other.expiresAt &&
- value == other.value &&
- additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy { Objects.hash(expiresAt, value, additionalProperties) }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "RealtimeSessionClientSecret{expiresAt=$expiresAt, value=$value, additionalProperties=$additionalProperties}"
-}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt
index b9b5483bd..9af03c912 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/clientsecrets/RealtimeSessionCreateResponse.kt
@@ -30,6 +30,7 @@ import com.openai.models.realtime.AudioTranscription
import com.openai.models.realtime.NoiseReductionType
import com.openai.models.realtime.RealtimeAudioFormats
import com.openai.models.realtime.RealtimeFunctionTool
+import com.openai.models.realtime.RealtimeReasoning
import com.openai.models.realtime.RealtimeTruncation
import com.openai.models.realtime.RealtimeTruncationRetentionRatio
import com.openai.models.responses.ResponsePrompt
@@ -41,21 +42,22 @@ import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
-/**
- * A new Realtime session configuration, with an ephemeral key. Default TTL for keys is one minute.
- */
+/** A Realtime session configuration object. */
class RealtimeSessionCreateResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
- private val clientSecret: JsonField,
+ private val id: JsonField,
+ private val object_: JsonValue,
private val type: JsonValue,
private val audio: JsonField