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

Method list

src/anthropic/resources/beta/models.py:220–283  ·  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

218 )
219
220 def list(
221 self,
222 *,
223 after_id: str | Omit = omit,
224 before_id: str | Omit = omit,
225 limit: int | Omit = omit,
226 betas: List[AnthropicBetaParam] | Omit = omit,
227 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
228 # The extra values given here take precedence over values defined on the client or passed to this method.
229 extra_headers: Headers | None = None,
230 extra_query: Query | None = None,
231 extra_body: Body | None = None,
232 timeout: float | httpx.Timeout | None | NotGiven = not_given,
233 ) -> AsyncPaginator[BetaModelInfo, AsyncPage[BetaModelInfo]]:
234 """
235 List available models.
236
237 The Models API response can be used to determine which models are available for
238 use in the API. More recently released models are listed first.
239
240 Args:
241 after_id: ID of the object to use as a cursor for pagination. When provided, returns the
242 page of results immediately after this object.
243
244 before_id: ID of the object to use as a cursor for pagination. When provided, returns the
245 page of results immediately before this object.
246
247 limit: Number of items to return per page.
248
249 Defaults to `20`. Ranges from `1` to `1000`.
250
251 betas: Optional header to specify the beta version(s) you want to use.
252
253 extra_headers: Send extra headers
254
255 extra_query: Add additional query parameters to the request
256
257 extra_body: Add additional JSON properties to the request
258
259 timeout: Override the client-level default timeout for this request, in seconds
260 """
261 extra_headers = {
262 **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}),
263 **(extra_headers or {}),
264 }
265 return self._get_api_list(
266 "/v1/models?beta=true",
267 page=AsyncPage[BetaModelInfo],
268 options=make_request_options(
269 extra_headers=extra_headers,
270 extra_query=extra_query,
271 extra_body=extra_body,
272 timeout=timeout,
273 query=maybe_transform(
274 {
275 "after_id": after_id,
276 "before_id": before_id,
277 "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