AsyncFiles Class — anthropic-sdk-python Architecture
Architecture documentation for the AsyncFiles class in files.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD e4e596a3_8f28_361a_1681_29f79feb432d["AsyncFiles"] f98629a5_73f4_23f2_1f7f_c8db837848d1["AsyncAPIResource"] e4e596a3_8f28_361a_1681_29f79feb432d -->|extends| f98629a5_73f4_23f2_1f7f_c8db837848d1 8eb6ac96_326e_83d2_aa95_9071b1193d06["files.py"] e4e596a3_8f28_361a_1681_29f79feb432d -->|defined in| 8eb6ac96_326e_83d2_aa95_9071b1193d06 691996d4_bfc5_844e_b7b9_723fd3d0bc16["with_raw_response()"] e4e596a3_8f28_361a_1681_29f79feb432d -->|method| 691996d4_bfc5_844e_b7b9_723fd3d0bc16 0ed037b5_fa5d_866b_e313_2f9b0df89e37["with_streaming_response()"] e4e596a3_8f28_361a_1681_29f79feb432d -->|method| 0ed037b5_fa5d_866b_e313_2f9b0df89e37 541945f9_1688_0c69_bcd4_b1ce44c67e62["list()"] e4e596a3_8f28_361a_1681_29f79feb432d -->|method| 541945f9_1688_0c69_bcd4_b1ce44c67e62 025b44d7_a99f_b2c7_74d7_3cf7d2665168["delete()"] e4e596a3_8f28_361a_1681_29f79feb432d -->|method| 025b44d7_a99f_b2c7_74d7_3cf7d2665168 b4afc057_6083_1668_0f21_dfb95d7e42fd["download()"] e4e596a3_8f28_361a_1681_29f79feb432d -->|method| b4afc057_6083_1668_0f21_dfb95d7e42fd 74301b64_0944_5cd9_ab2c_d26e1054093e["retrieve_metadata()"] e4e596a3_8f28_361a_1681_29f79feb432d -->|method| 74301b64_0944_5cd9_ab2c_d26e1054093e b6e7caed_07d6_372f_f216_e5a44b9dd309["upload()"] e4e596a3_8f28_361a_1681_29f79feb432d -->|method| b6e7caed_07d6_372f_f216_e5a44b9dd309
Relationship Graph
Source Code
src/anthropic/resources/beta/files.py lines 331–622
class AsyncFiles(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncFilesWithRawResponse:
"""
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 AsyncFilesWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> AsyncFilesWithStreamingResponse:
"""
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 AsyncFilesWithStreamingResponse(self)
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[FileMetadata, AsyncPage[FileMetadata]]:
"""List Files
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(chain((str(e) for e in betas), ["files-api-2025-04-14"]))
if is_given(betas)
else not_given
}
),
**(extra_headers or {}),
}
extra_headers = {"anthropic-beta": "files-api-2025-04-14", **(extra_headers or {})}
return self._get_api_list(
"/v1/files?beta=true",
page=AsyncPage[FileMetadata],
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,
Domain
Defined In
Extends
Source
Frequently Asked Questions
What is the AsyncFiles class?
AsyncFiles is a class in the anthropic-sdk-python codebase, defined in src/anthropic/resources/beta/files.py.
Where is AsyncFiles defined?
AsyncFiles is defined in src/anthropic/resources/beta/files.py at line 331.
What does AsyncFiles extend?
AsyncFiles extends AsyncAPIResource.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free