Models Class — anthropic-sdk-python Architecture
Architecture documentation for the Models class in models.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 00e4fd78_09b1_5b6a_8a40_a899317235b8["Models"] 32bd9d9e_8b62_b229_7718_45771b424c40["SyncAPIResource"] 00e4fd78_09b1_5b6a_8a40_a899317235b8 -->|extends| 32bd9d9e_8b62_b229_7718_45771b424c40 aaf44c70_9358_3dce_9005_4fb1dbf27b38["models.py"] 00e4fd78_09b1_5b6a_8a40_a899317235b8 -->|defined in| aaf44c70_9358_3dce_9005_4fb1dbf27b38 d67a3835_3589_0f24_9bab_4cf3adf192c3["with_raw_response()"] 00e4fd78_09b1_5b6a_8a40_a899317235b8 -->|method| d67a3835_3589_0f24_9bab_4cf3adf192c3 480cd442_a8e3_fa82_4b01_44c8dd0d67cc["with_streaming_response()"] 00e4fd78_09b1_5b6a_8a40_a899317235b8 -->|method| 480cd442_a8e3_fa82_4b01_44c8dd0d67cc 3f61361e_4862_6908_542d_1a4eb9005893["retrieve()"] 00e4fd78_09b1_5b6a_8a40_a899317235b8 -->|method| 3f61361e_4862_6908_542d_1a4eb9005893 e9d91ea5_5c40_a27b_5fc4_32cc57d94c37["list()"] 00e4fd78_09b1_5b6a_8a40_a899317235b8 -->|method| e9d91ea5_5c40_a27b_5fc4_32cc57d94c37
Relationship Graph
Source Code
src/anthropic/resources/beta/models.py lines 24–152
class Models(SyncAPIResource):
@cached_property
def with_raw_response(self) -> ModelsWithRawResponse:
"""
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 ModelsWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> ModelsWithStreamingResponse:
"""
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 ModelsWithStreamingResponse(self)
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,
) -> BetaModelInfo:
"""
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 self._get(
f"/v1/models/{model_id}?beta=true",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=BetaModelInfo,
)
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[BetaModelInfo]:
"""
List available models.
Domain
Defined In
Extends
Source
Frequently Asked Questions
What is the Models class?
Models is a class in the anthropic-sdk-python codebase, defined in src/anthropic/resources/beta/models.py.
Where is Models defined?
Models is defined in src/anthropic/resources/beta/models.py at line 24.
What does Models extend?
Models extends SyncAPIResource.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free