Home / Function/ list() — anthropic-sdk-python Function Reference

list() — anthropic-sdk-python Function Reference

Architecture documentation for the list() function in models.py from the anthropic-sdk-python codebase.

Function python AnthropicClient AsyncAPI calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  0dbf0a80_fae2_982e_20ea_fe7e9c8b14ea["list()"]
  feefa0ea_204d_3792_0bc0_49d99e6cc984["Models"]
  0dbf0a80_fae2_982e_20ea_fe7e9c8b14ea -->|defined in| feefa0ea_204d_3792_0bc0_49d99e6cc984
  525659cc_c762_b40a_9661_c0d3b1d243ff["list()"]
  525659cc_c762_b40a_9661_c0d3b1d243ff -->|calls| 0dbf0a80_fae2_982e_20ea_fe7e9c8b14ea
  525659cc_c762_b40a_9661_c0d3b1d243ff["list()"]
  0dbf0a80_fae2_982e_20ea_fe7e9c8b14ea -->|calls| 525659cc_c762_b40a_9661_c0d3b1d243ff
  style 0dbf0a80_fae2_982e_20ea_fe7e9c8b14ea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/resources/models.py lines 89–152

    def list(
        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,
    ) -> SyncPage[ModelInfo]:
        """
        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, returns the
              page of results immediately after this object.

          before_id: ID of the object to use as a cursor for pagination. When provided, returns the
              page of results immediately before this object.

          limit: Number of items to return per page.

              Defaults to `20`. Ranges from `1` to `1000`.

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        extra_headers = {
            **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}),
            **(extra_headers or {}),
        }
        return self._get_api_list(
            "/v1/models",
            page=SyncPage[ModelInfo],
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {
                        "after_id": after_id,
                        "before_id": before_id,
                        "limit": limit,
                    },
                    model_list_params.ModelListParams,
                ),
            ),
            model=ModelInfo,
        )

Subdomains

Calls

Called By

Frequently Asked Questions

What does list() do?
list() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/resources/models.py.
Where is list() defined?
list() is defined in src/anthropic/resources/models.py at line 89.
What does list() call?
list() calls 1 function(s): list.
What calls list()?
list() is called by 1 function(s): list.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free