Skip to content

Commit 0540b11

Browse files
feat(api): add lifecycle stage fields and filter to /v1/models
Stainless-Generated-From: 882eb6e6e3f80bf33b1a00ef35d2a4388b73a0ff
1 parent 5c31991 commit 0540b11

21 files changed

Lines changed: 597 additions & 8 deletions

File tree

‎lib/anthropic/models/beta/beta_model_info.rb‎

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,34 @@ class BetaModelInfo < Anthropic::Internal::Type::BaseModel
3333
# @return [Time]
3434
required :created_at, Time
3535

36+
# @!attribute deprecated_at
37+
# RFC 3339 datetime string representing the time of the model's most recent
38+
# deprecation. Populated for `deprecated` and `retired` models; `null` while the
39+
# model is `active`.
40+
#
41+
# @return [Time, nil]
42+
required :deprecated_at, Time, nil?: true
43+
3644
# @!attribute display_name
3745
# A human-readable name for the model.
3846
#
3947
# @return [String]
4048
required :display_name, String
4149

50+
# @!attribute lifecycle
51+
# The model's current lifecycle stage.
52+
#
53+
# - `active`: The model is available for use, open to new adopters, and not
54+
# scheduled for retirement.
55+
# - `deprecated`: The model remains callable for organizations with existing
56+
# access, but is headed for retirement and closed to new adopters.
57+
# - `retired`: The model is no longer available for use; inference requests naming
58+
# it fail. It remains in the catalogue as the historical record of its
59+
# retirement.
60+
#
61+
# @return [Symbol, Anthropic::Models::Beta::BetaModelInfo::Lifecycle]
62+
required :lifecycle, enum: -> { Anthropic::Beta::BetaModelInfo::Lifecycle }
63+
4264
# @!attribute line
4365
# The model line this model belongs to, such as `opus` for both Claude Opus 4.5
4466
# and Claude Opus 4.6. More lines may be added. `null` when the model belongs to
@@ -59,6 +81,16 @@ class BetaModelInfo < Anthropic::Internal::Type::BaseModel
5981
# @return [Integer, nil]
6082
required :max_tokens, Integer, nil?: true
6183

84+
# @!attribute retires_at
85+
# RFC 3339 datetime string representing the model's currently scheduled retirement
86+
# date. The schedule can be revised until retirement occurs; `null` while the
87+
# model is `active` or while no retirement is scheduled. A past date on a
88+
# `deprecated` model means retirement is overdue, not that it has occurred:
89+
# `lifecycle` is the retirement signal.
90+
#
91+
# @return [Time, nil]
92+
required :retires_at, Time, nil?: true
93+
6294
# @!attribute type
6395
# Object type.
6496
#
@@ -67,7 +99,7 @@ class BetaModelInfo < Anthropic::Internal::Type::BaseModel
6799
# @return [Symbol, :model]
68100
required :type, const: :model
69101

70-
# @!method initialize(id:, allowed_fallback_models:, capabilities:, created_at:, display_name:, line:, max_input_tokens:, max_tokens:, type: :model)
102+
# @!method initialize(id:, allowed_fallback_models:, capabilities:, created_at:, deprecated_at:, display_name:, lifecycle:, line:, max_input_tokens:, max_tokens:, retires_at:, type: :model)
71103
# Some parameter documentations has been truncated, see
72104
# {Anthropic::Models::Beta::BetaModelInfo} for more details.
73105
#
@@ -79,15 +111,43 @@ class BetaModelInfo < Anthropic::Internal::Type::BaseModel
79111
#
80112
# @param created_at [Time] RFC 3339 datetime string representing the time at which the model was released.
81113
#
114+
# @param deprecated_at [Time, nil] RFC 3339 datetime string representing the time of the model's most recent deprec
115+
#
82116
# @param display_name [String] A human-readable name for the model.
83117
#
118+
# @param lifecycle [Symbol, Anthropic::Models::Beta::BetaModelInfo::Lifecycle] The model's current lifecycle stage.
119+
#
84120
# @param line [Symbol, Anthropic::Models::Beta::BetaModelLine, nil] The model line this model belongs to, such as `opus` for both Claude Opus 4.5 an
85121
#
86122
# @param max_input_tokens [Integer, nil] Maximum input context window size in tokens for this model.
87123
#
88124
# @param max_tokens [Integer, nil] Maximum value for the `max_tokens` parameter when using this model.
89125
#
126+
# @param retires_at [Time, nil] RFC 3339 datetime string representing the model's currently scheduled retirement
127+
#
90128
# @param type [Symbol, :model] Object type.
129+
130+
# The model's current lifecycle stage.
131+
#
132+
# - `active`: The model is available for use, open to new adopters, and not
133+
# scheduled for retirement.
134+
# - `deprecated`: The model remains callable for organizations with existing
135+
# access, but is headed for retirement and closed to new adopters.
136+
# - `retired`: The model is no longer available for use; inference requests naming
137+
# it fail. It remains in the catalogue as the historical record of its
138+
# retirement.
139+
#
140+
# @see Anthropic::Models::Beta::BetaModelInfo#lifecycle
141+
module Lifecycle
142+
extend Anthropic::Internal::Type::Enum
143+
144+
ACTIVE = :active
145+
DEPRECATED = :deprecated
146+
RETIRED = :retired
147+
148+
# @!method self.values
149+
# @return [Array<Symbol>]
150+
end
91151
end
92152
end
93153

‎lib/anthropic/models/beta/model_list_params.rb‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ class ModelListParams < Anthropic::Internal::Type::BaseModel
2222
# @return [String, nil]
2323
optional :before_id, String
2424

25+
# @!attribute lifecycle
26+
# Filter the list to models in any of the given lifecycle stages (`active`,
27+
# `deprecated`, or `retired`). Up to 3 values. When omitted, the list contains the
28+
# `active` and `deprecated` models; `retired` models appear only when `retired` is
29+
# requested explicitly.
30+
#
31+
# @return [Array<Symbol, Anthropic::Models::Beta::ModelListParams::Lifecycle>, nil]
32+
optional :lifecycle,
33+
-> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::ModelListParams::Lifecycle] }
34+
2535
# @!attribute limit
2636
# Number of items to return per page.
2737
#
@@ -47,21 +57,34 @@ class ModelListParams < Anthropic::Internal::Type::BaseModel
4757
# @return [String, nil]
4858
optional :workspace_id, String
4959

50-
# @!method initialize(after_id: nil, before_id: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {})
60+
# @!method initialize(after_id: nil, before_id: nil, lifecycle: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {})
5161
# Some parameter documentations has been truncated, see
5262
# {Anthropic::Models::Beta::ModelListParams} for more details.
5363
#
5464
# @param after_id [String] ID of the object to use as a cursor for pagination. When provided, returns the p
5565
#
5666
# @param before_id [String] ID of the object to use as a cursor for pagination. When provided, returns the p
5767
#
68+
# @param lifecycle [Array<Symbol, Anthropic::Models::Beta::ModelListParams::Lifecycle>] Filter the list to models in any of the given lifecycle stages (`active`, `depre
69+
#
5870
# @param limit [Integer] Number of items to return per page.
5971
#
6072
# @param betas [Array<Symbol, String, Anthropic::Models::AnthropicBeta>] Optional header to specify the beta version(s) you want to use.
6173
#
6274
# @param workspace_id [String] Optional header to select the Workspace for this request. The value is a Workspa
6375
#
6476
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
77+
78+
module Lifecycle
79+
extend Anthropic::Internal::Type::Enum
80+
81+
ACTIVE = :active
82+
DEPRECATED = :deprecated
83+
RETIRED = :retired
84+
85+
# @!method self.values
86+
# @return [Array<Symbol>]
87+
end
6588
end
6689
end
6790
end

‎lib/anthropic/models/model_info.rb‎

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,34 @@ class ModelInfo < Anthropic::Internal::Type::BaseModel
2424
# @return [Time]
2525
required :created_at, Time
2626

27+
# @!attribute deprecated_at
28+
# RFC 3339 datetime string representing the time of the model's most recent
29+
# deprecation. Populated for `deprecated` and `retired` models; `null` while the
30+
# model is `active`.
31+
#
32+
# @return [Time, nil]
33+
required :deprecated_at, Time, nil?: true
34+
2735
# @!attribute display_name
2836
# A human-readable name for the model.
2937
#
3038
# @return [String]
3139
required :display_name, String
3240

41+
# @!attribute lifecycle
42+
# The model's current lifecycle stage.
43+
#
44+
# - `active`: The model is available for use, open to new adopters, and not
45+
# scheduled for retirement.
46+
# - `deprecated`: The model remains callable for organizations with existing
47+
# access, but is headed for retirement and closed to new adopters.
48+
# - `retired`: The model is no longer available for use; inference requests naming
49+
# it fail. It remains in the catalogue as the historical record of its
50+
# retirement.
51+
#
52+
# @return [Symbol, Anthropic::Models::ModelInfo::Lifecycle]
53+
required :lifecycle, enum: -> { Anthropic::ModelInfo::Lifecycle }
54+
3355
# @!attribute line
3456
# The model line this model belongs to, such as `opus` for both Claude Opus 4.5
3557
# and Claude Opus 4.6. More lines may be added. `null` when the model belongs to
@@ -50,6 +72,16 @@ class ModelInfo < Anthropic::Internal::Type::BaseModel
5072
# @return [Integer, nil]
5173
required :max_tokens, Integer, nil?: true
5274

75+
# @!attribute retires_at
76+
# RFC 3339 datetime string representing the model's currently scheduled retirement
77+
# date. The schedule can be revised until retirement occurs; `null` while the
78+
# model is `active` or while no retirement is scheduled. A past date on a
79+
# `deprecated` model means retirement is overdue, not that it has occurred:
80+
# `lifecycle` is the retirement signal.
81+
#
82+
# @return [Time, nil]
83+
required :retires_at, Time, nil?: true
84+
5385
# @!attribute type
5486
# Object type.
5587
#
@@ -58,7 +90,7 @@ class ModelInfo < Anthropic::Internal::Type::BaseModel
5890
# @return [Symbol, :model]
5991
required :type, const: :model
6092

61-
# @!method initialize(id:, capabilities:, created_at:, display_name:, line:, max_input_tokens:, max_tokens:, type: :model)
93+
# @!method initialize(id:, capabilities:, created_at:, deprecated_at:, display_name:, lifecycle:, line:, max_input_tokens:, max_tokens:, retires_at:, type: :model)
6294
# Some parameter documentations has been truncated, see
6395
# {Anthropic::Models::ModelInfo} for more details.
6496
#
@@ -68,15 +100,43 @@ class ModelInfo < Anthropic::Internal::Type::BaseModel
68100
#
69101
# @param created_at [Time] RFC 3339 datetime string representing the time at which the model was released.
70102
#
103+
# @param deprecated_at [Time, nil] RFC 3339 datetime string representing the time of the model's most recent deprec
104+
#
71105
# @param display_name [String] A human-readable name for the model.
72106
#
107+
# @param lifecycle [Symbol, Anthropic::Models::ModelInfo::Lifecycle] The model's current lifecycle stage.
108+
#
73109
# @param line [Symbol, Anthropic::Models::ModelLine, nil] The model line this model belongs to, such as `opus` for both Claude Opus 4.5 an
74110
#
75111
# @param max_input_tokens [Integer, nil] Maximum input context window size in tokens for this model.
76112
#
77113
# @param max_tokens [Integer, nil] Maximum value for the `max_tokens` parameter when using this model.
78114
#
115+
# @param retires_at [Time, nil] RFC 3339 datetime string representing the model's currently scheduled retirement
116+
#
79117
# @param type [Symbol, :model] Object type.
118+
119+
# The model's current lifecycle stage.
120+
#
121+
# - `active`: The model is available for use, open to new adopters, and not
122+
# scheduled for retirement.
123+
# - `deprecated`: The model remains callable for organizations with existing
124+
# access, but is headed for retirement and closed to new adopters.
125+
# - `retired`: The model is no longer available for use; inference requests naming
126+
# it fail. It remains in the catalogue as the historical record of its
127+
# retirement.
128+
#
129+
# @see Anthropic::Models::ModelInfo#lifecycle
130+
module Lifecycle
131+
extend Anthropic::Internal::Type::Enum
132+
133+
ACTIVE = :active
134+
DEPRECATED = :deprecated
135+
RETIRED = :retired
136+
137+
# @!method self.values
138+
# @return [Array<Symbol>]
139+
end
80140
end
81141
end
82142
end

‎lib/anthropic/models/model_list_params.rb‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ class ModelListParams < Anthropic::Internal::Type::BaseModel
2121
# @return [String, nil]
2222
optional :before_id, String
2323

24+
# @!attribute lifecycle
25+
# Filter the list to models in any of the given lifecycle stages (`active`,
26+
# `deprecated`, or `retired`). Up to 3 values. When omitted, the list contains the
27+
# `active` and `deprecated` models; `retired` models appear only when `retired` is
28+
# requested explicitly.
29+
#
30+
# @return [Array<Symbol, Anthropic::Models::ModelListParams::Lifecycle>, nil]
31+
optional :lifecycle,
32+
-> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::ModelListParams::Lifecycle] }
33+
2434
# @!attribute limit
2535
# Number of items to return per page.
2636
#
@@ -50,21 +60,34 @@ class ModelListParams < Anthropic::Internal::Type::BaseModel
5060
# @return [String, nil]
5161
optional :workspace_id, String
5262

53-
# @!method initialize(after_id: nil, before_id: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {})
63+
# @!method initialize(after_id: nil, before_id: nil, lifecycle: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {})
5464
# Some parameter documentations has been truncated, see
5565
# {Anthropic::Models::ModelListParams} for more details.
5666
#
5767
# @param after_id [String] ID of the object to use as a cursor for pagination. When provided, returns the p
5868
#
5969
# @param before_id [String] ID of the object to use as a cursor for pagination. When provided, returns the p
6070
#
71+
# @param lifecycle [Array<Symbol, Anthropic::Models::ModelListParams::Lifecycle>] Filter the list to models in any of the given lifecycle stages (`active`, `depre
72+
#
6173
# @param limit [Integer] Number of items to return per page.
6274
#
6375
# @param betas [Array<Symbol, String, Anthropic::Models::AnthropicBeta>] Optional header to specify the beta version(s) you want to use.
6476
#
6577
# @param workspace_id [String] Optional header to select the Workspace for this request. The value is a Workspa
6678
#
6779
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
80+
81+
module Lifecycle
82+
extend Anthropic::Internal::Type::Enum
83+
84+
ACTIVE = :active
85+
DEPRECATED = :deprecated
86+
RETIRED = :retired
87+
88+
# @!method self.values
89+
# @return [Array<Symbol>]
90+
end
6891
end
6992
end
7093
end

‎lib/anthropic/resources/beta/models.rb‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ def retrieve(model_id, params = {})
4444
# Some parameter documentations has been truncated, see
4545
# {Anthropic::Models::Beta::ModelListParams} for more details.
4646
#
47-
# @overload list(after_id: nil, before_id: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {})
47+
# @overload list(after_id: nil, before_id: nil, lifecycle: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {})
4848
#
4949
# @param after_id [String] Query param: ID of the object to use as a cursor for pagination. When provided,
5050
#
5151
# @param before_id [String] Query param: ID of the object to use as a cursor for pagination. When provided,
5252
#
53+
# @param lifecycle [Array<Symbol, Anthropic::Models::Beta::ModelListParams::Lifecycle>] Query param: Filter the list to models in any of the given lifecycle stages (`ac
54+
#
5355
# @param limit [Integer] Query param: Number of items to return per page.
5456
#
5557
# @param betas [Array<Symbol, String, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
@@ -62,7 +64,7 @@ def retrieve(model_id, params = {})
6264
#
6365
# @see Anthropic::Models::Beta::ModelListParams
6466
def list(params = {})
65-
query_params = [:after_id, :before_id, :limit]
67+
query_params = [:after_id, :before_id, :lifecycle, :limit]
6668
parsed, options = Anthropic::Beta::ModelListParams.dump_request(params)
6769
query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
6870
@client.request(

‎lib/anthropic/resources/models.rb‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ def retrieve(model_id, params = {})
4343
# Some parameter documentations has been truncated, see
4444
# {Anthropic::Models::ModelListParams} for more details.
4545
#
46-
# @overload list(after_id: nil, before_id: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {})
46+
# @overload list(after_id: nil, before_id: nil, lifecycle: nil, limit: nil, betas: nil, workspace_id: nil, request_options: {})
4747
#
4848
# @param after_id [String] Query param: ID of the object to use as a cursor for pagination. When provided,
4949
#
5050
# @param before_id [String] Query param: ID of the object to use as a cursor for pagination. When provided,
5151
#
52+
# @param lifecycle [Array<Symbol, Anthropic::Models::ModelListParams::Lifecycle>] Query param: Filter the list to models in any of the given lifecycle stages (`ac
53+
#
5254
# @param limit [Integer] Query param: Number of items to return per page.
5355
#
5456
# @param betas [Array<Symbol, String, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
@@ -61,7 +63,7 @@ def retrieve(model_id, params = {})
6163
#
6264
# @see Anthropic::Models::ModelListParams
6365
def list(params = {})
64-
query_params = [:after_id, :before_id, :limit]
66+
query_params = [:after_id, :before_id, :lifecycle, :limit]
6567
parsed, options = Anthropic::ModelListParams.dump_request(params)
6668
query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
6769
@client.request(

0 commit comments

Comments
 (0)