AsyncModels Class — anthropic-sdk-python Architecture
Architecture documentation for the AsyncModels class in models.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD c46bbe0c_9ae7_3070_b751_905cdb25b6c0["AsyncModels"] f98629a5_73f4_23f2_1f7f_c8db837848d1["AsyncAPIResource"] c46bbe0c_9ae7_3070_b751_905cdb25b6c0 -->|extends| f98629a5_73f4_23f2_1f7f_c8db837848d1 4a949196_7222_6f5f_da12_31c9260bb10f["models.py"] c46bbe0c_9ae7_3070_b751_905cdb25b6c0 -->|defined in| 4a949196_7222_6f5f_da12_31c9260bb10f 13e53293_cbdb_708d_bac4_77e863837b9f["with_raw_response()"] c46bbe0c_9ae7_3070_b751_905cdb25b6c0 -->|method| 13e53293_cbdb_708d_bac4_77e863837b9f 50c1be77_b8e8_bc99_6142_3606f23cfc5d["with_streaming_response()"] c46bbe0c_9ae7_3070_b751_905cdb25b6c0 -->|method| 50c1be77_b8e8_bc99_6142_3606f23cfc5d 3c9a7342_962d_e68e_1120_a94b887906bb["retrieve()"] c46bbe0c_9ae7_3070_b751_905cdb25b6c0 -->|method| 3c9a7342_962d_e68e_1120_a94b887906bb 525659cc_c762_b40a_9661_c0d3b1d243ff["list()"] c46bbe0c_9ae7_3070_b751_905cdb25b6c0 -->|method| 525659cc_c762_b40a_9661_c0d3b1d243ff
Relationship Graph
Source Code
src/anthropic/resources/models.py lines 155–283
class AsyncModels(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncModelsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
"""
return AsyncModelsWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> AsyncModelsWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
"""
return AsyncModelsWithStreamingResponse(self)
async def retrieve(
self,
model_id: str,
*,
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,
) -> ModelInfo:
"""
Get a specific model.
The Models API response can be used to determine information about a specific
model or resolve a model alias to a model ID.
Args:
model_id: Model identifier or alias.
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
"""
if not model_id:
raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
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 await self._get(
f"/v1/models/{model_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=ModelInfo,
)
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,
) -> AsyncPaginator[ModelInfo, AsyncPage[ModelInfo]]:
"""
List available models.
Domain
Defined In
Extends
Source
Frequently Asked Questions
What is the AsyncModels class?
AsyncModels is a class in the anthropic-sdk-python codebase, defined in src/anthropic/resources/models.py.
Where is AsyncModels defined?
AsyncModels is defined in src/anthropic/resources/models.py at line 155.
What does AsyncModels extend?
AsyncModels extends AsyncAPIResource.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free