openai 0.97.0 → 0.99.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 (244) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/README.md +76 -1
  4. data/lib/openai/helpers/agents/session_stream.rb +60 -3
  5. data/lib/openai/helpers/beta/agents/artifacts.rb +72 -0
  6. data/lib/openai/helpers/beta/agents/creation_stream.rb +69 -0
  7. data/lib/openai/helpers/beta/agents/files.rb +236 -0
  8. data/lib/openai/helpers/beta/agents/function_tool.rb +65 -0
  9. data/lib/openai/helpers/beta/agents/model_adapter.rb +27 -0
  10. data/lib/openai/helpers/beta/agents/result.rb +170 -0
  11. data/lib/openai/helpers/beta/agents/typed_output.rb +191 -0
  12. data/lib/openai/helpers/live/websocket.rb +7 -1
  13. data/lib/openai/helpers/realtime/conversation_item_variant_resolver.rb +1 -1
  14. data/lib/openai/helpers/responses_websocket/connection.rb +7 -1
  15. data/lib/openai/helpers/responses_websocket/session.rb +5 -1
  16. data/lib/openai/helpers/responses_websocket/transports/async_websocket.rb +12 -2
  17. data/lib/openai/internal/transport/base_client.rb +18 -0
  18. data/lib/openai/internal/type/array_of.rb +1 -1
  19. data/lib/openai/internal/type/base_model.rb +6 -3
  20. data/lib/openai/internal/type/converter.rb +50 -3
  21. data/lib/openai/internal/type/hash_of.rb +1 -1
  22. data/lib/openai/internal/type/union.rb +6 -6
  23. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +16 -3
  24. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +16 -3
  25. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +16 -3
  26. data/lib/openai/models/admin/organization/usage_completions_response.rb +16 -3
  27. data/lib/openai/models/admin/organization/usage_costs_response.rb +16 -3
  28. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +16 -3
  29. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +16 -3
  30. data/lib/openai/models/admin/organization/usage_images_response.rb +16 -3
  31. data/lib/openai/models/admin/organization/usage_moderations_response.rb +16 -3
  32. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +16 -3
  33. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +16 -3
  34. data/lib/openai/models/all_models.rb +42 -0
  35. data/lib/openai/models/audio/speech_create_params.rb +6 -0
  36. data/lib/openai/models/audio/voice.rb +75 -0
  37. data/lib/openai/models/audio/voice_create_params.rb +217 -0
  38. data/lib/openai/models/beta/agent_create_params.rb +0 -3
  39. data/lib/openai/models/beta/agent_update_params.rb +0 -3
  40. data/lib/openai/models/beta/agents/session_create_params.rb +0 -3
  41. data/lib/openai/models/beta/agents/session_update_params.rb +0 -3
  42. data/lib/openai/models/beta/agents/sessions/session_trace.rb +64 -0
  43. data/lib/openai/models/beta/agents/sessions/trace_list_params.rb +68 -0
  44. data/lib/openai/models/beta/agents/vaults/credential.rb +8 -4
  45. data/lib/openai/models/beta/beta_response.rb +220 -0
  46. data/lib/openai/models/beta/beta_response_output_text.rb +2 -2
  47. data/lib/openai/models/beta/beta_response_output_text_annotation_added_event.rb +2 -2
  48. data/lib/openai/models/beta/beta_responses_client_event.rb +220 -0
  49. data/lib/openai/models/beta/beta_tool.rb +3 -9
  50. data/lib/openai/models/beta/environment.rb +33 -1
  51. data/lib/openai/models/beta/environment_param.rb +24 -1
  52. data/lib/openai/models/beta/response_compact_params.rb +220 -0
  53. data/lib/openai/models/beta/response_create_params.rb +220 -0
  54. data/lib/openai/models/beta/session_turn_error.rb +3 -0
  55. data/lib/openai/models/chat/chat_completion_audio_param.rb +6 -3
  56. data/lib/openai/models/chat/chat_completion_content_part_image.rb +1 -0
  57. data/lib/openai/models/chat_model.rb +178 -0
  58. data/lib/openai/models/image.rb +14 -14
  59. data/lib/openai/models/image_create_variation_params.rb +7 -7
  60. data/lib/openai/models/image_edit_params.rb +76 -87
  61. data/lib/openai/models/image_generate_params.rb +51 -62
  62. data/lib/openai/models/image_model.rb +5 -3
  63. data/lib/openai/models/live/fork_server_event.rb +14 -3
  64. data/lib/openai/models/live/server_event.rb +14 -3
  65. data/lib/openai/models/realtime/realtime_audio_config_output.rb +9 -6
  66. data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +9 -6
  67. data/lib/openai/models/realtime/translations/client_secret_create_params.rb +28 -0
  68. data/lib/openai/models/responses/response_compact_params.rb +220 -0
  69. data/lib/openai/models/responses/response_output_text.rb +2 -2
  70. data/lib/openai/models/responses/response_output_text_annotation_added_event.rb +2 -2
  71. data/lib/openai/models/responses/tool.rb +3 -9
  72. data/lib/openai/models/responses_model.rb +42 -0
  73. data/lib/openai/models/webhooks/agent_session_action_required_webhook_event.rb +109 -0
  74. data/lib/openai/models/webhooks/agent_session_created_webhook_event.rb +106 -0
  75. data/lib/openai/models/webhooks/agent_session_failed_webhook_event.rb +86 -0
  76. data/lib/openai/models/webhooks/agent_session_idle_webhook_event.rb +86 -0
  77. data/lib/openai/models/webhooks/agent_session_in_progress_webhook_event.rb +86 -0
  78. data/lib/openai/models/webhooks/unwrap_webhook_event.rb +18 -2
  79. data/lib/openai/models/webhooks/webhook_create_params.rb +5 -0
  80. data/lib/openai/models/webhooks/webhook_test_params.rb +5 -0
  81. data/lib/openai/models/webhooks/webhook_update_params.rb +5 -0
  82. data/lib/openai/resources/audio/speech.rb +2 -0
  83. data/lib/openai/resources/audio/voices.rb +53 -0
  84. data/lib/openai/resources/audio.rb +5 -0
  85. data/lib/openai/resources/beta/agents/environments/files.rb +31 -0
  86. data/lib/openai/resources/beta/agents/sessions/artifacts.rb +8 -0
  87. data/lib/openai/resources/beta/agents/sessions/events.rb +6 -5
  88. data/lib/openai/resources/beta/agents/sessions/traces.rb +58 -0
  89. data/lib/openai/resources/beta/agents/sessions.rb +18 -5
  90. data/lib/openai/resources/evals/runs.rb +1 -1
  91. data/lib/openai/resources/images.rb +71 -103
  92. data/lib/openai/resources/realtime/translations/client_secrets.rb +58 -0
  93. data/lib/openai/resources/realtime/translations.rb +20 -0
  94. data/lib/openai/resources/realtime.rb +4 -0
  95. data/lib/openai/resources/webhooks.rb +1 -1
  96. data/lib/openai/version.rb +1 -1
  97. data/lib/openai.rb +17 -1
  98. data/rbi/openai/helpers/agents.rbi +20 -1
  99. data/rbi/openai/helpers/beta/agents/artifacts.rbi +29 -0
  100. data/rbi/openai/helpers/beta/agents/files.rbi +65 -0
  101. data/rbi/openai/helpers/beta/agents/function_tool.rbi +40 -0
  102. data/rbi/openai/helpers/beta/agents/model_adapter.rbi +22 -0
  103. data/rbi/openai/helpers/beta/agents.rbi +146 -0
  104. data/rbi/openai/internal/transport/base_client.rbi +12 -0
  105. data/rbi/openai/internal/type/base_model.rbi +2 -2
  106. data/rbi/openai/internal/type/converter.rbi +21 -3
  107. data/rbi/openai/internal/type/union.rbi +6 -2
  108. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +19 -2
  109. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +19 -2
  110. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +19 -2
  111. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +19 -2
  112. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +19 -2
  113. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +19 -2
  114. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +19 -2
  115. data/rbi/openai/models/admin/organization/usage_images_response.rbi +19 -2
  116. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +19 -2
  117. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +19 -2
  118. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +19 -2
  119. data/rbi/openai/models/audio/speech_create_params.rbi +6 -0
  120. data/rbi/openai/models/audio/voice.rbi +111 -0
  121. data/rbi/openai/models/audio/voice_create_params.rbi +321 -0
  122. data/rbi/openai/models/beta/agent_create_params.rbi +0 -3
  123. data/rbi/openai/models/beta/agent_update_params.rbi +0 -3
  124. data/rbi/openai/models/beta/agents/session_create_params.rbi +0 -3
  125. data/rbi/openai/models/beta/agents/session_update_params.rbi +0 -3
  126. data/rbi/openai/models/beta/agents/sessions/session_trace.rbi +97 -0
  127. data/rbi/openai/models/beta/agents/sessions/trace_list_params.rbi +121 -0
  128. data/rbi/openai/models/beta/agents/vaults/credential.rbi +5 -5
  129. data/rbi/openai/models/beta/beta_response_output_text.rbi +2 -2
  130. data/rbi/openai/models/beta/beta_response_output_text_annotation_added_event.rbi +2 -2
  131. data/rbi/openai/models/beta/beta_tool.rbi +3 -9
  132. data/rbi/openai/models/beta/environment.rbi +29 -0
  133. data/rbi/openai/models/beta/environment_param.rbi +31 -0
  134. data/rbi/openai/models/beta/session_turn_error.rbi +3 -0
  135. data/rbi/openai/models/chat/chat_completion_audio_param.rbi +6 -3
  136. data/rbi/openai/models/chat/chat_completion_content_part_image.rbi +1 -0
  137. data/rbi/openai/models/image.rbi +14 -14
  138. data/rbi/openai/models/image_create_variation_params.rbi +6 -6
  139. data/rbi/openai/models/image_edit_params.rbi +61 -82
  140. data/rbi/openai/models/image_generate_params.rbi +30 -61
  141. data/rbi/openai/models/image_model.rbi +3 -3
  142. data/rbi/openai/models/live/fork_server_event.rbi +14 -2
  143. data/rbi/openai/models/live/server_event.rbi +14 -2
  144. data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +9 -6
  145. data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +9 -6
  146. data/rbi/openai/models/realtime/translations/client_secret_create_params.rbi +68 -0
  147. data/rbi/openai/models/responses/response_output_text.rbi +2 -2
  148. data/rbi/openai/models/responses/response_output_text_annotation_added_event.rbi +2 -2
  149. data/rbi/openai/models/responses/tool.rbi +3 -9
  150. data/rbi/openai/models/webhooks/agent_session_action_required_webhook_event.rbi +222 -0
  151. data/rbi/openai/models/webhooks/agent_session_created_webhook_event.rbi +202 -0
  152. data/rbi/openai/models/webhooks/agent_session_failed_webhook_event.rbi +151 -0
  153. data/rbi/openai/models/webhooks/agent_session_idle_webhook_event.rbi +151 -0
  154. data/rbi/openai/models/webhooks/agent_session_in_progress_webhook_event.rbi +151 -0
  155. data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +7 -1
  156. data/rbi/openai/models/webhooks/webhook_create_params.rbi +20 -0
  157. data/rbi/openai/models/webhooks/webhook_test_params.rbi +20 -0
  158. data/rbi/openai/models/webhooks/webhook_update_params.rbi +20 -0
  159. data/rbi/openai/resources/audio/speech.rbi +2 -0
  160. data/rbi/openai/resources/audio/voices.rbi +49 -0
  161. data/rbi/openai/resources/audio.rbi +4 -0
  162. data/rbi/openai/resources/beta/agents/environments/files.rbi +31 -0
  163. data/rbi/openai/resources/beta/agents/sessions/artifacts.rbi +8 -0
  164. data/rbi/openai/resources/beta/agents/sessions/events.rbi +6 -5
  165. data/rbi/openai/resources/beta/agents/sessions/traces.rbi +54 -0
  166. data/rbi/openai/resources/beta/agents/sessions.rbi +6 -1
  167. data/rbi/openai/resources/images.rbi +69 -103
  168. data/rbi/openai/resources/realtime/translations/client_secrets.rbi +54 -0
  169. data/rbi/openai/resources/realtime/translations.rbi +22 -0
  170. data/rbi/openai/resources/realtime.rbi +3 -0
  171. data/rbi/openai/resources/webhooks.rbi +5 -0
  172. data/sig/openai/helpers/agents.rbs +7 -0
  173. data/sig/openai/helpers/beta/agents/artifacts.rbs +20 -0
  174. data/sig/openai/helpers/beta/agents/files.rbs +41 -0
  175. data/sig/openai/helpers/beta/agents/function_tool.rbs +24 -0
  176. data/sig/openai/helpers/beta/agents/model_adapter.rbs +16 -0
  177. data/sig/openai/helpers/beta/agents.rbs +71 -0
  178. data/sig/openai/helpers/structured_output.rbs +12 -0
  179. data/sig/openai/internal/transport/base_client.rbs +8 -0
  180. data/sig/openai/internal/type/base_model.rbs +3 -1
  181. data/sig/openai/internal/type/converter.rbs +16 -2
  182. data/sig/openai/internal/type/union.rbs +2 -1
  183. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +20 -3
  184. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +20 -3
  185. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +20 -3
  186. data/sig/openai/models/admin/organization/usage_completions_response.rbs +20 -3
  187. data/sig/openai/models/admin/organization/usage_costs_response.rbs +20 -3
  188. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +20 -3
  189. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +20 -3
  190. data/sig/openai/models/admin/organization/usage_images_response.rbs +20 -3
  191. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +20 -3
  192. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +20 -3
  193. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +20 -3
  194. data/sig/openai/models/audio/speech_create_params.rbs +4 -0
  195. data/sig/openai/models/audio/voice.rbs +70 -0
  196. data/sig/openai/models/audio/voice_create_params.rbs +203 -0
  197. data/sig/openai/models/beta/agent_create_params.rbs +1 -5
  198. data/sig/openai/models/beta/agent_update_params.rbs +1 -5
  199. data/sig/openai/models/beta/agents/session_create_params.rbs +1 -5
  200. data/sig/openai/models/beta/agents/session_update_params.rbs +1 -5
  201. data/sig/openai/models/beta/agents/sessions/session_trace.rbs +65 -0
  202. data/sig/openai/models/beta/agents/sessions/trace_list_params.rbs +81 -0
  203. data/sig/openai/models/beta/agents/vaults/credential.rbs +5 -5
  204. data/sig/openai/models/beta/beta_response_output_text.rbs +2 -2
  205. data/sig/openai/models/beta/beta_response_output_text_annotation_added_event.rbs +2 -2
  206. data/sig/openai/models/beta/beta_tool.rbs +3 -9
  207. data/sig/openai/models/beta/environment.rbs +22 -0
  208. data/sig/openai/models/beta/environment_param.rbs +25 -0
  209. data/sig/openai/models/beta/session_turn_error.rbs +4 -0
  210. data/sig/openai/models/chat/chat_completion_audio_param.rbs +4 -2
  211. data/sig/openai/models/chat/chat_completion_content_part_image.rbs +2 -1
  212. data/sig/openai/models/image.rbs +21 -21
  213. data/sig/openai/models/image_create_variation_params.rbs +4 -4
  214. data/sig/openai/models/image_edit_params.rbs +46 -60
  215. data/sig/openai/models/image_generate_params.rbs +23 -45
  216. data/sig/openai/models/image_model.rbs +6 -6
  217. data/sig/openai/models/live/fork_server_event.rbs +17 -2
  218. data/sig/openai/models/live/server_event.rbs +17 -2
  219. data/sig/openai/models/realtime/realtime_audio_config_output.rbs +9 -6
  220. data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +9 -6
  221. data/sig/openai/models/realtime/translations/client_secret_create_params.rbs +39 -0
  222. data/sig/openai/models/responses/response_output_text.rbs +2 -2
  223. data/sig/openai/models/responses/response_output_text_annotation_added_event.rbs +2 -2
  224. data/sig/openai/models/responses/tool.rbs +3 -9
  225. data/sig/openai/models/webhooks/agent_session_action_required_webhook_event.rbs +114 -0
  226. data/sig/openai/models/webhooks/agent_session_created_webhook_event.rbs +115 -0
  227. data/sig/openai/models/webhooks/agent_session_failed_webhook_event.rbs +89 -0
  228. data/sig/openai/models/webhooks/agent_session_idle_webhook_event.rbs +89 -0
  229. data/sig/openai/models/webhooks/agent_session_in_progress_webhook_event.rbs +89 -0
  230. data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +6 -1
  231. data/sig/openai/models/webhooks/webhook_create_params.rbs +10 -0
  232. data/sig/openai/models/webhooks/webhook_test_params.rbs +10 -0
  233. data/sig/openai/models/webhooks/webhook_update_params.rbs +10 -0
  234. data/sig/openai/resources/audio/voices.rbs +14 -0
  235. data/sig/openai/resources/audio.rbs +2 -0
  236. data/sig/openai/resources/beta/agents/environments/files.rbs +17 -0
  237. data/sig/openai/resources/beta/agents/sessions/artifacts.rbs +4 -0
  238. data/sig/openai/resources/beta/agents/sessions/traces.rbs +21 -0
  239. data/sig/openai/resources/beta/agents/sessions.rbs +4 -1
  240. data/sig/openai/resources/realtime/translations/client_secrets.rbs +17 -0
  241. data/sig/openai/resources/realtime/translations.rbs +11 -0
  242. data/sig/openai/resources/realtime.rbs +2 -0
  243. data/sig/openai/resources/webhooks.rbs +6 -1
  244. metadata +61 -1
@@ -1,11 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../../../helpers/beta/agents/artifacts"
4
+
3
5
  module OpenAI
4
6
  module Resources
5
7
  class Beta
6
8
  class Agents
7
9
  class Sessions
8
10
  class Artifacts
11
+ # Access artifacts from exactly this completed turn (beta).
12
+ # @return [OpenAI::Helpers::Beta::Agents::ResultArtifacts]
13
+ def for_result(result)
14
+ OpenAI::Helpers::Beta::Agents::ResultArtifacts.new(artifacts: self, client: @client, result: result)
15
+ end
16
+
9
17
  # Retrieves immutable metadata for one durable session artifact. See
10
18
  # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).
11
19
  #
@@ -6,11 +6,12 @@ module OpenAI
6
6
  class Agents
7
7
  class Sessions
8
8
  class Events
9
- # Submits message, cancellation, or tool-result events to a managed agent session.
10
- # Cancellation can recover a still-open turn whose backend execution has ended by
11
- # marking it cancelled and abandoning unpublished outputs. Saved results,
12
- # published files, and existing terminal outcomes are preserved. HTTP 202 confirms
13
- # acceptance, not durable completion. See
9
+ # Submits message, cancellation, tool-result, or computer-use approval-response
10
+ # events to a managed agent session. Cancellation can recover a still-open turn
11
+ # whose backend execution has ended by marking it cancelled and abandoning
12
+ # unpublished outputs. Saved results, published files, and existing terminal
13
+ # outcomes are preserved. HTTP 202 confirms acceptance, not durable completion.
14
+ # See
14
15
  # [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).
15
16
  #
16
17
  # @overload create(session_id, events:, idempotency_key: nil, request_options: {})
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Resources
5
+ class Beta
6
+ class Agents
7
+ class Sessions
8
+ class Traces
9
+ # Lists published root-turn traces as OTLP JSON, ordered by turn creation time and
10
+ # ID. Unpublished traces are skipped. Each page returns data available when read;
11
+ # it does not wait for late traces. Trace reads and the JSON response are limited
12
+ # to 16 MiB per request. If the limit is exceeded, request fewer traces.
13
+ #
14
+ # @overload list(session_id, after: nil, limit: nil, order: nil, request_options: {})
15
+ #
16
+ # @param session_id [String]
17
+ # The ID of the session.
18
+ #
19
+ # @param after [String]
20
+ # Return resources after this resource ID in the selected order.
21
+ #
22
+ # @param limit [Integer]
23
+ # The maximum number of resources to return, between 1 and 100. Defaults to 20.
24
+ #
25
+ # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::TraceListParams::Order]
26
+ # The order in which resources are returned. Defaults to `desc`.
27
+ #
28
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
29
+ #
30
+ # @return [OpenAI::Internal::CursorPage<OpenAI::Models::Beta::Agents::Sessions::SessionTrace>]
31
+ #
32
+ # @see OpenAI::Models::Beta::Agents::Sessions::TraceListParams
33
+ def list(session_id, params = {})
34
+ parsed, options = OpenAI::Beta::Agents::Sessions::TraceListParams.dump_request(params)
35
+ query = OpenAI::Internal::Util.encode_query_params(parsed)
36
+ @client.request(
37
+ method: :get,
38
+ path: ["agents/sessions/%1$s/traces", session_id],
39
+ query: query,
40
+ page: OpenAI::Internal::CursorPage,
41
+ model: OpenAI::Beta::Agents::Sessions::SessionTrace,
42
+ security: {bearer_auth: true},
43
+ options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options}
44
+ )
45
+ end
46
+
47
+ # @api private
48
+ #
49
+ # @param client [OpenAI::Client]
50
+ def initialize(client:)
51
+ @client = client
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -17,6 +17,9 @@ module OpenAI
17
17
  # @return [OpenAI::Resources::Beta::Agents::Sessions::Events]
18
18
  attr_reader :events
19
19
 
20
+ # @return [OpenAI::Resources::Beta::Agents::Sessions::Traces]
21
+ attr_reader :traces
22
+
20
23
  # @return [OpenAI::Resources::Beta::Agents::Sessions::Turns]
21
24
  attr_reader :turns
22
25
 
@@ -82,7 +85,7 @@ module OpenAI
82
85
  # the session or streams its events when stream is true. See
83
86
  # [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions).
84
87
  #
85
- # @overload create_streaming(environment:, agent: nil, agent_id: nil, input: nil, metadata: nil, vault_ids: nil, request_options: {})
88
+ # @overload create_streaming(environment:, agent: nil, agent_id: nil, input: nil, output_type: nil, metadata: nil, vault_ids: nil, request_options: {})
86
89
  #
87
90
  # @param environment [OpenAI::Models::Beta::EnvironmentParam::None, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted, OpenAI::Models::Beta::EnvironmentParam::SelfHosted]
88
91
  # An inline execution environment or a reference to an environment template.
@@ -108,29 +111,36 @@ module OpenAI
108
111
  # @param vault_ids [Array<String>, nil]
109
112
  # The IDs of vaults made available to the session.
110
113
  #
114
+ # @param output_type [Class<OpenAI::BaseModel>, nil] Beta: configure and parse a structured answer.
115
+ #
111
116
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
112
117
  #
113
- # @return [OpenAI::Internal::Stream<OpenAI::Models::Beta::AgentSessionErrorEvent, OpenAI::Models::Beta::AgentSessionEnvironmentReadyEvent, OpenAI::Models::Beta::AgentSessionEnvironmentResetEvent, OpenAI::Models::Beta::AgentOutputCommandExecutionOutputDeltaEvent, OpenAI::Models::Beta::AgentSessionCreatedEvent, OpenAI::Models::Beta::AgentSessionTurnCreatedEvent, OpenAI::Models::Beta::AgentSessionTurnInProgressEvent, OpenAI::Models::Beta::AgentSessionTurnCompletedEvent, OpenAI::Models::Beta::AgentSessionTurnFailedEvent, OpenAI::Models::Beta::AgentSessionTurnCancelledEvent, OpenAI::Models::Beta::AgentSessionTurnItemAddedEvent, OpenAI::Models::Beta::AgentSessionIdleEvent, OpenAI::Models::Beta::AgentSessionInProgressEvent, OpenAI::Models::Beta::AgentSessionRequiresActionEvent, OpenAI::Models::Beta::AgentSessionFailedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentPendingEvent, OpenAI::Models::Beta::AgentSessionEnvironmentConnectedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentDisconnectedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentFailedEvent, OpenAI::Models::Beta::AgentSessionSubagentCreatedEvent, OpenAI::Models::Beta::AgentSessionSubagentActiveEvent, OpenAI::Models::Beta::AgentSessionSubagentClosedEvent, OpenAI::Models::Beta::AgentSessionTurnItemDoneEvent, OpenAI::Models::Beta::AgentSessionTurnContentPartAddedEvent, OpenAI::Models::Beta::AgentSessionTurnContentPartDoneEvent, OpenAI::Models::Beta::AgentSessionTurnOutputTextDeltaEvent, OpenAI::Models::Beta::AgentSessionTurnOutputTextDoneEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryPartAddedEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryPartDoneEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryTextDeltaEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryTextDoneEvent>]
118
+ # @return [OpenAI::Helpers::Beta::Agents::CreationStream]
114
119
  #
115
120
  # @see OpenAI::Models::Beta::Agents::SessionCreateParams
116
121
  def create_streaming(params)
122
+ params = params.to_h.transform_keys { _1.is_a?(String) ? _1.to_sym : _1 }
123
+ output_type = params.delete(:output_type)
124
+ parser = OpenAI::Helpers::Beta::Agents::OutputParser.new(output_type) unless output_type.nil?
117
125
  parsed, options = OpenAI::Beta::Agents::SessionCreateParams.dump_request(params)
118
126
  unless parsed.fetch(:stream, true)
119
127
  message = "Please use `#create` for the non-streaming use case."
120
128
  raise ArgumentError.new(message)
121
129
  end
122
130
 
131
+ parser&.prepare_request(parsed)
123
132
  parsed.store(:stream, true)
124
- @client.request(
133
+ stream = @client.request(
125
134
  method: :post,
126
135
  path: "agents/sessions",
127
136
  headers: {"accept" => "text/event-stream", "accept-encoding" => "identity"},
128
137
  body: parsed,
129
- stream: OpenAI::Internal::Stream,
138
+ stream: OpenAI::Helpers::Beta::Agents::CreationStream,
130
139
  model: OpenAI::Beta::AgentSessionEvent,
131
140
  security: {bearer_auth: true},
132
141
  options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options}
133
142
  )
143
+ stream.configure_output_parser(parser)
134
144
  end
135
145
 
136
146
  # Retrieves the current state of a managed agent session. See
@@ -265,16 +275,18 @@ module OpenAI
265
275
  # @param input [String, Array<OpenAI::Models::Beta::AgentSessionInputMessageParam>]
266
276
  # @param tool_handlers [Hash{String=>Proc}]
267
277
  # @param idempotency_key [String, nil] Applies only to the input submission.
278
+ # @param output_type [Class<OpenAI::BaseModel>, nil] Beta: parse output without changing session configuration.
268
279
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
269
280
  # @yieldparam stream [OpenAI::Helpers::Agents::SessionStream]
270
281
  # @return [OpenAI::Helpers::Agents::SessionStream]
271
- def stream(session_id, input:, tool_handlers: {}, idempotency_key: nil, request_options: {})
282
+ def stream(session_id, input:, tool_handlers: {}, idempotency_key: nil, output_type: nil, request_options: {})
272
283
  stream = OpenAI::Helpers::Agents::SessionStream.new(
273
284
  sessions: self,
274
285
  session_id: session_id,
275
286
  input: input,
276
287
  tool_handlers: tool_handlers,
277
288
  idempotency_key: idempotency_key,
289
+ output_type: output_type,
278
290
  request_options: request_options
279
291
  )
280
292
  return stream unless block_given?
@@ -297,6 +309,7 @@ module OpenAI
297
309
  @artifacts = OpenAI::Resources::Beta::Agents::Sessions::Artifacts.new(client: client)
298
310
  @items = OpenAI::Resources::Beta::Agents::Sessions::Items.new(client: client)
299
311
  @events = OpenAI::Resources::Beta::Agents::Sessions::Events.new(client: client)
312
+ @traces = OpenAI::Resources::Beta::Agents::Sessions::Traces.new(client: client)
300
313
  @turns = OpenAI::Resources::Beta::Agents::Sessions::Turns.new(client: client)
301
314
  end
302
315
  end
@@ -172,7 +172,7 @@ module OpenAI
172
172
 
173
173
  @client.request(
174
174
  method: :post,
175
- path: ["evals/%1$s/runs/%2$s", eval_id, run_id],
175
+ path: ["evals/%1$s/runs/%2$s/cancel", eval_id, run_id],
176
176
  model: OpenAI::Models::Evals::RunCancelResponse,
177
177
  security: {bearer_auth: true},
178
178
  options: options
@@ -4,7 +4,11 @@ module OpenAI
4
4
  module Resources
5
5
  # Given a prompt and/or an input image, the model will generate a new image.
6
6
  class Images
7
- # Creates a variation of a given image. This endpoint only supports `dall-e-2`.
7
+ # @deprecated
8
+ #
9
+ # This endpoint is retired and no longer available. Use the image edits endpoint
10
+ # with a GPT Image model and a prompt to create a variation of an image. The
11
+ # request and response schemas below describe the legacy contract.
8
12
  #
9
13
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
10
14
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
@@ -21,8 +25,8 @@ module OpenAI
21
25
  # content type.
22
26
  #
23
27
  # @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
24
- # The model to use for image generation. Only `dall-e-2` is supported at this
25
- # time.
28
+ # The legacy model used by the retired image variations endpoint. This endpoint no
29
+ # longer accepts requests.
26
30
  #
27
31
  # @param n [Integer, nil]
28
32
  # The number of images to generate. Must be between 1 and 10.
@@ -62,7 +66,7 @@ module OpenAI
62
66
  # See {OpenAI::Resources::Images#edit_stream_raw} for streaming counterpart.
63
67
  #
64
68
  # Creates an edited or extended image given one or more source images and a
65
- # prompt. This endpoint supports GPT Image models and `dall-e-2`.
69
+ # prompt. This endpoint supports GPT Image models.
66
70
  #
67
71
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
68
72
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
@@ -80,16 +84,13 @@ module OpenAI
80
84
  # be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
81
85
  # images.
82
86
  #
83
- # For `dall-e-2`, you can only provide one image, and it should be a square `png`
84
- # file less than 4MB.
85
- #
86
87
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
87
88
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
88
89
  # content type.
89
90
  #
90
91
  # @param prompt [String]
91
- # A text description of the desired image(s). The maximum length is 1000
92
- # characters for `dall-e-2`, and 32000 characters for the GPT image models.
92
+ # A text description of the desired image(s). The maximum length is 32000
93
+ # characters for the GPT image models.
93
94
  #
94
95
  # @param background [Symbol, OpenAI::Models::ImageEditParams::Background, nil]
95
96
  # Allows to set transparency for the background of the generated image(s). Must be
@@ -118,12 +119,11 @@ module OpenAI
118
119
  # content type.
119
120
  #
120
121
  # @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
121
- # The model to use for image generation. One of `dall-e-2` or a GPT image model
122
- # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
123
- # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
124
- # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
125
- # `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to
126
- # `gpt-image-1.5`.
122
+ # The GPT image model to use for image editing (`gpt-image-1`, `gpt-image-1-mini`,
123
+ # `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
124
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
125
+ # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
126
+ # `chatgpt-image-latest`).
127
127
  #
128
128
  # @param n [Integer, nil]
129
129
  # The number of images to generate. Must be between 1 and 10.
@@ -153,24 +153,21 @@ module OpenAI
153
153
  # `xhigh` and `max`. Defaults to `auto`.
154
154
  #
155
155
  # @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil]
156
- # The format in which the generated images are returned. Must be one of `url` or
157
- # `b64_json`. URLs are only valid for 60 minutes after the image has been
158
- # generated. This parameter is only supported for `dall-e-2` (default is `url` for
159
- # `dall-e-2`), as GPT image models always return base64-encoded images.
156
+ # Legacy response format parameter for retired image models. Unsupported for GPT
157
+ # image models, which always return base64-encoded images.
160
158
  #
161
159
  # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil]
162
- # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
163
- # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
164
- # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
165
- # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
166
- # Width and height must both be divisible by 16 and the requested aspect ratio
167
- # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
168
- # the maximum supported resolution is `3840x2160`. The requested size must also
169
- # satisfy the model's current pixel and edge limits. The standard sizes
170
- # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
171
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
172
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
173
- # `1024x1024`, `1792x1024`, or `1024x1792`.
160
+ # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
161
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
162
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
163
+ # `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as
164
+ # `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be
165
+ # divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1.
166
+ # Resolutions above `2560x1440` are experimental, and the maximum supported
167
+ # resolution is `3840x2160`. The requested size must also satisfy the model's
168
+ # current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and
169
+ # `1024x1536` are supported by the GPT image models; `auto` is supported for
170
+ # models that allow automatic sizing.
174
171
  #
175
172
  # @param user [String]
176
173
  # A unique identifier representing your end-user, which can help OpenAI to monitor
@@ -203,7 +200,7 @@ module OpenAI
203
200
  # See {OpenAI::Resources::Images#edit} for non-streaming counterpart.
204
201
  #
205
202
  # Creates an edited or extended image given one or more source images and a
206
- # prompt. This endpoint supports GPT Image models and `dall-e-2`.
203
+ # prompt. This endpoint supports GPT Image models.
207
204
  #
208
205
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
209
206
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
@@ -221,16 +218,13 @@ module OpenAI
221
218
  # be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
222
219
  # images.
223
220
  #
224
- # For `dall-e-2`, you can only provide one image, and it should be a square `png`
225
- # file less than 4MB.
226
- #
227
221
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
228
222
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
229
223
  # content type.
230
224
  #
231
225
  # @param prompt [String]
232
- # A text description of the desired image(s). The maximum length is 1000
233
- # characters for `dall-e-2`, and 32000 characters for the GPT image models.
226
+ # A text description of the desired image(s). The maximum length is 32000
227
+ # characters for the GPT image models.
234
228
  #
235
229
  # @param background [Symbol, OpenAI::Models::ImageEditParams::Background, nil]
236
230
  # Allows to set transparency for the background of the generated image(s). Must be
@@ -259,12 +253,11 @@ module OpenAI
259
253
  # content type.
260
254
  #
261
255
  # @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
262
- # The model to use for image generation. One of `dall-e-2` or a GPT image model
263
- # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
264
- # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
265
- # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
266
- # `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to
267
- # `gpt-image-1.5`.
256
+ # The GPT image model to use for image editing (`gpt-image-1`, `gpt-image-1-mini`,
257
+ # `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
258
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
259
+ # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
260
+ # `chatgpt-image-latest`).
268
261
  #
269
262
  # @param n [Integer, nil]
270
263
  # The number of images to generate. Must be between 1 and 10.
@@ -294,24 +287,21 @@ module OpenAI
294
287
  # `xhigh` and `max`. Defaults to `auto`.
295
288
  #
296
289
  # @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil]
297
- # The format in which the generated images are returned. Must be one of `url` or
298
- # `b64_json`. URLs are only valid for 60 minutes after the image has been
299
- # generated. This parameter is only supported for `dall-e-2` (default is `url` for
300
- # `dall-e-2`), as GPT image models always return base64-encoded images.
290
+ # Legacy response format parameter for retired image models. Unsupported for GPT
291
+ # image models, which always return base64-encoded images.
301
292
  #
302
293
  # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil]
303
- # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
304
- # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
305
- # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
306
- # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
307
- # Width and height must both be divisible by 16 and the requested aspect ratio
308
- # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
309
- # the maximum supported resolution is `3840x2160`. The requested size must also
310
- # satisfy the model's current pixel and edge limits. The standard sizes
311
- # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
312
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
313
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
314
- # `1024x1024`, `1792x1024`, or `1024x1792`.
294
+ # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
295
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
296
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
297
+ # `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as
298
+ # `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be
299
+ # divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1.
300
+ # Resolutions above `2560x1440` are experimental, and the maximum supported
301
+ # resolution is `3840x2160`. The requested size must also satisfy the model's
302
+ # current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and
303
+ # `1024x1536` are supported by the GPT image models; `auto` is supported for
304
+ # models that allow automatic sizing.
315
305
  #
316
306
  # @param user [String]
317
307
  # A unique identifier representing your end-user, which can help OpenAI to monitor
@@ -349,15 +339,14 @@ module OpenAI
349
339
 
350
340
  # See {OpenAI::Resources::Images#generate_stream_raw} for streaming counterpart.
351
341
  #
352
- # Creates an image given a prompt.
342
+ # Creates an image given a prompt using a GPT Image model.
353
343
  # [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
354
344
  #
355
345
  # @overload generate(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, style: nil, user: nil, request_options: {})
356
346
  #
357
347
  # @param prompt [String]
358
348
  # A text description of the desired image(s). The maximum length is 32000
359
- # characters for the GPT image models, 1000 characters for `dall-e-2` and 4000
360
- # characters for `dall-e-3`.
349
+ # characters.
361
350
  #
362
351
  # @param background [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil]
363
352
  # Allows to set transparency for the background of the generated image(s). Must be
@@ -371,12 +360,11 @@ module OpenAI
371
360
  # set the output format to `png` or `webp`.
372
361
  #
373
362
  # @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
374
- # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
375
- # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
376
- # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
363
+ # The GPT image model to use for image generation. Specify a model explicitly.
364
+ # Supported models include `gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
365
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
377
366
  # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
378
- # `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter
379
- # specific to the GPT image models is used.
367
+ # `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.
380
368
  #
381
369
  # @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil]
382
370
  # Control the content-moderation level for images generated by the GPT image
@@ -384,8 +372,7 @@ module OpenAI
384
372
  # value).
385
373
  #
386
374
  # @param n [Integer, nil]
387
- # The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
388
- # `n=1` is supported.
375
+ # The number of images to generate. Must be between 1 and 10.
389
376
  #
390
377
  # @param output_compression [Integer, nil]
391
378
  # The compression level (0-100%) for the generated images. This parameter is only
@@ -412,13 +399,9 @@ module OpenAI
412
399
  # - `high`, `medium` and `low` are supported for the GPT image models.
413
400
  # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
414
401
  # `2026-09-08` snapshots, also support `xhigh` and `max`.
415
- # - `hd` and `standard` are supported for `dall-e-3`.
416
- # - `standard` is the only option for `dall-e-2`.
417
402
  #
418
403
  # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil]
419
- # The format in which generated images with `dall-e-2` and `dall-e-3` are
420
- # returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
421
- # after the image has been generated. This parameter isn't supported for the GPT
404
+ # Legacy response format parameter for retired image models. Unsupported for GPT
422
405
  # image models, which always return base64-encoded images.
423
406
  #
424
407
  # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil]
@@ -431,15 +414,11 @@ module OpenAI
431
414
  # the maximum supported resolution is `3840x2160`. The requested size must also
432
415
  # satisfy the model's current pixel and edge limits. The standard sizes
433
416
  # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
434
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
435
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
436
- # `1024x1024`, `1792x1024`, or `1024x1792`.
417
+ # `auto` is supported for models that allow automatic sizing.
437
418
  #
438
419
  # @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil]
439
- # The style of the generated images. This parameter is only supported for
440
- # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean
441
- # towards generating hyper-real and dramatic images. Natural causes the model to
442
- # produce more natural, less hyper-real looking images.
420
+ # Legacy style parameter for retired image models. Unsupported for GPT image
421
+ # models; describe the desired style in the prompt instead.
443
422
  #
444
423
  # @param user [String]
445
424
  # A unique identifier representing your end-user, which can help OpenAI to monitor
@@ -470,15 +449,14 @@ module OpenAI
470
449
 
471
450
  # See {OpenAI::Resources::Images#generate} for non-streaming counterpart.
472
451
  #
473
- # Creates an image given a prompt.
452
+ # Creates an image given a prompt using a GPT Image model.
474
453
  # [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
475
454
  #
476
455
  # @overload generate_stream_raw(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, style: nil, user: nil, request_options: {})
477
456
  #
478
457
  # @param prompt [String]
479
458
  # A text description of the desired image(s). The maximum length is 32000
480
- # characters for the GPT image models, 1000 characters for `dall-e-2` and 4000
481
- # characters for `dall-e-3`.
459
+ # characters.
482
460
  #
483
461
  # @param background [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil]
484
462
  # Allows to set transparency for the background of the generated image(s). Must be
@@ -492,12 +470,11 @@ module OpenAI
492
470
  # set the output format to `png` or `webp`.
493
471
  #
494
472
  # @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
495
- # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
496
- # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
497
- # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
473
+ # The GPT image model to use for image generation. Specify a model explicitly.
474
+ # Supported models include `gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
475
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
498
476
  # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
499
- # `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter
500
- # specific to the GPT image models is used.
477
+ # `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.
501
478
  #
502
479
  # @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil]
503
480
  # Control the content-moderation level for images generated by the GPT image
@@ -505,8 +482,7 @@ module OpenAI
505
482
  # value).
506
483
  #
507
484
  # @param n [Integer, nil]
508
- # The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
509
- # `n=1` is supported.
485
+ # The number of images to generate. Must be between 1 and 10.
510
486
  #
511
487
  # @param output_compression [Integer, nil]
512
488
  # The compression level (0-100%) for the generated images. This parameter is only
@@ -533,13 +509,9 @@ module OpenAI
533
509
  # - `high`, `medium` and `low` are supported for the GPT image models.
534
510
  # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
535
511
  # `2026-09-08` snapshots, also support `xhigh` and `max`.
536
- # - `hd` and `standard` are supported for `dall-e-3`.
537
- # - `standard` is the only option for `dall-e-2`.
538
512
  #
539
513
  # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil]
540
- # The format in which generated images with `dall-e-2` and `dall-e-3` are
541
- # returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
542
- # after the image has been generated. This parameter isn't supported for the GPT
514
+ # Legacy response format parameter for retired image models. Unsupported for GPT
543
515
  # image models, which always return base64-encoded images.
544
516
  #
545
517
  # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil]
@@ -552,15 +524,11 @@ module OpenAI
552
524
  # the maximum supported resolution is `3840x2160`. The requested size must also
553
525
  # satisfy the model's current pixel and edge limits. The standard sizes
554
526
  # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
555
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
556
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
557
- # `1024x1024`, `1792x1024`, or `1024x1792`.
527
+ # `auto` is supported for models that allow automatic sizing.
558
528
  #
559
529
  # @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil]
560
- # The style of the generated images. This parameter is only supported for
561
- # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean
562
- # towards generating hyper-real and dramatic images. Natural causes the model to
563
- # produce more natural, less hyper-real looking images.
530
+ # Legacy style parameter for retired image models. Unsupported for GPT image
531
+ # models; describe the desired style in the prompt instead.
564
532
  #
565
533
  # @param user [String]
566
534
  # A unique identifier representing your end-user, which can help OpenAI to monitor
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Resources
5
+ class Realtime
6
+ class Translations
7
+ class ClientSecrets
8
+ # Create a Realtime translation client secret with an associated translation
9
+ # session configuration.
10
+ #
11
+ # Client secrets are short-lived tokens that can be passed to a client app, such
12
+ # as a web frontend or mobile client, which grants access to the Realtime
13
+ # Translation API without leaking your main API key. You can configure a custom
14
+ # TTL for each client secret.
15
+ #
16
+ # Returns the created client secret and the effective translation session object.
17
+ # The client secret is a string that looks like `ek_1234`.
18
+ #
19
+ # @overload create(session:, expires_after: nil, request_options: {})
20
+ #
21
+ # @param session [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest]
22
+ # Realtime translation session configuration. Translation sessions stream source
23
+ # audio in and translated audio plus transcript deltas out continuously.
24
+ #
25
+ # @param expires_after [OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter]
26
+ # Configuration for the client secret expiration. Expiration refers to the time
27
+ # after which a client secret will no longer be valid for creating sessions. The
28
+ # session itself may continue after that time once started. A secret can be used
29
+ # to create multiple sessions until it expires.
30
+ #
31
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
32
+ #
33
+ # @return [OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateResponse]
34
+ #
35
+ # @see OpenAI::Models::Realtime::Translations::ClientSecretCreateParams
36
+ def create(params)
37
+ parsed, options = OpenAI::Realtime::Translations::ClientSecretCreateParams.dump_request(params)
38
+ @client.request(
39
+ method: :post,
40
+ path: "realtime/translations/client_secrets",
41
+ body: parsed,
42
+ model: OpenAI::Realtime::RealtimeTranslationClientSecretCreateResponse,
43
+ security: {bearer_auth: true},
44
+ options: options
45
+ )
46
+ end
47
+
48
+ # @api private
49
+ #
50
+ # @param client [OpenAI::Client]
51
+ def initialize(client:)
52
+ @client = client
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Resources
5
+ class Realtime
6
+ class Translations
7
+ # @return [OpenAI::Resources::Realtime::Translations::ClientSecrets]
8
+ attr_reader :client_secrets
9
+
10
+ # @api private
11
+ #
12
+ # @param client [OpenAI::Client]
13
+ def initialize(client:)
14
+ @client = client
15
+ @client_secrets = OpenAI::Resources::Realtime::Translations::ClientSecrets.new(client: client)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -9,6 +9,9 @@ module OpenAI
9
9
  # @return [OpenAI::Resources::Realtime::Calls]
10
10
  attr_reader :calls
11
11
 
12
+ # @return [OpenAI::Resources::Realtime::Translations]
13
+ attr_reader :translations
14
+
12
15
  # @api private
13
16
  #
14
17
  # @param client [OpenAI::Client]
@@ -16,6 +19,7 @@ module OpenAI
16
19
  @client = client
17
20
  @client_secrets = OpenAI::Resources::Realtime::ClientSecrets.new(client: client)
18
21
  @calls = OpenAI::Resources::Realtime::Calls.new(client: client)
22
+ @translations = OpenAI::Resources::Realtime::Translations.new(client: client)
19
23
  end
20
24
  end
21
25
  end