MCPcopy
hub / github.com/anthropics/anthropic-sdk-python / list

Method list

src/anthropic/resources/beta/models.py:89–152  ·  view source on GitHub ↗

List available models. The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. Args: after_id: ID of the object to use as a cursor for pagination. When provided, retur

(
        self,
        *,
        after_id: str | Omit = omit,
        before_id: str | Omit = omit,
        limit: int | Omit = omit,
        betas: List[AnthropicBetaParam] | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    )

Source from the content-addressed store, hash-verified

87 )
88
89 def list(
90 self,
91 *,
92 after_id: str | Omit = omit,
93 before_id: str | Omit = omit,
94 limit: int | Omit = omit,
95 betas: List[AnthropicBetaParam] | Omit = omit,
96 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
97 # The extra values given here take precedence over values defined on the client or passed to this method.
98 extra_headers: Headers | None = None,
99 extra_query: Query | None = None,
100 extra_body: Body | None = None,
101 timeout: float | httpx.Timeout | None | NotGiven = not_given,
102 ) -> SyncPage[BetaModelInfo]:
103 """
104 List available models.
105
106 The Models API response can be used to determine which models are available for
107 use in the API. More recently released models are listed first.
108
109 Args:
110 after_id: ID of the object to use as a cursor for pagination. When provided, returns the
111 page of results immediately after this object.
112
113 before_id: ID of the object to use as a cursor for pagination. When provided, returns the
114 page of results immediately before this object.
115
116 limit: Number of items to return per page.
117
118 Defaults to `20`. Ranges from `1` to `1000`.
119
120 betas: Optional header to specify the beta version(s) you want to use.
121
122 extra_headers: Send extra headers
123
124 extra_query: Add additional query parameters to the request
125
126 extra_body: Add additional JSON properties to the request
127
128 timeout: Override the client-level default timeout for this request, in seconds
129 """
130 extra_headers = {
131 **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}),
132 **(extra_headers or {}),
133 }
134 return self._get_api_list(
135 "/v1/models?beta=true",
136 page=SyncPage[BetaModelInfo],
137 options=make_request_options(
138 extra_headers=extra_headers,
139 extra_query=extra_query,
140 extra_body=extra_body,
141 timeout=timeout,
142 query=maybe_transform(
143 {
144 "after_id": after_id,
145 "before_id": before_id,
146 "limit": limit,

Callers

nothing calls this directly

Calls 4

strip_not_givenFunction · 0.85
is_givenFunction · 0.85
make_request_optionsFunction · 0.85
maybe_transformFunction · 0.85

Tested by

no test coverage detected