openai 0.117.0 → 0.118.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/openai/models/admin/organization/projects/project_optional_service_tier.rb +24 -0
  5. data/lib/openai/models/admin/organization/projects/project_service_tier_settings.rb +88 -0
  6. data/lib/openai/models/admin/organization/projects/service_tier_setting_retrieve_params.rb +29 -0
  7. data/lib/openai/models/admin/organization/projects/service_tier_setting_update_params.rb +92 -0
  8. data/lib/openai/models/beta/beta_response.rb +1 -0
  9. data/lib/openai/models/beta/beta_response_usage.rb +33 -1
  10. data/lib/openai/models/beta/beta_responses_client_event.rb +10 -9
  11. data/lib/openai/models/beta/response_compact_params.rb +3 -3
  12. data/lib/openai/models/beta/response_create_params.rb +10 -9
  13. data/lib/openai/models/chat/completion_create_params.rb +3 -3
  14. data/lib/openai/models/responses/response.rb +1 -0
  15. data/lib/openai/models/responses/response_compact_params.rb +3 -3
  16. data/lib/openai/models/responses/response_create_params.rb +10 -9
  17. data/lib/openai/models/responses/response_usage.rb +33 -1
  18. data/lib/openai/models/responses/responses_client_event.rb +10 -9
  19. data/lib/openai/resources/admin/organization/projects/service_tier_settings.rb +77 -0
  20. data/lib/openai/resources/admin/organization/projects.rb +6 -0
  21. data/lib/openai/resources/beta/responses.rb +6 -6
  22. data/lib/openai/resources/chat/completions.rb +2 -2
  23. data/lib/openai/resources/responses.rb +3 -3
  24. data/lib/openai/version.rb +1 -1
  25. data/lib/openai.rb +5 -0
  26. data/rbi/openai/models/admin/organization/projects/project_optional_service_tier.rbi +45 -0
  27. data/rbi/openai/models/admin/organization/projects/project_service_tier_settings.rbi +143 -0
  28. data/rbi/openai/models/admin/organization/projects/service_tier_setting_retrieve_params.rbi +63 -0
  29. data/rbi/openai/models/admin/organization/projects/service_tier_setting_update_params.rbi +183 -0
  30. data/rbi/openai/models/beta/beta_response.rbi +1 -0
  31. data/rbi/openai/models/beta/beta_response_usage.rbi +66 -3
  32. data/rbi/openai/models/beta/beta_responses_client_event.rbi +13 -9
  33. data/rbi/openai/models/beta/response_compact_params.rbi +3 -3
  34. data/rbi/openai/models/beta/response_create_params.rbi +10 -9
  35. data/rbi/openai/models/chat/completion_create_params.rbi +3 -3
  36. data/rbi/openai/models/responses/response.rbi +1 -0
  37. data/rbi/openai/models/responses/response_compact_params.rbi +3 -3
  38. data/rbi/openai/models/responses/response_create_params.rbi +10 -9
  39. data/rbi/openai/models/responses/response_usage.rbi +66 -3
  40. data/rbi/openai/models/responses/responses_client_event.rbi +13 -9
  41. data/rbi/openai/resources/admin/organization/projects/service_tier_settings.rbi +67 -0
  42. data/rbi/openai/resources/admin/organization/projects.rbi +3 -0
  43. data/rbi/openai/resources/beta/responses.rbi +6 -6
  44. data/rbi/openai/resources/chat/completions.rbi +2 -2
  45. data/rbi/openai/resources/responses.rbi +3 -3
  46. data/sig/openai/models/admin/organization/projects/project_optional_service_tier.rbs +23 -0
  47. data/sig/openai/models/admin/organization/projects/project_service_tier_settings.rbs +72 -0
  48. data/sig/openai/models/admin/organization/projects/service_tier_setting_retrieve_params.rbs +32 -0
  49. data/sig/openai/models/admin/organization/projects/service_tier_setting_update_params.rbs +91 -0
  50. data/sig/openai/models/beta/beta_response.rbs +2 -1
  51. data/sig/openai/models/beta/beta_response_usage.rbs +40 -3
  52. data/sig/openai/models/beta/beta_responses_client_event.rbs +11 -10
  53. data/sig/openai/models/beta/response_compact_params.rbs +2 -2
  54. data/sig/openai/models/beta/response_create_params.rbs +11 -10
  55. data/sig/openai/models/chat/completion_create_params.rbs +3 -3
  56. data/sig/openai/models/responses/response.rbs +2 -1
  57. data/sig/openai/models/responses/response_compact_params.rbs +2 -2
  58. data/sig/openai/models/responses/response_create_params.rbs +11 -10
  59. data/sig/openai/models/responses/response_usage.rbs +40 -3
  60. data/sig/openai/models/responses/responses_client_event.rbs +11 -10
  61. data/sig/openai/resources/admin/organization/projects/service_tier_settings.rbs +25 -0
  62. data/sig/openai/resources/admin/organization/projects.rbs +2 -0
  63. metadata +16 -1
@@ -108,13 +108,26 @@ module OpenAI
108
108
  sig { returns(Integer) }
109
109
  attr_accessor :cached_tokens
110
110
 
111
+ sig { returns(T.nilable(OpenAI::Responses::ResponseUsage::InputTokensDetails::CacheWriteTokensDetails)) }
112
+ attr_reader :cache_write_tokens_details
113
+
114
+ sig {
115
+ params(
116
+ cache_write_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails::CacheWriteTokensDetails::OrHash
117
+ )
118
+ .void
119
+ }
120
+ attr_writer :cache_write_tokens_details
121
+
111
122
  # A detailed breakdown of the input tokens.
112
123
  sig do
113
124
  params(
114
125
 
115
126
  cache_write_tokens: Integer,
116
127
 
117
- cached_tokens: Integer
128
+ cached_tokens: Integer,
129
+
130
+ cache_write_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails::CacheWriteTokensDetails::OrHash
118
131
  )
119
132
  .returns(T.attached_class)
120
133
  end
@@ -125,19 +138,69 @@ module OpenAI
125
138
 
126
139
  # The number of tokens that were retrieved from the cache.
127
140
  # [More on prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching).
141
+ cached_tokens:,
128
142
 
129
- cached_tokens:
143
+ cache_write_tokens_details: nil
130
144
  )
131
145
  end
132
146
 
133
147
  sig do
134
148
  override.returns(
135
- {cache_write_tokens: Integer, cached_tokens: Integer}
149
+ {
150
+ cache_write_tokens: Integer,
151
+ cached_tokens: Integer,
152
+ cache_write_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails::CacheWriteTokensDetails
153
+ }
136
154
  )
137
155
  end
138
156
  def to_hash
139
157
  end
140
158
 
159
+ class CacheWriteTokensDetails < OpenAI::Internal::Type::BaseModel
160
+ OrHash = T.type_alias do
161
+ T.any(
162
+ OpenAI::Responses::ResponseUsage::InputTokensDetails::CacheWriteTokensDetails,
163
+ OpenAI::Internal::AnyHash
164
+ )
165
+ end
166
+
167
+ # The number of input tokens written with 12-hour retention.
168
+ sig { returns(Integer) }
169
+ attr_accessor :ttl_12h_tokens
170
+
171
+ # The number of input tokens written with 30-minute retention.
172
+ sig { returns(Integer) }
173
+ attr_accessor :ttl_30m_tokens
174
+
175
+ sig do
176
+ params(
177
+
178
+ ttl_12h_tokens: Integer,
179
+
180
+ ttl_30m_tokens: Integer
181
+ )
182
+ .returns(T.attached_class)
183
+ end
184
+ def self.new(
185
+
186
+ # The number of input tokens written with 12-hour retention.
187
+ ttl_12h_tokens:,
188
+
189
+ # The number of input tokens written with 30-minute retention.
190
+
191
+ ttl_30m_tokens:
192
+ )
193
+ end
194
+
195
+ sig do
196
+ override.returns(
197
+ {ttl_12h_tokens: Integer, ttl_30m_tokens: Integer}
198
+ )
199
+ end
200
+ def to_hash
201
+ end
202
+
203
+ end
141
204
  end
142
205
 
143
206
  class OutputTokensDetails < OpenAI::Internal::Type::BaseModel
@@ -194,7 +194,7 @@ module OpenAI
194
194
  # request can write up to four breakpoints. For cache matching, OpenAI considers
195
195
  # up to the latest 80 breakpoints in the conversation, without a content-block
196
196
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
197
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
197
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
198
198
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
199
199
  # for current details.
200
200
  sig { returns(T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions)) }
@@ -714,7 +714,7 @@ module OpenAI
714
714
  # request can write up to four breakpoints. For cache matching, OpenAI considers
715
715
  # up to the latest 80 breakpoints in the conversation, without a content-block
716
716
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
717
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
717
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
718
718
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
719
719
  # for current details.
720
720
  prompt_cache_options: nil,
@@ -1478,8 +1478,8 @@ module OpenAI
1478
1478
  attr_writer :prewarm
1479
1479
 
1480
1480
  # The minimum lifetime applied to every implicit and explicit cache breakpoint
1481
- # written by the request. Defaults to `30m`, which is currently the only supported
1482
- # value. The backend may retain cache entries for longer.
1481
+ # written by the request. Supported values are `30m` (the default) and `12h`. The
1482
+ # backend may retain cache entries for longer.
1483
1483
  sig {
1484
1484
  returns(
1485
1485
  T.nilable(OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl::OrSymbol)
@@ -1499,7 +1499,7 @@ module OpenAI
1499
1499
  # request can write up to four breakpoints. For cache matching, OpenAI considers
1500
1500
  # up to the latest 80 breakpoints in the conversation, without a content-block
1501
1501
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
1502
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
1502
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
1503
1503
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
1504
1504
  # for current details.
1505
1505
  sig do
@@ -1534,8 +1534,8 @@ module OpenAI
1534
1534
  prewarm: nil,
1535
1535
 
1536
1536
  # The minimum lifetime applied to every implicit and explicit cache breakpoint
1537
- # written by the request. Defaults to `30m`, which is currently the only supported
1538
- # value. The backend may retain cache entries for longer.
1537
+ # written by the request. Supported values are `30m` (the default) and `12h`. The
1538
+ # backend may retain cache entries for longer.
1539
1539
 
1540
1540
  ttl: nil
1541
1541
  )
@@ -1593,8 +1593,8 @@ module OpenAI
1593
1593
  end
1594
1594
 
1595
1595
  # The minimum lifetime applied to every implicit and explicit cache breakpoint
1596
- # written by the request. Defaults to `30m`, which is currently the only supported
1597
- # value. The backend may retain cache entries for longer.
1596
+ # written by the request. Supported values are `30m` (the default) and `12h`. The
1597
+ # backend may retain cache entries for longer.
1598
1598
  module Ttl
1599
1599
  extend OpenAI::Internal::Type::Enum
1600
1600
 
@@ -1607,6 +1607,10 @@ module OpenAI
1607
1607
  :"30m",
1608
1608
  OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl::TaggedSymbol
1609
1609
  )
1610
+ TTL_12H = T.let(
1611
+ :"12h",
1612
+ OpenAI::Responses::ResponsesClientEvent::ResponseCreate::PromptCacheOptions::Ttl::TaggedSymbol
1613
+ )
1610
1614
 
1611
1615
  sig {
1612
1616
  override.returns(
@@ -0,0 +1,67 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Resources
5
+
6
+ class Admin
7
+
8
+ class Organization
9
+
10
+ class Projects
11
+
12
+ class ServiceTierSettings
13
+
14
+ # Retrieve the configured default and enabled service tiers for a project.
15
+ sig {
16
+ params(project_id: String, request_options: OpenAI::RequestOptions::OrHash).returns(
17
+ OpenAI::Admin::Organization::Projects::ProjectServiceTierSettings
18
+ )
19
+ }
20
+ def retrieve(
21
+ # The ID of the project
22
+ project_id,
23
+ request_options: {}
24
+ )
25
+ end
26
+
27
+ # Update the default or enabled service tiers atomically. Supply at least one
28
+ # field. Omitted fields keep their current values.
29
+ sig {
30
+ params(
31
+ project_id: String,
32
+ default: OpenAI::Admin::Organization::Projects::ServiceTierSettingUpdateParams::Default::OrSymbol,
33
+ enabled_tiers: T.any(
34
+ Symbol,
35
+ T::Array[OpenAI::Admin::Organization::Projects::ProjectOptionalServiceTier::OrSymbol]
36
+ ),
37
+ request_options: OpenAI::RequestOptions::OrHash
38
+ )
39
+ .returns(OpenAI::Admin::Organization::Projects::ProjectServiceTierSettings)
40
+ }
41
+ def update(
42
+ # The ID of the project
43
+ project_id,
44
+ # Default tier for requests that omit service_tier or use auto.
45
+ default: nil,
46
+ # Additional service tiers enabled for this project. "all" includes future tiers.
47
+ # An empty array allows only Standard. Organization policy and eligibility still
48
+ # apply.
49
+ enabled_tiers: nil,
50
+ request_options: {}
51
+ )
52
+ end
53
+
54
+ # @api private
55
+ sig { params(client: OpenAI::Client).returns(T.attached_class) }
56
+ def self.new(client:)
57
+ end
58
+ end
59
+
60
+ end
61
+
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+ end
@@ -45,6 +45,9 @@ module OpenAI
45
45
  sig { returns(OpenAI::Resources::Admin::Organization::Projects::Certificates) }
46
46
  attr_reader :certificates
47
47
 
48
+ sig { returns(OpenAI::Resources::Admin::Organization::Projects::ServiceTierSettings) }
49
+ attr_reader :service_tier_settings
50
+
48
51
  # Create a new project in the organization. Projects can be created and archived,
49
52
  # but cannot be deleted.
50
53
  sig {
@@ -218,8 +218,8 @@ module OpenAI
218
218
  # `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For
219
219
  # cache matching, OpenAI considers up to the latest 80 breakpoints in the
220
220
  # conversation, without a content-block lookback limit. Set `mode` to `explicit`
221
- # to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is
222
- # currently the only supported value. See the
221
+ # to disable the implicit breakpoint. The `ttl` defaults to `30m`. Supported
222
+ # lifetimes depend on the API. See the
223
223
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
224
224
  # for current details.
225
225
  prompt_cache_options: nil,
@@ -540,8 +540,8 @@ module OpenAI
540
540
  # `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For
541
541
  # cache matching, OpenAI considers up to the latest 80 breakpoints in the
542
542
  # conversation, without a content-block lookback limit. Set `mode` to `explicit`
543
- # to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is
544
- # currently the only supported value. See the
543
+ # to disable the implicit breakpoint. The `ttl` defaults to `30m`. Supported
544
+ # lifetimes depend on the API. See the
545
545
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
546
546
  # for current details.
547
547
  prompt_cache_options: nil,
@@ -852,8 +852,8 @@ module OpenAI
852
852
  # `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For
853
853
  # cache matching, OpenAI considers up to the latest 80 breakpoints in the
854
854
  # conversation, without a content-block lookback limit. Set `mode` to `explicit`
855
- # to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is
856
- # currently the only supported value. See the
855
+ # to disable the implicit breakpoint. The `ttl` defaults to `30m`. Supported
856
+ # lifetimes depend on the API. See the
857
857
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
858
858
  # for current details.
859
859
  prompt_cache_options: nil,
@@ -222,7 +222,7 @@ module OpenAI
222
222
  # request can write up to four breakpoints. For cache matching, OpenAI considers
223
223
  # up to the latest 80 breakpoints in the conversation, without a content-block
224
224
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
225
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
225
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
226
226
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
227
227
  # for current details.
228
228
  prompt_cache_options: nil,
@@ -567,7 +567,7 @@ module OpenAI
567
567
  # request can write up to four breakpoints. For cache matching, OpenAI considers
568
568
  # up to the latest 80 breakpoints in the conversation, without a content-block
569
569
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
570
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
570
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
571
571
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
572
572
  # for current details.
573
573
  prompt_cache_options: nil,
@@ -210,7 +210,7 @@ module OpenAI
210
210
  # request can write up to four breakpoints. For cache matching, OpenAI considers
211
211
  # up to the latest 80 breakpoints in the conversation, without a content-block
212
212
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
213
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
213
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
214
214
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
215
215
  # for current details.
216
216
  prompt_cache_options: nil,
@@ -521,7 +521,7 @@ module OpenAI
521
521
  # request can write up to four breakpoints. For cache matching, OpenAI considers
522
522
  # up to the latest 80 breakpoints in the conversation, without a content-block
523
523
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
524
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
524
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
525
525
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
526
526
  # for current details.
527
527
  prompt_cache_options: nil,
@@ -815,7 +815,7 @@ module OpenAI
815
815
  # request can write up to four breakpoints. For cache matching, OpenAI considers
816
816
  # up to the latest 80 breakpoints in the conversation, without a content-block
817
817
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
818
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
818
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
819
819
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
820
820
  # for current details.
821
821
  prompt_cache_options: nil,
@@ -0,0 +1,23 @@
1
+ module OpenAI
2
+ module Models
3
+ module Admin
4
+ module Organization
5
+ module ProjectOptionalServiceTier = Projects::ProjectOptionalServiceTier
6
+
7
+ module Projects
8
+ type project_optional_service_tier = :flex | :fast | :ultrafast
9
+
10
+ module ProjectOptionalServiceTier
11
+ extend OpenAI::Internal::Type::Enum
12
+
13
+ FLEX: :flex
14
+ FAST: :fast
15
+ ULTRAFAST: :ultrafast
16
+
17
+ def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::Projects::project_optional_service_tier]
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,72 @@
1
+ module OpenAI
2
+ module Models
3
+ module Admin
4
+ module Organization
5
+ class ProjectServiceTierSettings = Projects::ProjectServiceTierSettings
6
+
7
+ module Projects
8
+ type project_service_tier_settings =
9
+ {
10
+ default: OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::default,
11
+ enabled_tiers: OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::enabled_tiers,
12
+ ?object: :"project.service_tier_settings"
13
+ }
14
+
15
+ class ProjectServiceTierSettings < OpenAI::Internal::Type::BaseModel
16
+ # Default tier for requests that omit service_tier or use auto.
17
+ attr_accessor default: OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::default
18
+
19
+ # Additional service tiers enabled for this project. "all" includes future tiers.
20
+ # An empty array allows only Standard. Organization policy and eligibility still
21
+ # apply.
22
+ attr_accessor enabled_tiers: OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::enabled_tiers
23
+
24
+ attr_accessor object: :"project.service_tier_settings"
25
+
26
+ # @param default
27
+ # Default tier for requests that omit service_tier or use auto.
28
+ # @param enabled_tiers
29
+ # Additional service tiers enabled for this project. "all" includes future tiers.
30
+ # An empty array allows only Standard. Organization policy and eligibility still
31
+ # apply.
32
+ def initialize: (
33
+ default: OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::default,
34
+ enabled_tiers: OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::enabled_tiers,
35
+ ?object: :"project.service_tier_settings"
36
+ ) -> void
37
+
38
+ def to_hash: -> {
39
+ default: OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::default,
40
+ enabled_tiers: OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::enabled_tiers,
41
+ ?object: :"project.service_tier_settings"
42
+ }
43
+
44
+ type default = :standard | :fast | :scale
45
+
46
+ module Default
47
+ extend OpenAI::Internal::Type::Enum
48
+
49
+ STANDARD: :standard
50
+ FAST: :fast
51
+ SCALE: :scale
52
+
53
+ def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::default]
54
+ end
55
+
56
+ type enabled_tiers =
57
+ :all
58
+ | ::Array[OpenAI::Models::Admin::Organization::Projects::project_optional_service_tier]
59
+
60
+ module EnabledTiers
61
+ extend OpenAI::Internal::Type::Union
62
+
63
+ def self?.variants: -> ::Array[OpenAI::Models::Admin::Organization::Projects::ProjectServiceTierSettings::enabled_tiers]
64
+
65
+ ProjectOptionalServiceTierArray: OpenAI::Internal::Type::Converter
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,32 @@
1
+ module OpenAI
2
+ module Models
3
+ module Admin
4
+ module Organization
5
+ module Projects
6
+ type service_tier_setting_retrieve_params =
7
+ { project_id: String, ?request_options: OpenAI::request_opts }
8
+
9
+ class ServiceTierSettingRetrieveParams < OpenAI::Internal::Type::BaseModel
10
+ extend OpenAI::Internal::Type::RequestParameters::Converter
11
+ include OpenAI::Internal::Type::RequestParameters
12
+
13
+ # The ID of the project
14
+ attr_accessor project_id: String
15
+
16
+ # @param project_id
17
+ # The ID of the project
18
+ def initialize: (
19
+ project_id: String,
20
+ ?request_options: OpenAI::request_opts
21
+ ) -> void
22
+
23
+ def to_hash: -> {
24
+ project_id: String,
25
+ ?request_options: OpenAI::RequestOptions
26
+ }
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,91 @@
1
+ module OpenAI
2
+ module Models
3
+ module Admin
4
+ module Organization
5
+ module Projects
6
+ type service_tier_setting_update_params =
7
+ {
8
+ project_id: String,
9
+ ?default: OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::default,
10
+ ?enabled_tiers: OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::enabled_tiers,
11
+ ?request_options: OpenAI::request_opts
12
+ }
13
+
14
+ class ServiceTierSettingUpdateParams < OpenAI::Internal::Type::BaseModel
15
+ extend OpenAI::Internal::Type::RequestParameters::Converter
16
+ include OpenAI::Internal::Type::RequestParameters
17
+
18
+ # The ID of the project
19
+ attr_accessor project_id: String
20
+
21
+ # Default tier for requests that omit service_tier or use auto.
22
+ attr_reader default: OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::default?
23
+
24
+ # Default tier for requests that omit service_tier or use auto.
25
+ def default=: (
26
+ OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::default
27
+ ) -> OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::default
28
+
29
+ # Additional service tiers enabled for this project. "all" includes future tiers.
30
+ # An empty array allows only Standard. Organization policy and eligibility still
31
+ # apply.
32
+ attr_reader enabled_tiers: OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::enabled_tiers?
33
+
34
+ # Additional service tiers enabled for this project. "all" includes future tiers.
35
+ # An empty array allows only Standard. Organization policy and eligibility still
36
+ # apply.
37
+ def enabled_tiers=: (
38
+ OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::enabled_tiers
39
+ ) -> OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::enabled_tiers
40
+
41
+ # @param project_id
42
+ # The ID of the project
43
+ # @param default
44
+ # Default tier for requests that omit service_tier or use auto.
45
+ # @param enabled_tiers
46
+ # Additional service tiers enabled for this project. "all" includes future tiers.
47
+ # An empty array allows only Standard. Organization policy and eligibility still
48
+ # apply.
49
+ def initialize: (
50
+ project_id: String,
51
+ ?default: OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::default,
52
+ ?enabled_tiers: OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::enabled_tiers,
53
+ ?request_options: OpenAI::request_opts
54
+ ) -> void
55
+
56
+ def to_hash: -> {
57
+ project_id: String,
58
+ ?default: OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::default,
59
+ ?enabled_tiers: OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::enabled_tiers,
60
+ ?request_options: OpenAI::RequestOptions
61
+ }
62
+
63
+ type default = :standard | :fast | :scale
64
+
65
+ module Default
66
+ extend OpenAI::Internal::Type::Enum
67
+
68
+ STANDARD: :standard
69
+ FAST: :fast
70
+ SCALE: :scale
71
+
72
+ def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::default]
73
+ end
74
+
75
+ type enabled_tiers =
76
+ :all
77
+ | ::Array[OpenAI::Models::Admin::Organization::Projects::project_optional_service_tier]
78
+
79
+ module EnabledTiers
80
+ extend OpenAI::Internal::Type::Union
81
+
82
+ def self?.variants: -> ::Array[OpenAI::Models::Admin::Organization::Projects::ServiceTierSettingUpdateParams::enabled_tiers]
83
+
84
+ ProjectOptionalServiceTierArray: OpenAI::Internal::Type::Converter
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -1414,12 +1414,13 @@ module OpenAI
1414
1414
  def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponse::PromptCacheOptions::mode]
1415
1415
  end
1416
1416
 
1417
- type ttl = :"30m"
1417
+ type ttl = :"30m" | :"12h"
1418
1418
 
1419
1419
  module Ttl
1420
1420
  extend OpenAI::Internal::Type::Enum
1421
1421
 
1422
1422
  TTL_30M: :"30m"
1423
+ TTL_12H: :"12h"
1423
1424
 
1424
1425
  def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponse::PromptCacheOptions::ttl]
1425
1426
  end
@@ -55,7 +55,11 @@ module OpenAI
55
55
  }
56
56
 
57
57
  type input_tokens_details =
58
- { cache_write_tokens: Integer, cached_tokens: Integer }
58
+ {
59
+ cache_write_tokens: Integer,
60
+ cached_tokens: Integer,
61
+ ?cache_write_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails::CacheWriteTokensDetails
62
+ }
59
63
 
60
64
  class InputTokensDetails < OpenAI::Internal::Type::BaseModel
61
65
  # The number of input tokens that were written to the cache.
@@ -65,6 +69,12 @@ module OpenAI
65
69
  # [More on prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching).
66
70
  attr_accessor cached_tokens: Integer
67
71
 
72
+ attr_reader cache_write_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails::CacheWriteTokensDetails?
73
+
74
+ def cache_write_tokens_details=: (
75
+ OpenAI::Beta::BetaResponseUsage::InputTokensDetails::CacheWriteTokensDetails
76
+ ) -> OpenAI::Beta::BetaResponseUsage::InputTokensDetails::CacheWriteTokensDetails
77
+
68
78
  # @param cache_write_tokens
69
79
  # The number of input tokens that were written to the cache.
70
80
  # @param cached_tokens
@@ -72,13 +82,40 @@ module OpenAI
72
82
  # [More on prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching).
73
83
  def initialize: (
74
84
  cache_write_tokens: Integer,
75
- cached_tokens: Integer
85
+ cached_tokens: Integer,
86
+ ?cache_write_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails::CacheWriteTokensDetails
76
87
  ) -> void
77
88
 
78
89
  def to_hash: -> {
79
90
  cache_write_tokens: Integer,
80
- cached_tokens: Integer
91
+ cached_tokens: Integer,
92
+ ?cache_write_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails::CacheWriteTokensDetails
81
93
  }
94
+
95
+ type cache_write_tokens_details =
96
+ { :ttl_12h_tokens => Integer, :ttl_30m_tokens => Integer }
97
+
98
+ class CacheWriteTokensDetails < OpenAI::Internal::Type::BaseModel
99
+ # The number of input tokens written with 12-hour retention.
100
+ attr_accessor ttl_12h_tokens: Integer
101
+
102
+ # The number of input tokens written with 30-minute retention.
103
+ attr_accessor ttl_30m_tokens: Integer
104
+
105
+ # @param ttl_12h_tokens
106
+ # The number of input tokens written with 12-hour retention.
107
+ # @param ttl_30m_tokens
108
+ # The number of input tokens written with 30-minute retention.
109
+ def initialize: (
110
+ ttl_12h_tokens: Integer,
111
+ ttl_30m_tokens: Integer
112
+ ) -> void
113
+
114
+ def to_hash: -> {
115
+ :ttl_12h_tokens => Integer,
116
+ :ttl_30m_tokens => Integer
117
+ }
118
+ end
82
119
  end
83
120
 
84
121
  type output_tokens_details = { reasoning_tokens: Integer }