openai 0.61.0 → 0.63.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 (164) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +2 -5
  4. data/lib/openai/auth/workload_identity.rb +2 -2
  5. data/lib/openai/auth/workload_identity_auth.rb +4 -3
  6. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +10 -1
  7. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +10 -1
  8. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +10 -1
  9. data/lib/openai/models/admin/organization/usage_completions_response.rb +10 -1
  10. data/lib/openai/models/admin/organization/usage_costs_response.rb +10 -1
  11. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +10 -1
  12. data/lib/openai/models/admin/organization/usage_images_response.rb +10 -1
  13. data/lib/openai/models/admin/organization/usage_moderations_response.rb +10 -1
  14. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +10 -1
  15. data/lib/openai/models/chat/chat_completion_token_logprob.rb +1 -2
  16. data/lib/openai/models/chat/completion_create_params.rb +4 -3
  17. data/lib/openai/models/image_edit_params.rb +85 -31
  18. data/lib/openai/models/image_generate_params.rb +78 -26
  19. data/lib/openai/models/image_model.rb +5 -2
  20. data/lib/openai/models/realtime/audio_transcription.rb +37 -5
  21. data/lib/openai/models/realtime/client_secret_create_response.rb +1 -2
  22. data/lib/openai/models/realtime/realtime_audio_config_input.rb +3 -0
  23. data/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb +3 -0
  24. data/lib/openai/models/realtime/realtime_reasoning.rb +24 -0
  25. data/lib/openai/models/realtime/realtime_reasoning_effort.rb +22 -0
  26. data/lib/openai/models/realtime/realtime_response_create_params.rb +18 -1
  27. data/lib/openai/models/realtime/realtime_session.rb +6 -0
  28. data/lib/openai/models/realtime/realtime_session_create_request.rb +21 -1
  29. data/lib/openai/models/realtime/realtime_session_create_response.rb +41 -17
  30. data/lib/openai/models/realtime/realtime_transcription_session_audio_input.rb +3 -0
  31. data/lib/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rb +3 -0
  32. data/lib/openai/models/realtime/realtime_transcription_session_create_response.rb +9 -5
  33. data/lib/openai/models/realtime/realtime_transcription_session_turn_detection.rb +2 -1
  34. data/lib/openai/models/realtime/realtime_translation_client_event.rb +45 -0
  35. data/lib/openai/models/realtime/realtime_translation_client_secret_create_request.rb +85 -0
  36. data/lib/openai/models/realtime/realtime_translation_client_secret_create_response.rb +42 -0
  37. data/lib/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rb +51 -0
  38. data/lib/openai/models/realtime/realtime_translation_input_transcript_delta_event.rb +55 -0
  39. data/lib/openai/models/realtime/realtime_translation_output_audio_delta_event.rb +89 -0
  40. data/lib/openai/models/realtime/realtime_translation_output_transcript_delta_event.rb +54 -0
  41. data/lib/openai/models/realtime/realtime_translation_server_event.rb +53 -0
  42. data/lib/openai/models/realtime/realtime_translation_session.rb +158 -0
  43. data/lib/openai/models/realtime/realtime_translation_session_close_event.rb +30 -0
  44. data/lib/openai/models/realtime/realtime_translation_session_closed_event.rb +28 -0
  45. data/lib/openai/models/realtime/realtime_translation_session_create_request.rb +138 -0
  46. data/lib/openai/models/realtime/realtime_translation_session_created_event.rb +38 -0
  47. data/lib/openai/models/realtime/realtime_translation_session_update_event.rb +43 -0
  48. data/lib/openai/models/realtime/realtime_translation_session_update_request.rb +129 -0
  49. data/lib/openai/models/realtime/realtime_translation_session_updated_event.rb +37 -0
  50. data/lib/openai/models/realtime/transcription_session_updated_event.rb +1 -2
  51. data/lib/openai/models/responses/response.rb +4 -3
  52. data/lib/openai/models/responses/response_compact_params.rb +22 -1
  53. data/lib/openai/models/responses/response_create_params.rb +4 -3
  54. data/lib/openai/models/responses/response_includable.rb +2 -0
  55. data/lib/openai/models/responses/response_text_delta_event.rb +2 -2
  56. data/lib/openai/models/responses/response_text_done_event.rb +2 -2
  57. data/lib/openai/models/responses/responses_client_event.rb +4 -3
  58. data/lib/openai/models/responses/tool.rb +81 -16
  59. data/lib/openai/resources/chat/completions.rb +2 -2
  60. data/lib/openai/resources/images.rb +6 -6
  61. data/lib/openai/resources/realtime/calls.rb +5 -1
  62. data/lib/openai/resources/responses.rb +5 -3
  63. data/lib/openai/version.rb +1 -1
  64. data/lib/openai.rb +18 -1
  65. data/rbi/openai/auth.rbi +3 -3
  66. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +11 -1
  67. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +11 -1
  68. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +11 -1
  69. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +11 -1
  70. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +11 -1
  71. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +11 -1
  72. data/rbi/openai/models/admin/organization/usage_images_response.rbi +11 -1
  73. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +11 -1
  74. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +11 -1
  75. data/rbi/openai/models/chat/chat_completion_token_logprob.rbi +2 -4
  76. data/rbi/openai/models/chat/completion_create_params.rbi +6 -4
  77. data/rbi/openai/models/image_edit_params.rbi +102 -45
  78. data/rbi/openai/models/image_generate_params.rbi +93 -39
  79. data/rbi/openai/models/image_model.rbi +8 -3
  80. data/rbi/openai/models/realtime/audio_transcription.rbi +85 -6
  81. data/rbi/openai/models/realtime/realtime_audio_config_input.rbi +6 -0
  82. data/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi +3 -0
  83. data/rbi/openai/models/realtime/realtime_reasoning.rbi +54 -0
  84. data/rbi/openai/models/realtime/realtime_reasoning_effort.rbi +44 -0
  85. data/rbi/openai/models/realtime/realtime_response_create_params.rbi +26 -0
  86. data/rbi/openai/models/realtime/realtime_session.rbi +9 -0
  87. data/rbi/openai/models/realtime/realtime_session_create_request.rbi +31 -0
  88. data/rbi/openai/models/realtime/realtime_session_create_response.rbi +53 -32
  89. data/rbi/openai/models/realtime/realtime_transcription_session_audio_input.rbi +6 -0
  90. data/rbi/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rbi +3 -0
  91. data/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi +13 -7
  92. data/rbi/openai/models/realtime/realtime_transcription_session_turn_detection.rbi +2 -1
  93. data/rbi/openai/models/realtime/realtime_translation_client_event.rbi +29 -0
  94. data/rbi/openai/models/realtime/realtime_translation_client_secret_create_request.rbi +193 -0
  95. data/rbi/openai/models/realtime/realtime_translation_client_secret_create_response.rbi +69 -0
  96. data/rbi/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbi +69 -0
  97. data/rbi/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbi +77 -0
  98. data/rbi/openai/models/realtime/realtime_translation_output_audio_delta_event.rbi +148 -0
  99. data/rbi/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbi +76 -0
  100. data/rbi/openai/models/realtime/realtime_translation_server_event.rbi +33 -0
  101. data/rbi/openai/models/realtime/realtime_translation_session.rbi +339 -0
  102. data/rbi/openai/models/realtime/realtime_translation_session_close_event.rbi +44 -0
  103. data/rbi/openai/models/realtime/realtime_translation_session_closed_event.rbi +39 -0
  104. data/rbi/openai/models/realtime/realtime_translation_session_create_request.rbi +322 -0
  105. data/rbi/openai/models/realtime/realtime_translation_session_created_event.rbi +68 -0
  106. data/rbi/openai/models/realtime/realtime_translation_session_update_event.rbi +78 -0
  107. data/rbi/openai/models/realtime/realtime_translation_session_update_request.rbi +313 -0
  108. data/rbi/openai/models/realtime/realtime_translation_session_updated_event.rbi +67 -0
  109. data/rbi/openai/models/realtime/transcription_session_updated_event.rbi +0 -2
  110. data/rbi/openai/models/responses/response.rbi +6 -4
  111. data/rbi/openai/models/responses/response_compact_params.rbi +65 -0
  112. data/rbi/openai/models/responses/response_create_params.rbi +6 -4
  113. data/rbi/openai/models/responses/response_includable.rbi +2 -0
  114. data/rbi/openai/models/responses/response_text_delta_event.rbi +2 -2
  115. data/rbi/openai/models/responses/response_text_done_event.rbi +2 -2
  116. data/rbi/openai/models/responses/responses_client_event.rbi +6 -4
  117. data/rbi/openai/models/responses/tool.rbi +122 -27
  118. data/rbi/openai/resources/chat/completions.rbi +6 -4
  119. data/rbi/openai/resources/images.rbi +110 -44
  120. data/rbi/openai/resources/realtime/calls.rbi +7 -0
  121. data/rbi/openai/resources/responses.rbi +12 -4
  122. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +7 -2
  123. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +7 -2
  124. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +7 -2
  125. data/sig/openai/models/admin/organization/usage_completions_response.rbs +7 -2
  126. data/sig/openai/models/admin/organization/usage_costs_response.rbs +7 -2
  127. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +7 -2
  128. data/sig/openai/models/admin/organization/usage_images_response.rbs +7 -2
  129. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +7 -2
  130. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +7 -2
  131. data/sig/openai/models/image_edit_params.rbs +5 -4
  132. data/sig/openai/models/image_generate_params.rbs +5 -4
  133. data/sig/openai/models/image_model.rbs +11 -5
  134. data/sig/openai/models/realtime/audio_transcription.rbs +25 -0
  135. data/sig/openai/models/realtime/realtime_reasoning.rbs +24 -0
  136. data/sig/openai/models/realtime/realtime_reasoning_effort.rbs +20 -0
  137. data/sig/openai/models/realtime/realtime_response_create_params.rbs +16 -0
  138. data/sig/openai/models/realtime/realtime_session_create_request.rbs +18 -0
  139. data/sig/openai/models/realtime/realtime_session_create_response.rbs +27 -4
  140. data/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs +4 -8
  141. data/sig/openai/models/realtime/realtime_translation_client_event.rbs +16 -0
  142. data/sig/openai/models/realtime/realtime_translation_client_secret_create_request.rbs +69 -0
  143. data/sig/openai/models/realtime/realtime_translation_client_secret_create_response.rbs +32 -0
  144. data/sig/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbs +34 -0
  145. data/sig/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbs +37 -0
  146. data/sig/openai/models/realtime/realtime_translation_output_audio_delta_event.rbs +70 -0
  147. data/sig/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbs +37 -0
  148. data/sig/openai/models/realtime/realtime_translation_server_event.rbs +20 -0
  149. data/sig/openai/models/realtime/realtime_translation_session.rbs +131 -0
  150. data/sig/openai/models/realtime/realtime_translation_session_close_event.rbs +20 -0
  151. data/sig/openai/models/realtime/realtime_translation_session_closed_event.rbs +18 -0
  152. data/sig/openai/models/realtime/realtime_translation_session_create_request.rbs +120 -0
  153. data/sig/openai/models/realtime/realtime_translation_session_created_event.rbs +32 -0
  154. data/sig/openai/models/realtime/realtime_translation_session_update_event.rbs +34 -0
  155. data/sig/openai/models/realtime/realtime_translation_session_update_request.rbs +115 -0
  156. data/sig/openai/models/realtime/realtime_translation_session_updated_event.rbs +32 -0
  157. data/sig/openai/models/responses/response_compact_params.rbs +19 -1
  158. data/sig/openai/models/responses/tool.rbs +15 -5
  159. data/sig/openai/resources/realtime/calls.rbs +2 -0
  160. data/sig/openai/resources/responses.rbs +1 -0
  161. metadata +56 -5
  162. data/lib/openai/models/realtime/realtime_session_client_secret.rb +0 -36
  163. data/rbi/openai/models/realtime/realtime_session_client_secret.rbi +0 -49
  164. data/sig/openai/models/realtime/realtime_session_client_secret.rbs +0 -20
@@ -926,6 +926,11 @@ module OpenAI
926
926
  sig { returns(T.nilable(String)) }
927
927
  attr_accessor :project_id
928
928
 
929
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
930
+ # result.
931
+ sig { returns(T.nilable(Float)) }
932
+ attr_accessor :quantity
933
+
929
934
  # The aggregated costs details of the specific time bucket.
930
935
  sig do
931
936
  params(
@@ -934,6 +939,7 @@ module OpenAI
934
939
  api_key_id: T.nilable(String),
935
940
  line_item: T.nilable(String),
936
941
  project_id: T.nilable(String),
942
+ quantity: T.nilable(Float),
937
943
  object: Symbol
938
944
  ).returns(T.attached_class)
939
945
  end
@@ -949,6 +955,9 @@ module OpenAI
949
955
  # When `group_by=project_id`, this field provides the project ID of the grouped
950
956
  # costs result.
951
957
  project_id: nil,
958
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
959
+ # result.
960
+ quantity: nil,
952
961
  object: :"organization.costs.result"
953
962
  )
954
963
  end
@@ -961,7 +970,8 @@ module OpenAI
961
970
  OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::Amount,
962
971
  api_key_id: T.nilable(String),
963
972
  line_item: T.nilable(String),
964
- project_id: T.nilable(String)
973
+ project_id: T.nilable(String),
974
+ quantity: T.nilable(Float)
965
975
  }
966
976
  )
967
977
  end
@@ -926,6 +926,11 @@ module OpenAI
926
926
  sig { returns(T.nilable(String)) }
927
927
  attr_accessor :project_id
928
928
 
929
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
930
+ # result.
931
+ sig { returns(T.nilable(Float)) }
932
+ attr_accessor :quantity
933
+
929
934
  # The aggregated costs details of the specific time bucket.
930
935
  sig do
931
936
  params(
@@ -934,6 +939,7 @@ module OpenAI
934
939
  api_key_id: T.nilable(String),
935
940
  line_item: T.nilable(String),
936
941
  project_id: T.nilable(String),
942
+ quantity: T.nilable(Float),
937
943
  object: Symbol
938
944
  ).returns(T.attached_class)
939
945
  end
@@ -949,6 +955,9 @@ module OpenAI
949
955
  # When `group_by=project_id`, this field provides the project ID of the grouped
950
956
  # costs result.
951
957
  project_id: nil,
958
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
959
+ # result.
960
+ quantity: nil,
952
961
  object: :"organization.costs.result"
953
962
  )
954
963
  end
@@ -961,7 +970,8 @@ module OpenAI
961
970
  OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount,
962
971
  api_key_id: T.nilable(String),
963
972
  line_item: T.nilable(String),
964
- project_id: T.nilable(String)
973
+ project_id: T.nilable(String),
974
+ quantity: T.nilable(Float)
965
975
  }
966
976
  )
967
977
  end
@@ -926,6 +926,11 @@ module OpenAI
926
926
  sig { returns(T.nilable(String)) }
927
927
  attr_accessor :project_id
928
928
 
929
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
930
+ # result.
931
+ sig { returns(T.nilable(Float)) }
932
+ attr_accessor :quantity
933
+
929
934
  # The aggregated costs details of the specific time bucket.
930
935
  sig do
931
936
  params(
@@ -934,6 +939,7 @@ module OpenAI
934
939
  api_key_id: T.nilable(String),
935
940
  line_item: T.nilable(String),
936
941
  project_id: T.nilable(String),
942
+ quantity: T.nilable(Float),
937
943
  object: Symbol
938
944
  ).returns(T.attached_class)
939
945
  end
@@ -949,6 +955,9 @@ module OpenAI
949
955
  # When `group_by=project_id`, this field provides the project ID of the grouped
950
956
  # costs result.
951
957
  project_id: nil,
958
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
959
+ # result.
960
+ quantity: nil,
952
961
  object: :"organization.costs.result"
953
962
  )
954
963
  end
@@ -961,7 +970,8 @@ module OpenAI
961
970
  OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationCostsResult::Amount,
962
971
  api_key_id: T.nilable(String),
963
972
  line_item: T.nilable(String),
964
- project_id: T.nilable(String)
973
+ project_id: T.nilable(String),
974
+ quantity: T.nilable(Float)
965
975
  }
966
976
  )
967
977
  end
@@ -926,6 +926,11 @@ module OpenAI
926
926
  sig { returns(T.nilable(String)) }
927
927
  attr_accessor :project_id
928
928
 
929
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
930
+ # result.
931
+ sig { returns(T.nilable(Float)) }
932
+ attr_accessor :quantity
933
+
929
934
  # The aggregated costs details of the specific time bucket.
930
935
  sig do
931
936
  params(
@@ -934,6 +939,7 @@ module OpenAI
934
939
  api_key_id: T.nilable(String),
935
940
  line_item: T.nilable(String),
936
941
  project_id: T.nilable(String),
942
+ quantity: T.nilable(Float),
937
943
  object: Symbol
938
944
  ).returns(T.attached_class)
939
945
  end
@@ -949,6 +955,9 @@ module OpenAI
949
955
  # When `group_by=project_id`, this field provides the project ID of the grouped
950
956
  # costs result.
951
957
  project_id: nil,
958
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
959
+ # result.
960
+ quantity: nil,
952
961
  object: :"organization.costs.result"
953
962
  )
954
963
  end
@@ -961,7 +970,8 @@ module OpenAI
961
970
  OpenAI::Models::Admin::Organization::UsageImagesResponse::Data::Result::OrganizationCostsResult::Amount,
962
971
  api_key_id: T.nilable(String),
963
972
  line_item: T.nilable(String),
964
- project_id: T.nilable(String)
973
+ project_id: T.nilable(String),
974
+ quantity: T.nilable(Float)
965
975
  }
966
976
  )
967
977
  end
@@ -926,6 +926,11 @@ module OpenAI
926
926
  sig { returns(T.nilable(String)) }
927
927
  attr_accessor :project_id
928
928
 
929
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
930
+ # result.
931
+ sig { returns(T.nilable(Float)) }
932
+ attr_accessor :quantity
933
+
929
934
  # The aggregated costs details of the specific time bucket.
930
935
  sig do
931
936
  params(
@@ -934,6 +939,7 @@ module OpenAI
934
939
  api_key_id: T.nilable(String),
935
940
  line_item: T.nilable(String),
936
941
  project_id: T.nilable(String),
942
+ quantity: T.nilable(Float),
937
943
  object: Symbol
938
944
  ).returns(T.attached_class)
939
945
  end
@@ -949,6 +955,9 @@ module OpenAI
949
955
  # When `group_by=project_id`, this field provides the project ID of the grouped
950
956
  # costs result.
951
957
  project_id: nil,
958
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
959
+ # result.
960
+ quantity: nil,
952
961
  object: :"organization.costs.result"
953
962
  )
954
963
  end
@@ -961,7 +970,8 @@ module OpenAI
961
970
  OpenAI::Models::Admin::Organization::UsageModerationsResponse::Data::Result::OrganizationCostsResult::Amount,
962
971
  api_key_id: T.nilable(String),
963
972
  line_item: T.nilable(String),
964
- project_id: T.nilable(String)
973
+ project_id: T.nilable(String),
974
+ quantity: T.nilable(Float)
965
975
  }
966
976
  )
967
977
  end
@@ -926,6 +926,11 @@ module OpenAI
926
926
  sig { returns(T.nilable(String)) }
927
927
  attr_accessor :project_id
928
928
 
929
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
930
+ # result.
931
+ sig { returns(T.nilable(Float)) }
932
+ attr_accessor :quantity
933
+
929
934
  # The aggregated costs details of the specific time bucket.
930
935
  sig do
931
936
  params(
@@ -934,6 +939,7 @@ module OpenAI
934
939
  api_key_id: T.nilable(String),
935
940
  line_item: T.nilable(String),
936
941
  project_id: T.nilable(String),
942
+ quantity: T.nilable(Float),
937
943
  object: Symbol
938
944
  ).returns(T.attached_class)
939
945
  end
@@ -949,6 +955,9 @@ module OpenAI
949
955
  # When `group_by=project_id`, this field provides the project ID of the grouped
950
956
  # costs result.
951
957
  project_id: nil,
958
+ # When `group_by=line_item`, this field provides the quantity of the grouped costs
959
+ # result.
960
+ quantity: nil,
952
961
  object: :"organization.costs.result"
953
962
  )
954
963
  end
@@ -961,7 +970,8 @@ module OpenAI
961
970
  OpenAI::Models::Admin::Organization::UsageVectorStoresResponse::Data::Result::OrganizationCostsResult::Amount,
962
971
  api_key_id: T.nilable(String),
963
972
  line_item: T.nilable(String),
964
- project_id: T.nilable(String)
973
+ project_id: T.nilable(String),
974
+ quantity: T.nilable(Float)
965
975
  }
966
976
  )
967
977
  end
@@ -32,8 +32,7 @@ module OpenAI
32
32
  attr_accessor :logprob
33
33
 
34
34
  # List of the most likely tokens and their log probability, at this token
35
- # position. In rare cases, there may be fewer than the number of requested
36
- # `top_logprobs` returned.
35
+ # position. The number of entries may be fewer than the requested `top_logprobs`.
37
36
  sig do
38
37
  returns(
39
38
  T::Array[OpenAI::Chat::ChatCompletionTokenLogprob::TopLogprob]
@@ -65,8 +64,7 @@ module OpenAI
65
64
  # unlikely.
66
65
  logprob:,
67
66
  # List of the most likely tokens and their log probability, at this token
68
- # position. In rare cases, there may be fewer than the number of requested
69
- # `top_logprobs` returned.
67
+ # position. The number of entries may be fewer than the requested `top_logprobs`.
70
68
  top_logprobs:
71
69
  )
72
70
  end
@@ -441,8 +441,9 @@ module OpenAI
441
441
  end
442
442
  attr_writer :tools
443
443
 
444
- # An integer between 0 and 20 specifying the number of most likely tokens to
445
- # return at each token position, each with an associated log probability.
444
+ # An integer between 0 and 20 specifying the maximum number of most likely tokens
445
+ # to return at each token position, each with an associated log probability. In
446
+ # some cases, the number of returned tokens may be fewer than requested.
446
447
  # `logprobs` must be set to `true` if this parameter is used.
447
448
  sig { returns(T.nilable(Integer)) }
448
449
  attr_accessor :top_logprobs
@@ -780,8 +781,9 @@ module OpenAI
780
781
  # [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
781
782
  # or [function tools](https://platform.openai.com/docs/guides/function-calling).
782
783
  tools: nil,
783
- # An integer between 0 and 20 specifying the number of most likely tokens to
784
- # return at each token position, each with an associated log probability.
784
+ # An integer between 0 and 20 specifying the maximum number of most likely tokens
785
+ # to return at each token position, each with an associated log probability. In
786
+ # some cases, the number of returned tokens may be fewer than requested.
785
787
  # `logprobs` must be set to `true` if this parameter is used.
786
788
  top_logprobs: nil,
787
789
  # An alternative to sampling with temperature, called nucleus sampling, where the
@@ -13,10 +13,10 @@ module OpenAI
13
13
 
14
14
  # The image(s) to edit. Must be a supported image file or an array of images.
15
15
  #
16
- # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
17
- # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
18
- # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same
19
- # input constraints as GPT image models.
16
+ # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
17
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image
18
+ # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to
19
+ # 16 images.
20
20
  #
21
21
  # For `dall-e-2`, you can only provide one image, and it should be a square `png`
22
22
  # file less than 4MB.
@@ -29,9 +29,14 @@ module OpenAI
29
29
  attr_accessor :prompt
30
30
 
31
31
  # Allows to set transparency for the background of the generated image(s). This
32
- # parameter is only supported for the GPT image models. Must be one of
33
- # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
34
- # model will automatically determine the best background for the image.
32
+ # parameter is only supported for GPT image models that support transparent
33
+ # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
34
+ # When `auto` is used, the model will automatically determine the best background
35
+ # for the image.
36
+ #
37
+ # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
38
+ # backgrounds. Requests with `background` set to `transparent` will return an
39
+ # error for these models; use `opaque` or `auto` instead.
35
40
  #
36
41
  # If `transparent`, the output format needs to support transparency, so it should
37
42
  # be set to either `png` (default value) or `webp`.
@@ -57,7 +62,10 @@ module OpenAI
57
62
  sig { params(mask: OpenAI::Internal::FileInput).void }
58
63
  attr_writer :mask
59
64
 
60
- # The model to use for image generation. Defaults to `gpt-image-1.5`.
65
+ # The model to use for image generation. One of `dall-e-2` or a GPT image model
66
+ # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
67
+ # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to
68
+ # `gpt-image-1.5`.
61
69
  sig { returns(T.nilable(T.any(String, OpenAI::ImageModel::OrSymbol))) }
62
70
  attr_accessor :model
63
71
 
@@ -102,10 +110,22 @@ module OpenAI
102
110
  end
103
111
  attr_accessor :response_format
104
112
 
105
- # The size of the generated images. Must be one of `1024x1024`, `1536x1024`
106
- # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
107
- # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
108
- sig { returns(T.nilable(OpenAI::ImageEditParams::Size::OrSymbol)) }
113
+ # The size of the generated images. For `gpt-image-2` and
114
+ # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
115
+ # strings, for example `1536x864`. Width and height must both be divisible by 16
116
+ # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
117
+ # `2560x1440` are experimental, and the maximum supported resolution is
118
+ # `3840x2160`. The requested size must also satisfy the model's current pixel and
119
+ # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
120
+ # supported by the GPT image models; `auto` is supported for models that allow
121
+ # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
122
+ # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
123
+ # `1024x1792`.
124
+ sig do
125
+ returns(
126
+ T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol))
127
+ )
128
+ end
109
129
  attr_accessor :size
110
130
 
111
131
  # A unique identifier representing your end-user, which can help OpenAI to monitor
@@ -134,7 +154,8 @@ module OpenAI
134
154
  quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol),
135
155
  response_format:
136
156
  T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol),
137
- size: T.nilable(OpenAI::ImageEditParams::Size::OrSymbol),
157
+ size:
158
+ T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)),
138
159
  user: String,
139
160
  request_options: OpenAI::RequestOptions::OrHash
140
161
  ).returns(T.attached_class)
@@ -142,10 +163,10 @@ module OpenAI
142
163
  def self.new(
143
164
  # The image(s) to edit. Must be a supported image file or an array of images.
144
165
  #
145
- # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
146
- # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
147
- # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same
148
- # input constraints as GPT image models.
166
+ # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
167
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image
168
+ # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to
169
+ # 16 images.
149
170
  #
150
171
  # For `dall-e-2`, you can only provide one image, and it should be a square `png`
151
172
  # file less than 4MB.
@@ -154,9 +175,14 @@ module OpenAI
154
175
  # characters for `dall-e-2`, and 32000 characters for the GPT image models.
155
176
  prompt:,
156
177
  # Allows to set transparency for the background of the generated image(s). This
157
- # parameter is only supported for the GPT image models. Must be one of
158
- # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
159
- # model will automatically determine the best background for the image.
178
+ # parameter is only supported for GPT image models that support transparent
179
+ # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
180
+ # When `auto` is used, the model will automatically determine the best background
181
+ # for the image.
182
+ #
183
+ # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
184
+ # backgrounds. Requests with `background` set to `transparent` will return an
185
+ # error for these models; use `opaque` or `auto` instead.
160
186
  #
161
187
  # If `transparent`, the output format needs to support transparency, so it should
162
188
  # be set to either `png` (default value) or `webp`.
@@ -171,7 +197,10 @@ module OpenAI
171
197
  # the mask will be applied on the first image. Must be a valid PNG file, less than
172
198
  # 4MB, and have the same dimensions as `image`.
173
199
  mask: nil,
174
- # The model to use for image generation. Defaults to `gpt-image-1.5`.
200
+ # The model to use for image generation. One of `dall-e-2` or a GPT image model
201
+ # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
202
+ # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to
203
+ # `gpt-image-1.5`.
175
204
  model: nil,
176
205
  # The number of images to generate. Must be between 1 and 10.
177
206
  n: nil,
@@ -198,9 +227,17 @@ module OpenAI
198
227
  # generated. This parameter is only supported for `dall-e-2` (default is `url` for
199
228
  # `dall-e-2`), as GPT image models always return base64-encoded images.
200
229
  response_format: nil,
201
- # The size of the generated images. Must be one of `1024x1024`, `1536x1024`
202
- # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
203
- # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
230
+ # The size of the generated images. For `gpt-image-2` and
231
+ # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
232
+ # strings, for example `1536x864`. Width and height must both be divisible by 16
233
+ # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
234
+ # `2560x1440` are experimental, and the maximum supported resolution is
235
+ # `3840x2160`. The requested size must also satisfy the model's current pixel and
236
+ # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
237
+ # supported by the GPT image models; `auto` is supported for models that allow
238
+ # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
239
+ # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
240
+ # `1024x1792`.
204
241
  size: nil,
205
242
  # A unique identifier representing your end-user, which can help OpenAI to monitor
206
243
  # and detect abuse.
@@ -229,7 +266,8 @@ module OpenAI
229
266
  quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol),
230
267
  response_format:
231
268
  T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol),
232
- size: T.nilable(OpenAI::ImageEditParams::Size::OrSymbol),
269
+ size:
270
+ T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)),
233
271
  user: String,
234
272
  request_options: OpenAI::RequestOptions
235
273
  }
@@ -240,10 +278,10 @@ module OpenAI
240
278
 
241
279
  # The image(s) to edit. Must be a supported image file or an array of images.
242
280
  #
243
- # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
244
- # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
245
- # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same
246
- # input constraints as GPT image models.
281
+ # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
282
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image
283
+ # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to
284
+ # 16 images.
247
285
  #
248
286
  # For `dall-e-2`, you can only provide one image, and it should be a square `png`
249
287
  # file less than 4MB.
@@ -266,9 +304,14 @@ module OpenAI
266
304
  end
267
305
 
268
306
  # Allows to set transparency for the background of the generated image(s). This
269
- # parameter is only supported for the GPT image models. Must be one of
270
- # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
271
- # model will automatically determine the best background for the image.
307
+ # parameter is only supported for GPT image models that support transparent
308
+ # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
309
+ # When `auto` is used, the model will automatically determine the best background
310
+ # for the image.
311
+ #
312
+ # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
313
+ # backgrounds. Requests with `background` set to `transparent` will return an
314
+ # error for these models; use `opaque` or `auto` instead.
272
315
  #
273
316
  # If `transparent`, the output format needs to support transparency, so it should
274
317
  # be set to either `png` (default value) or `webp`.
@@ -318,7 +361,10 @@ module OpenAI
318
361
  end
319
362
  end
320
363
 
321
- # The model to use for image generation. Defaults to `gpt-image-1.5`.
364
+ # The model to use for image generation. One of `dall-e-2` or a GPT image model
365
+ # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
366
+ # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to
367
+ # `gpt-image-1.5`.
322
368
  module Model
323
369
  extend OpenAI::Internal::Type::Union
324
370
 
@@ -409,11 +455,30 @@ module OpenAI
409
455
  end
410
456
  end
411
457
 
412
- # The size of the generated images. Must be one of `1024x1024`, `1536x1024`
413
- # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
414
- # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
458
+ # The size of the generated images. For `gpt-image-2` and
459
+ # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
460
+ # strings, for example `1536x864`. Width and height must both be divisible by 16
461
+ # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
462
+ # `2560x1440` are experimental, and the maximum supported resolution is
463
+ # `3840x2160`. The requested size must also satisfy the model's current pixel and
464
+ # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
465
+ # supported by the GPT image models; `auto` is supported for models that allow
466
+ # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
467
+ # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
468
+ # `1024x1792`.
415
469
  module Size
416
- extend OpenAI::Internal::Type::Enum
470
+ extend OpenAI::Internal::Type::Union
471
+
472
+ Variants =
473
+ T.type_alias do
474
+ T.any(String, OpenAI::ImageEditParams::Size::TaggedSymbol)
475
+ end
476
+
477
+ sig do
478
+ override.returns(T::Array[OpenAI::ImageEditParams::Size::Variants])
479
+ end
480
+ def self.variants
481
+ end
417
482
 
418
483
  TaggedSymbol =
419
484
  T.type_alias { T.all(Symbol, OpenAI::ImageEditParams::Size) }
@@ -430,14 +495,6 @@ module OpenAI
430
495
  SIZE_1024X1536 =
431
496
  T.let(:"1024x1536", OpenAI::ImageEditParams::Size::TaggedSymbol)
432
497
  AUTO = T.let(:auto, OpenAI::ImageEditParams::Size::TaggedSymbol)
433
-
434
- sig do
435
- override.returns(
436
- T::Array[OpenAI::ImageEditParams::Size::TaggedSymbol]
437
- )
438
- end
439
- def self.values
440
- end
441
498
  end
442
499
  end
443
500
  end