struct

Anthropic::ModelListResponse

Inherits JSON::Serializable < Struct < Value < Object

Response from listing models

Contains a paginated array of ModelInfo objects along with pagination metadata.

Constructors

new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

auto_paging_all(client : Client) : Array(ModelInfo)

Auto-paginate through all models (if paginated)

Returns an array of all models across all pages

all_models = client.models.list.auto_paging_all(client)
all_models.each do |model|
  puts model.display_name
end
Source
data

Array of model information objects

Source
each

Iteration helper to iterate over models in the data array

response.each do |model|
  puts model.display_name
end
Source
first_id

ID of the first model in this page

Source
has_more?

Whether there are more models available

Source
last_id

ID of the last model in this page

Source