openai 0.54.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/README.md +1 -1
  4. data/lib/openai/internal/type/enum.rb +4 -4
  5. data/lib/openai/models/audio/speech_create_params.rb +32 -8
  6. data/lib/openai/models/batch_create_params.rb +9 -6
  7. data/lib/openai/models/chat/chat_completion_audio_param.rb +30 -6
  8. data/lib/openai/models/chat_model.rb +4 -0
  9. data/lib/openai/models/comparison_filter.rb +2 -0
  10. data/lib/openai/models/realtime/realtime_audio_config_output.rb +34 -8
  11. data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +34 -8
  12. data/lib/openai/models/responses/namespace_tool.rb +13 -1
  13. data/lib/openai/models/responses/response_compact_params.rb +12 -0
  14. data/lib/openai/resources/audio/speech.rb +1 -1
  15. data/lib/openai/version.rb +1 -1
  16. data/rbi/openai/models/audio/speech_create_params.rbi +49 -10
  17. data/rbi/openai/models/batch_create_params.rbi +17 -9
  18. data/rbi/openai/models/chat/chat_completion_audio_param.rbi +40 -7
  19. data/rbi/openai/models/chat_model.rbi +6 -0
  20. data/rbi/openai/models/comparison_filter.rbi +2 -0
  21. data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +48 -11
  22. data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +48 -11
  23. data/rbi/openai/models/responses/namespace_tool.rbi +11 -0
  24. data/rbi/openai/models/responses/response_compact_params.rbi +20 -0
  25. data/rbi/openai/resources/audio/speech.rbi +8 -3
  26. data/rbi/openai/resources/batches.rbi +4 -3
  27. data/sig/openai/models/audio/speech_create_params.rbs +11 -0
  28. data/sig/openai/models/batch_create_params.rbs +2 -0
  29. data/sig/openai/models/chat/chat_completion_audio_param.rbs +11 -0
  30. data/sig/openai/models/chat_model.rbs +8 -0
  31. data/sig/openai/models/comparison_filter.rbs +3 -1
  32. data/sig/openai/models/realtime/realtime_audio_config_output.rbs +11 -0
  33. data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +11 -0
  34. data/sig/openai/models/responses/namespace_tool.rbs +7 -0
  35. data/sig/openai/models/responses/response_compact_params.rbs +8 -0
  36. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83d02aadc8a7e6f7b37049c3d9f4aeaea7431550be5d59b39125caac69dc0b8d
4
- data.tar.gz: 65952c4730694ec1d6d8e94975574830caaa4b00af59102004c22193eeddd084
3
+ metadata.gz: 8a0399e48fa95f65032c615357845d2a29d1c0ce34677cf08fc446657061fcc7
4
+ data.tar.gz: 52a29c39bcea24e9d9cac99bf840a7f5f4de0ca2ff20b897607dc86e5396eae4
5
5
  SHA512:
6
- metadata.gz: 0cdf744110926dcc10a24efcb6d945f23da0390a72827434ab6b0cd9308e1e5a9f64e6d7f8d304c206c146caf10fc8d06c242c3f6447ed7d052bb60f302f905a
7
- data.tar.gz: 5cc663414eead8566eaefb21714a5fad8e1bbaa5ed5f8b297d4af45909b4cc0ea34d96fa273cc85e587f4fa41cc263b0c5b88db67e4c22e24a10cbb48822165b
6
+ metadata.gz: 4efb1d88dae705b22655d2ba203fa0d05a6106f142683dcebf02de9002dece4dedf55422bb84cc3be58f73e2c6fe4a38dc5641abae5bc5a2ce9361e23737fec3
7
+ data.tar.gz: '091021a04c89b45d3ffc6cd8ee096adb98d7ef0bb886c6db3c48a66178d833044539664f4fdd9848326550b6c07f5123f5daeca737972523356b50368d558535'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.56.0 (2026-03-17)
4
+
5
+ Full Changelog: [v0.55.0...v0.56.0](https://github.com/openai/openai-ruby/compare/v0.55.0...v0.56.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** 5.4 nano and mini model slugs ([ce7f09d](https://github.com/openai/openai-ruby/commit/ce7f09dcafdb1a8259ce14d0e7c012b872469a32))
10
+ * **api:** add /v1/videos endpoint support to batch create params ([7a661eb](https://github.com/openai/openai-ruby/commit/7a661eb405c72bb2696e0acd327ecd56d7ed6c54))
11
+ * **api:** add defer_loading field to namespace_tool function ([2f3b9b7](https://github.com/openai/openai-ruby/commit/2f3b9b7a2fa7b63ed20d362a993d98d8cec72fc1))
12
+ * **api:** add in/nin operators to ComparisonFilter ([70c8bf5](https://github.com/openai/openai-ruby/commit/70c8bf55c4d0e2054e23972479edb09c0d8f3d8e))
13
+
14
+
15
+ ### Chores
16
+
17
+ * **internal:** tweak CI branches ([1a5054f](https://github.com/openai/openai-ruby/commit/1a5054f561a63a4b19c0d2a035e1c45dcfbc21fc))
18
+
19
+ ## 0.55.0 (2026-03-13)
20
+
21
+ Full Changelog: [v0.54.0...v0.55.0](https://github.com/openai/openai-ruby/compare/v0.54.0...v0.55.0)
22
+
23
+ ### Features
24
+
25
+ * **api:** custom voices ([a9f7891](https://github.com/openai/openai-ruby/commit/a9f78916b97e3a59f35dbcac05c725474e6634af))
26
+
3
27
  ## 0.54.0 (2026-03-13)
4
28
 
5
29
  Full Changelog: [v0.53.0...v0.54.0](https://github.com/openai/openai-ruby/compare/v0.53.0...v0.54.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "openai", "~> 0.54.0"
18
+ gem "openai", "~> 0.56.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -21,9 +21,9 @@ module OpenAI
21
21
  # case chat_model
22
22
  # when OpenAI::ChatModel::GPT_5_4
23
23
  # # ...
24
- # when OpenAI::ChatModel::GPT_5_3_CHAT_LATEST
24
+ # when OpenAI::ChatModel::GPT_5_4_MINI
25
25
  # # ...
26
- # when OpenAI::ChatModel::GPT_5_2
26
+ # when OpenAI::ChatModel::GPT_5_4_NANO
27
27
  # # ...
28
28
  # else
29
29
  # puts(chat_model)
@@ -33,9 +33,9 @@ module OpenAI
33
33
  # case chat_model
34
34
  # in :"gpt-5.4"
35
35
  # # ...
36
- # in :"gpt-5.3-chat-latest"
36
+ # in :"gpt-5.4-mini"
37
37
  # # ...
38
- # in :"gpt-5.2"
38
+ # in :"gpt-5.4-nano"
39
39
  # # ...
40
40
  # else
41
41
  # puts(chat_model)
@@ -24,11 +24,12 @@ module OpenAI
24
24
  # @!attribute voice
25
25
  # The voice to use when generating the audio. Supported built-in voices are
26
26
  # `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
27
- # `shimmer`, `verse`, `marin`, and `cedar`. Previews of the voices are available
28
- # in the
27
+ # `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
28
+ # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
29
+ # voices are available in the
29
30
  # [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
30
31
  #
31
- # @return [String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice]
32
+ # @return [String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice::ID, OpenAI::Models::Audio::SpeechCreateParams::Voice]
32
33
  required :voice, union: -> { OpenAI::Audio::SpeechCreateParams::Voice }
33
34
 
34
35
  # @!attribute instructions
@@ -67,7 +68,7 @@ module OpenAI
67
68
  #
68
69
  # @param model [String, Symbol, OpenAI::Models::Audio::SpeechModel] One of the available [TTS models](https://platform.openai.com/docs/models#tts):
69
70
  #
70
- # @param voice [String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice] The voice to use when generating the audio. Supported built-in voices are `alloy
71
+ # @param voice [String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice::ID, OpenAI::Models::Audio::SpeechCreateParams::Voice] The voice to use when generating the audio. Supported built-in voices are `alloy
71
72
  #
72
73
  # @param instructions [String] Control the voice of your generated audio with additional instructions. Does not
73
74
  #
@@ -95,8 +96,9 @@ module OpenAI
95
96
 
96
97
  # The voice to use when generating the audio. Supported built-in voices are
97
98
  # `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
98
- # `shimmer`, `verse`, `marin`, and `cedar`. Previews of the voices are available
99
- # in the
99
+ # `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
100
+ # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
101
+ # voices are available in the
100
102
  # [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
101
103
  module Voice
102
104
  extend OpenAI::Internal::Type::Union
@@ -123,11 +125,33 @@ module OpenAI
123
125
 
124
126
  variant const: -> { OpenAI::Models::Audio::SpeechCreateParams::Voice::CEDAR }
125
127
 
128
+ # Custom voice reference.
129
+ variant -> { OpenAI::Audio::SpeechCreateParams::Voice::ID }
130
+
131
+ class ID < OpenAI::Internal::Type::BaseModel
132
+ # @!attribute id
133
+ # The custom voice ID, e.g. `voice_1234`.
134
+ #
135
+ # @return [String]
136
+ required :id, String
137
+
138
+ # @!method initialize(id:)
139
+ # Custom voice reference.
140
+ #
141
+ # @param id [String] The custom voice ID, e.g. `voice_1234`.
142
+ end
143
+
126
144
  # @!method self.variants
127
- # @return [Array(String, Symbol)]
145
+ # @return [Array(String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice::ID)]
128
146
 
129
147
  define_sorbet_constant!(:Variants) do
130
- T.type_alias { T.any(String, OpenAI::Audio::SpeechCreateParams::Voice::TaggedSymbol) }
148
+ T.type_alias do
149
+ T.any(
150
+ String,
151
+ OpenAI::Audio::SpeechCreateParams::Voice::TaggedSymbol,
152
+ OpenAI::Audio::SpeechCreateParams::Voice::ID
153
+ )
154
+ end
131
155
  end
132
156
 
133
157
  # @!group
@@ -17,9 +17,10 @@ module OpenAI
17
17
  # @!attribute endpoint
18
18
  # The endpoint to be used for all requests in the batch. Currently
19
19
  # `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`,
20
- # `/v1/moderations`, `/v1/images/generations`, and `/v1/images/edits` are
21
- # supported. Note that `/v1/embeddings` batches are also restricted to a maximum
22
- # of 50,000 embedding inputs across all requests in the batch.
20
+ # `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and
21
+ # `/v1/videos` are supported. Note that `/v1/embeddings` batches are also
22
+ # restricted to a maximum of 50,000 embedding inputs across all requests in the
23
+ # batch.
23
24
  #
24
25
  # @return [Symbol, OpenAI::Models::BatchCreateParams::Endpoint]
25
26
  required :endpoint, enum: -> { OpenAI::BatchCreateParams::Endpoint }
@@ -85,9 +86,10 @@ module OpenAI
85
86
 
86
87
  # The endpoint to be used for all requests in the batch. Currently
87
88
  # `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`,
88
- # `/v1/moderations`, `/v1/images/generations`, and `/v1/images/edits` are
89
- # supported. Note that `/v1/embeddings` batches are also restricted to a maximum
90
- # of 50,000 embedding inputs across all requests in the batch.
89
+ # `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and
90
+ # `/v1/videos` are supported. Note that `/v1/embeddings` batches are also
91
+ # restricted to a maximum of 50,000 embedding inputs across all requests in the
92
+ # batch.
91
93
  module Endpoint
92
94
  extend OpenAI::Internal::Type::Enum
93
95
 
@@ -98,6 +100,7 @@ module OpenAI
98
100
  V1_MODERATIONS = :"/v1/moderations"
99
101
  V1_IMAGES_GENERATIONS = :"/v1/images/generations"
100
102
  V1_IMAGES_EDITS = :"/v1/images/edits"
103
+ V1_VIDEOS = :"/v1/videos"
101
104
 
102
105
  # @!method self.values
103
106
  # @return [Array<Symbol>]
@@ -14,9 +14,10 @@ module OpenAI
14
14
  # @!attribute voice
15
15
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
16
16
  # `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, `shimmer`,
17
- # `marin`, and `cedar`.
17
+ # `marin`, and `cedar`. You may also provide a custom voice object with an `id`,
18
+ # for example `{ "id": "voice_1234" }`.
18
19
  #
19
- # @return [String, Symbol, OpenAI::Models::Chat::ChatCompletionAudioParam::Voice]
20
+ # @return [String, Symbol, OpenAI::Models::Chat::ChatCompletionAudioParam::Voice::ID, OpenAI::Models::Chat::ChatCompletionAudioParam::Voice]
20
21
  required :voice, union: -> { OpenAI::Chat::ChatCompletionAudioParam::Voice }
21
22
 
22
23
  # @!method initialize(format_:, voice:)
@@ -29,7 +30,7 @@ module OpenAI
29
30
  #
30
31
  # @param format_ [Symbol, OpenAI::Models::Chat::ChatCompletionAudioParam::Format] Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`,
31
32
  #
32
- # @param voice [String, Symbol, OpenAI::Models::Chat::ChatCompletionAudioParam::Voice] The voice the model uses to respond. Supported built-in voices are `alloy`, `ash
33
+ # @param voice [String, Symbol, OpenAI::Models::Chat::ChatCompletionAudioParam::Voice::ID, OpenAI::Models::Chat::ChatCompletionAudioParam::Voice] The voice the model uses to respond. Supported built-in voices are
33
34
 
34
35
  # Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, `opus`,
35
36
  # or `pcm16`.
@@ -51,7 +52,8 @@ module OpenAI
51
52
 
52
53
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
53
54
  # `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, `shimmer`,
54
- # `marin`, and `cedar`.
55
+ # `marin`, and `cedar`. You may also provide a custom voice object with an `id`,
56
+ # for example `{ "id": "voice_1234" }`.
55
57
  #
56
58
  # @see OpenAI::Models::Chat::ChatCompletionAudioParam#voice
57
59
  module Voice
@@ -79,11 +81,33 @@ module OpenAI
79
81
 
80
82
  variant const: -> { OpenAI::Models::Chat::ChatCompletionAudioParam::Voice::CEDAR }
81
83
 
84
+ # Custom voice reference.
85
+ variant -> { OpenAI::Chat::ChatCompletionAudioParam::Voice::ID }
86
+
87
+ class ID < OpenAI::Internal::Type::BaseModel
88
+ # @!attribute id
89
+ # The custom voice ID, e.g. `voice_1234`.
90
+ #
91
+ # @return [String]
92
+ required :id, String
93
+
94
+ # @!method initialize(id:)
95
+ # Custom voice reference.
96
+ #
97
+ # @param id [String] The custom voice ID, e.g. `voice_1234`.
98
+ end
99
+
82
100
  # @!method self.variants
83
- # @return [Array(String, Symbol)]
101
+ # @return [Array(String, Symbol, OpenAI::Models::Chat::ChatCompletionAudioParam::Voice::ID)]
84
102
 
85
103
  define_sorbet_constant!(:Variants) do
86
- T.type_alias { T.any(String, OpenAI::Chat::ChatCompletionAudioParam::Voice::TaggedSymbol) }
104
+ T.type_alias do
105
+ T.any(
106
+ String,
107
+ OpenAI::Chat::ChatCompletionAudioParam::Voice::TaggedSymbol,
108
+ OpenAI::Chat::ChatCompletionAudioParam::Voice::ID
109
+ )
110
+ end
87
111
  end
88
112
 
89
113
  # @!group
@@ -6,6 +6,10 @@ module OpenAI
6
6
  extend OpenAI::Internal::Type::Enum
7
7
 
8
8
  GPT_5_4 = :"gpt-5.4"
9
+ GPT_5_4_MINI = :"gpt-5.4-mini"
10
+ GPT_5_4_NANO = :"gpt-5.4-nano"
11
+ GPT_5_4_MINI_2026_03_17 = :"gpt-5.4-mini-2026-03-17"
12
+ GPT_5_4_NANO_2026_03_17 = :"gpt-5.4-nano-2026-03-17"
9
13
  GPT_5_3_CHAT_LATEST = :"gpt-5.3-chat-latest"
10
14
  GPT_5_2 = :"gpt-5.2"
11
15
  GPT_5_2_2025_12_11 = :"gpt-5.2-2025-12-11"
@@ -67,6 +67,8 @@ module OpenAI
67
67
  GTE = :gte
68
68
  LT = :lt
69
69
  LTE = :lte
70
+ IN = :in
71
+ NIN = :nin
70
72
 
71
73
  # @!method self.values
72
74
  # @return [Array<Symbol>]
@@ -25,10 +25,12 @@ module OpenAI
25
25
  # @!attribute voice
26
26
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
27
27
  # `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`, and
28
- # `cedar`. Voice cannot be changed during the session once the model has responded
29
- # with audio at least once. We recommend `marin` and `cedar` for best quality.
28
+ # `cedar`. You may also provide a custom voice object with an `id`, for example
29
+ # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
30
+ # model has responded with audio at least once. We recommend `marin` and `cedar`
31
+ # for best quality.
30
32
  #
31
- # @return [String, Symbol, OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice, nil]
33
+ # @return [String, Symbol, OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice::ID, OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice, nil]
32
34
  optional :voice, union: -> { OpenAI::Realtime::RealtimeAudioConfigOutput::Voice }
33
35
 
34
36
  # @!method initialize(format_: nil, speed: nil, voice: nil)
@@ -39,12 +41,14 @@ module OpenAI
39
41
  #
40
42
  # @param speed [Float] The speed of the model's spoken response as a multiple of the original speed.
41
43
  #
42
- # @param voice [String, Symbol, OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice] The voice the model uses to respond. Supported built-in voices are `alloy`, `ash
44
+ # @param voice [String, Symbol, OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice::ID, OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice] The voice the model uses to respond. Supported built-in voices are
43
45
 
44
46
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
45
47
  # `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`, and
46
- # `cedar`. Voice cannot be changed during the session once the model has responded
47
- # with audio at least once. We recommend `marin` and `cedar` for best quality.
48
+ # `cedar`. You may also provide a custom voice object with an `id`, for example
49
+ # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
50
+ # model has responded with audio at least once. We recommend `marin` and `cedar`
51
+ # for best quality.
48
52
  #
49
53
  # @see OpenAI::Models::Realtime::RealtimeAudioConfigOutput#voice
50
54
  module Voice
@@ -72,11 +76,33 @@ module OpenAI
72
76
 
73
77
  variant const: -> { OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice::CEDAR }
74
78
 
79
+ # Custom voice reference.
80
+ variant -> { OpenAI::Realtime::RealtimeAudioConfigOutput::Voice::ID }
81
+
82
+ class ID < OpenAI::Internal::Type::BaseModel
83
+ # @!attribute id
84
+ # The custom voice ID, e.g. `voice_1234`.
85
+ #
86
+ # @return [String]
87
+ required :id, String
88
+
89
+ # @!method initialize(id:)
90
+ # Custom voice reference.
91
+ #
92
+ # @param id [String] The custom voice ID, e.g. `voice_1234`.
93
+ end
94
+
75
95
  # @!method self.variants
76
- # @return [Array(String, Symbol)]
96
+ # @return [Array(String, Symbol, OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice::ID)]
77
97
 
78
98
  define_sorbet_constant!(:Variants) do
79
- T.type_alias { T.any(String, OpenAI::Realtime::RealtimeAudioConfigOutput::Voice::TaggedSymbol) }
99
+ T.type_alias do
100
+ T.any(
101
+ String,
102
+ OpenAI::Realtime::RealtimeAudioConfigOutput::Voice::TaggedSymbol,
103
+ OpenAI::Realtime::RealtimeAudioConfigOutput::Voice::ID
104
+ )
105
+ end
80
106
  end
81
107
 
82
108
  # @!group
@@ -25,10 +25,12 @@ module OpenAI
25
25
  # @!attribute voice
26
26
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
27
27
  # `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`, and
28
- # `cedar`. Voice cannot be changed during the session once the model has responded
29
- # with audio at least once.
28
+ # `cedar`. You may also provide a custom voice object with an `id`, for example
29
+ # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
30
+ # model has responded with audio at least once. We recommend `marin` and `cedar`
31
+ # for best quality.
30
32
  #
31
- # @return [String, Symbol, OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice, nil]
33
+ # @return [String, Symbol, OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice::ID, OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice, nil]
32
34
  optional :voice, union: -> { OpenAI::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice }
33
35
 
34
36
  # @!method initialize(format_: nil, voice: nil)
@@ -38,12 +40,14 @@ module OpenAI
38
40
  #
39
41
  # @param format_ [OpenAI::Models::Realtime::RealtimeAudioFormats::AudioPCM, OpenAI::Models::Realtime::RealtimeAudioFormats::AudioPCMU, OpenAI::Models::Realtime::RealtimeAudioFormats::AudioPCMA] The format of the output audio.
40
42
  #
41
- # @param voice [String, Symbol, OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice] The voice the model uses to respond. Supported built-in voices are `alloy`, `ash
43
+ # @param voice [String, Symbol, OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice::ID, OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice] The voice the model uses to respond. Supported built-in voices are
42
44
 
43
45
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
44
46
  # `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`, and
45
- # `cedar`. Voice cannot be changed during the session once the model has responded
46
- # with audio at least once.
47
+ # `cedar`. You may also provide a custom voice object with an `id`, for example
48
+ # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
49
+ # model has responded with audio at least once. We recommend `marin` and `cedar`
50
+ # for best quality.
47
51
  #
48
52
  # @see OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output#voice
49
53
  module Voice
@@ -71,11 +75,33 @@ module OpenAI
71
75
 
72
76
  variant const: -> { OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice::CEDAR }
73
77
 
78
+ # Custom voice reference.
79
+ variant -> { OpenAI::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice::ID }
80
+
81
+ class ID < OpenAI::Internal::Type::BaseModel
82
+ # @!attribute id
83
+ # The custom voice ID, e.g. `voice_1234`.
84
+ #
85
+ # @return [String]
86
+ required :id, String
87
+
88
+ # @!method initialize(id:)
89
+ # Custom voice reference.
90
+ #
91
+ # @param id [String] The custom voice ID, e.g. `voice_1234`.
92
+ end
93
+
74
94
  # @!method self.variants
75
- # @return [Array(String, Symbol)]
95
+ # @return [Array(String, Symbol, OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice::ID)]
76
96
 
77
97
  define_sorbet_constant!(:Variants) do
78
- T.type_alias { T.any(String, OpenAI::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice::TaggedSymbol) }
98
+ T.type_alias do
99
+ T.any(
100
+ String,
101
+ OpenAI::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice::TaggedSymbol,
102
+ OpenAI::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice::ID
103
+ )
104
+ end
79
105
  end
80
106
 
81
107
  # @!group
@@ -61,6 +61,12 @@ module OpenAI
61
61
  # @return [Symbol, :function]
62
62
  required :type, const: :function
63
63
 
64
+ # @!attribute defer_loading
65
+ # Whether this function should be deferred and discovered via tool search.
66
+ #
67
+ # @return [Boolean, nil]
68
+ optional :defer_loading, OpenAI::Internal::Type::Boolean
69
+
64
70
  # @!attribute description
65
71
  #
66
72
  # @return [String, nil]
@@ -76,11 +82,17 @@ module OpenAI
76
82
  # @return [Boolean, nil]
77
83
  optional :strict, OpenAI::Internal::Type::Boolean, nil?: true
78
84
 
79
- # @!method initialize(name:, description: nil, parameters: nil, strict: nil, type: :function)
85
+ # @!method initialize(name:, defer_loading: nil, description: nil, parameters: nil, strict: nil, type: :function)
80
86
  # @param name [String]
87
+ #
88
+ # @param defer_loading [Boolean] Whether this function should be deferred and discovered via tool search.
89
+ #
81
90
  # @param description [String, nil]
91
+ #
82
92
  # @param parameters [Object, nil]
93
+ #
83
94
  # @param strict [Boolean, nil]
95
+ #
84
96
  # @param type [Symbol, :function]
85
97
  end
86
98
 
@@ -74,6 +74,14 @@ module OpenAI
74
74
 
75
75
  variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_5_4 }
76
76
 
77
+ variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_5_4_MINI }
78
+
79
+ variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_5_4_NANO }
80
+
81
+ variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_5_4_MINI_2026_03_17 }
82
+
83
+ variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_5_4_NANO_2026_03_17 }
84
+
77
85
  variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_5_3_CHAT_LATEST }
78
86
 
79
87
  variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_5_2 }
@@ -260,6 +268,10 @@ module OpenAI
260
268
  # @!group
261
269
 
262
270
  GPT_5_4 = :"gpt-5.4"
271
+ GPT_5_4_MINI = :"gpt-5.4-mini"
272
+ GPT_5_4_NANO = :"gpt-5.4-nano"
273
+ GPT_5_4_MINI_2026_03_17 = :"gpt-5.4-mini-2026-03-17"
274
+ GPT_5_4_NANO_2026_03_17 = :"gpt-5.4-nano-2026-03-17"
263
275
  GPT_5_3_CHAT_LATEST = :"gpt-5.3-chat-latest"
264
276
  GPT_5_2 = :"gpt-5.2"
265
277
  GPT_5_2_2025_12_11 = :"gpt-5.2-2025-12-11"
@@ -18,7 +18,7 @@ module OpenAI
18
18
  #
19
19
  # @param model [String, Symbol, OpenAI::Models::Audio::SpeechModel] One of the available [TTS models](https://platform.openai.com/docs/models#tts):
20
20
  #
21
- # @param voice [String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice] The voice to use when generating the audio. Supported built-in voices are `alloy
21
+ # @param voice [String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice::ID, OpenAI::Models::Audio::SpeechCreateParams::Voice] The voice to use when generating the audio. Supported built-in voices are `alloy
22
22
  #
23
23
  # @param instructions [String] Control the voice of your generated audio with additional instructions. Does not
24
24
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.54.0"
4
+ VERSION = "0.56.0"
5
5
  end
@@ -23,12 +23,17 @@ module OpenAI
23
23
 
24
24
  # The voice to use when generating the audio. Supported built-in voices are
25
25
  # `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
26
- # `shimmer`, `verse`, `marin`, and `cedar`. Previews of the voices are available
27
- # in the
26
+ # `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
27
+ # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
28
+ # voices are available in the
28
29
  # [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
29
30
  sig do
30
31
  returns(
31
- T.any(String, OpenAI::Audio::SpeechCreateParams::Voice::OrSymbol)
32
+ T.any(
33
+ String,
34
+ OpenAI::Audio::SpeechCreateParams::Voice::OrSymbol,
35
+ OpenAI::Audio::SpeechCreateParams::Voice::ID
36
+ )
32
37
  )
33
38
  end
34
39
  attr_accessor :voice
@@ -90,7 +95,11 @@ module OpenAI
90
95
  input: String,
91
96
  model: T.any(String, OpenAI::Audio::SpeechModel::OrSymbol),
92
97
  voice:
93
- T.any(String, OpenAI::Audio::SpeechCreateParams::Voice::OrSymbol),
98
+ T.any(
99
+ String,
100
+ OpenAI::Audio::SpeechCreateParams::Voice::OrSymbol,
101
+ OpenAI::Audio::SpeechCreateParams::Voice::ID::OrHash
102
+ ),
94
103
  instructions: String,
95
104
  response_format:
96
105
  OpenAI::Audio::SpeechCreateParams::ResponseFormat::OrSymbol,
@@ -108,8 +117,9 @@ module OpenAI
108
117
  model:,
109
118
  # The voice to use when generating the audio. Supported built-in voices are
110
119
  # `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
111
- # `shimmer`, `verse`, `marin`, and `cedar`. Previews of the voices are available
112
- # in the
120
+ # `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
121
+ # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
122
+ # voices are available in the
113
123
  # [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
114
124
  voice:,
115
125
  # Control the voice of your generated audio with additional instructions. Does not
@@ -136,7 +146,8 @@ module OpenAI
136
146
  voice:
137
147
  T.any(
138
148
  String,
139
- OpenAI::Audio::SpeechCreateParams::Voice::OrSymbol
149
+ OpenAI::Audio::SpeechCreateParams::Voice::OrSymbol,
150
+ OpenAI::Audio::SpeechCreateParams::Voice::ID
140
151
  ),
141
152
  instructions: String,
142
153
  response_format:
@@ -172,8 +183,9 @@ module OpenAI
172
183
 
173
184
  # The voice to use when generating the audio. Supported built-in voices are
174
185
  # `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
175
- # `shimmer`, `verse`, `marin`, and `cedar`. Previews of the voices are available
176
- # in the
186
+ # `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
187
+ # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
188
+ # voices are available in the
177
189
  # [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
178
190
  module Voice
179
191
  extend OpenAI::Internal::Type::Union
@@ -182,10 +194,37 @@ module OpenAI
182
194
  T.type_alias do
183
195
  T.any(
184
196
  String,
185
- OpenAI::Audio::SpeechCreateParams::Voice::TaggedSymbol
197
+ OpenAI::Audio::SpeechCreateParams::Voice::TaggedSymbol,
198
+ OpenAI::Audio::SpeechCreateParams::Voice::ID
186
199
  )
187
200
  end
188
201
 
202
+ class ID < OpenAI::Internal::Type::BaseModel
203
+ OrHash =
204
+ T.type_alias do
205
+ T.any(
206
+ OpenAI::Audio::SpeechCreateParams::Voice::ID,
207
+ OpenAI::Internal::AnyHash
208
+ )
209
+ end
210
+
211
+ # The custom voice ID, e.g. `voice_1234`.
212
+ sig { returns(String) }
213
+ attr_accessor :id
214
+
215
+ # Custom voice reference.
216
+ sig { params(id: String).returns(T.attached_class) }
217
+ def self.new(
218
+ # The custom voice ID, e.g. `voice_1234`.
219
+ id:
220
+ )
221
+ end
222
+
223
+ sig { override.returns({ id: String }) }
224
+ def to_hash
225
+ end
226
+ end
227
+
189
228
  sig do
190
229
  override.returns(
191
230
  T::Array[OpenAI::Audio::SpeechCreateParams::Voice::Variants]