Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
6,399 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
6,399
◇
Types & classes
2,012
↳
Endpoints
17
↓ 3 callers
Function
consume_async_iterator
(iterator: AsyncIterator[Any])
src/anthropic/_utils/_streams.py:10
↓ 3 callers
Function
consume_sync_iterator
(iterator: Iterator[Any])
src/anthropic/_utils/_streams.py:5
↓ 3 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:184
↓ 3 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:348
↓ 3 callers
Function
create_stream_async
(client: AsyncAnthropic)
tests/lib/test_refusal_fallback_streaming.py:210
↓ 3 callers
Function
exchange_federation_assertion
Perform a single RFC 7523 ``jwt-bearer`` exchange and return the resulting :class:`AccessToken`. This is a one-shot convenience wrapper aroun
src/anthropic/lib/credentials/_workload.py:367
↓ 3 callers
Method
find_symlinks
Every symlink under ``under`` — listings skip them and reads refuse them, so a caller that must know they exist asks here.
src/anthropic/lib/tools/_file_store.py:178
↓ 3 callers
Method
get_max_retries
(self, max_retries: int)
src/anthropic/_models.py:969
↓ 3 callers
Function
get_type_hints
( obj: Any, globalns: dict[str, Any] | None = None, localns: Mapping[str, Any] | None = None,
src/anthropic/_utils/_transform.py:455
↓ 3 callers
Function
handler
(req: httpx2.Request)
tests/lib/test_scoped_client.py:126
↓ 3 callers
Method
has_next_page
(self)
src/anthropic/pagination.py:36
↓ 3 callers
Function
helper_header
The ``x-stainless-helper: <value>`` header dict, for passing into a ``merge_headers`` call or as ``extra_headers``/``default_headers``. Typin
src/anthropic/lib/_stainless_helpers.py:72
↓ 3 callers
Function
is_file_content
(obj: object)
src/anthropic/_files.py:29
↓ 3 callers
Function
is_iterable
(obj: object)
src/anthropic/_utils/_utils.py:202
↓ 3 callers
Function
is_list_type
(typ: type)
src/anthropic/_utils/_typing.py:25
↓ 3 callers
Function
is_sequence_type
(typ: type)
src/anthropic/_utils/_typing.py:29
↓ 3 callers
Function
is_tuple_t
(obj: _TupleT | object)
src/anthropic/_utils/_utils.py:174
↓ 3 callers
Function
is_type_alias_type
Return whether the provided argument is an instance of `TypeAliasType`. ```python type Int = int is_type_alias_type(Int) # > True
src/anthropic/_utils/_typing.py:59
↓ 3 callers
Function
is_union_type
(typ: type)
src/anthropic/_utils/_typing.py:40
↓ 3 callers
Function
json_response
(body: Any, status: int)
tests/lib/test_refusal_fallback_streaming.py:97
↓ 3 callers
Function
listing_interrupted_by
Run ``interrupt`` once while a sync's server listing is being consumed: right after the sync has processed ``after_items`` listed memories, or
tests/lib/tools/memory_sync/conftest.py:43
↓ 3 callers
Function
make_async_bedrock_client
(**kwargs: Any)
tests/test_middleware.py:1828
↓ 3 callers
Function
make_async_client
(**kwargs: Any)
tests/lib/test_refusal_fallback_streaming.py:77
↓ 3 callers
Function
make_async_mantle_client
(**kwargs: Any)
tests/test_middleware.py:1844
↓ 3 callers
Function
make_bedrock_client
(**kwargs: Any)
tests/test_middleware.py:1824
↓ 3 callers
Function
make_jsonl_iterator
( content: Iterator[bytes], *, sync: bool, line_type: type[_T], )
tests/decoders/test_jsonl.py:79
↓ 3 callers
Function
make_mantle_client
(**kwargs: Any)
tests/test_middleware.py:1840
↓ 3 callers
Function
make_vertex_client
(**kwargs: Any)
tests/test_middleware.py:1832
↓ 3 callers
Function
map_aiohttp_exceptions
()
src/anthropic/_vendor/httpx_aiohttp/transport.py:46
↓ 3 callers
Function
mcp_resource_to_file
Convert MCP resource contents to a file tuple for ``files.upload()``. Returns a ``(filename, content_bytes, mime_type)`` tuple compatible with
src/anthropic/lib/tools/mcp.py:302
↓ 3 callers
Method
next_page_info
(self)
src/anthropic/_base_client.py:207
↓ 3 callers
Method
read
Read and return the binary response content.
src/anthropic/_response.py:471
↓ 3 callers
Function
reject_unrestricted_paths
Raise :class:`TypeError` if the deprecated ``unrestricted_paths`` was passed at all.
src/anthropic/lib/tools/_deprecations.py:22
↓ 3 callers
Method
release
Drop one hold; the last release applies any deferred arm. Once nothing gated is held or in flight, a deferred ``end_turn`` countdown
src/anthropic/lib/tools/_beta_session_runner.py:224
↓ 3 callers
Method
start
(cls, workdir: str | os.PathLike[str], *, env: Optional[Mapping[str, str]] = None)
src/anthropic/lib/tools/agent_toolset.py:466
↓ 3 callers
Function
strip_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:76
↓ 3 callers
Function
to_custom_raw_response_wrapper
Higher order function that takes one of our bound API methods and an `APIResponse` class and wraps the method to support returning the given respo
src/anthropic/_response.py:818
↓ 3 callers
Function
to_custom_streamed_response_wrapper
Higher order function that takes one of our bound API methods and an `APIResponse` class and wraps the method to support streaming and returning t
src/anthropic/_response.py:734
↓ 3 callers
Function
tool_error_content
Render an exception raised by a tool as tool-result content. A :class:`ToolError` carries its own structured content; anything else is render
src/anthropic/lib/tools/_tool_dispatch.py:112
↓ 3 callers
Function
write_text_exact
Write a UTF-8 file without newline translation.
src/anthropic/lib/tools/_files.py:18
↓ 2 callers
Method
__aenter__
(self)
src/anthropic/lib/tools/_file_store.py:129
↓ 2 callers
Method
__aenter__
(self)
tests/lib/tools/test_session_runner.py:151
↓ 2 callers
Method
__enter__
(self)
src/anthropic/_streaming.py:149
↓ 2 callers
Method
__exit__
( self, exc_type: type[BaseException] | None, exc: BaseException | None, exc_t
src/anthropic/lib/streaming/_messages.py:77
↓ 2 callers
Method
__init__
( self, *, raw: httpx2.Response, cast_to: type[R], client: BaseClient[
src/anthropic/_response.py:62
↓ 2 callers
Method
__init__
( self, *, resource: str | None = None, api_key: str | None = None, az
src/anthropic/lib/foundry.py:97
↓ 2 callers
Method
__init__
( self, *, params: ParseMessageCreateParamsBase[ResponseFormatT], options: Req
src/anthropic/lib/tools/_beta_runner.py:97
↓ 2 callers
Method
__stream__
(self)
src/anthropic/_streaming.py:63
↓ 2 callers
Function
_active_profile
Resolve the active profile name. ``ANTHROPIC_PROFILE`` env var → ``<config_dir>/active_config`` pointer file → ``"default"`` literal. The res
src/anthropic/lib/credentials/_constants.py:98
↓ 2 callers
Method
_applicable_body
The request's JSON body when this middleware applies to it, `None` otherwise.
src/anthropic/lib/middleware/_fallbacks.py:328
↓ 2 callers
Method
_apply
(self, request: httpx2.Request, token: str)
src/anthropic/lib/credentials/_auth.py:88
↓ 2 callers
Function
_archive_top_dir
Return the single top-level directory shared by every archive entry, or ``""`` if the entries don't all live under one common directory. Skil
src/anthropic/lib/tools/_skills.py:64
↓ 2 callers
Function
_assert_only_files_and_dirs
(root: Path)
tests/lib/tools/test_skills.py:107
↓ 2 callers
Function
_assert_tool_runner_calls
(calls: List[MockRequestCall])
tests/lib/test_vertex.py:54
↓ 2 callers
Function
_assert_tool_runner_calls
(calls: t.List[MockRequestCall])
tests/lib/test_bedrock.py:486
↓ 2 callers
Function
_async_atomic_write_file
(target_path: AsyncPath, content: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:619
↓ 2 callers
Function
_async_transform_recursive
Transform the given data against the expected type. Args: annotation: The direct type annotation given to the particular piece of data.
src/anthropic/_utils/_transform.py:322
↓ 2 callers
Method
_atomic_write_credentials
Atomic write to the credentials file (NOT the config file). ``data`` may hold :class:`SecretStr` token values (see :meth:`_read_crede
src/anthropic/lib/credentials/_providers.py:457
↓ 2 callers
Function
_atomic_write_file
(target_path: Path, content: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:282
↓ 2 callers
Method
_attempt_request
Prepare, build and send a single HTTP attempt. Returns the response regardless of its status code, along with the prepared options it
src/anthropic/_base_client.py:1239
↓ 2 callers
Method
_attempt_request
Prepare, build and send a single HTTP attempt. Returns the response regardless of its status code, along with the prepared options it
src/anthropic/_base_client.py:1945
↓ 2 callers
Method
_available_tool_names
The tool names currently available, after applying any mid-conversation ``tool_removal`` / ``tool_addition`` blocks. Removal is only
src/anthropic/lib/tools/_beta_runner.py:157
↓ 2 callers
Function
_bind_credentials_base_url
Return the provider this client should exchange tokens through. See :class:`BaseURLBoundProvider`; any other provider (plain callables, custo
src/anthropic/_client.py:65
↓ 2 callers
Function
_canonicalize
Return ``path`` with ``.``/``..`` collapsed lexically and every symlink followed, or raise ``OSError`` — the same outcome on every supported Pytho
src/anthropic/lib/tools/agent_toolset.py:349
↓ 2 callers
Method
_check_size
(self, content: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:136
↓ 2 callers
Function
_check_sync_interval
(interval: float)
src/anthropic/lib/tools/_memories.py:55
↓ 2 callers
Function
_close_credentials
Release any resources owned by a credential provider, if it exposes ``close()``.
src/anthropic/_client.py:58
↓ 2 callers
Function
_collect_error
(match: Match[str])
scripts/utils/ruffen-docs.py:39
↓ 2 callers
Function
_compaction_response
()
tests/lib/tools/test_runners.py:804
↓ 2 callers
Function
_config_file_path
Path to ``<config_dir>/configs/<profile>.json`` (non-secret, 0644).
src/anthropic/lib/credentials/_constants.py:179
↓ 2 callers
Function
_credit_token
The refusal's minted credit token; only the beta surface carries one.
src/anthropic/lib/middleware/_fallbacks.py:1389
↓ 2 callers
Function
_credit_token_param
The retry's `fallback_credit_token`, in the object form. `best_effort` keeps the retry serving even when redemption fails — a bare string wou
src/anthropic/lib/middleware/_fallbacks.py:53
↓ 2 callers
Function
_declined_iteration_entries
The `usage.iterations` entries a declined hop contributes to the chain. The hop's refusal self-reports its iterations: adopt them, retyped to
src/anthropic/lib/middleware/_fallbacks.py:1191
↓ 2 callers
Function
_default_worker_id
()
src/anthropic/lib/environments/_poller.py:76
↓ 2 callers
Function
_expects_response_wrapper
Whether the given `cast_to` asks for the `APIResponse` wrapper itself.
src/anthropic/_base_client.py:2525
↓ 2 callers
Method
_fallback
(self, request: APIRequest)
tests/test_middleware.py:136
↓ 2 callers
Function
_file_json
()
tests/lib/test_stainless_helpers.py:51
↓ 2 callers
Function
_filenames_in_dir
Every regular file under ``base`` as ``(rel_path, path)``; an absent ``base`` is empty, a present non-directory is refused.
src/anthropic/lib/tools/_file_store.py:365
↓ 2 callers
Function
_from_unix_seconds
(seconds: Union[int, float])
src/anthropic/_utils/_datetime_parse.py:44
↓ 2 callers
Function
_fs_reason
Map a filesystem ``OSError`` to a consistent, runtime-independent phrase. The raw ``OSError`` string is platform-specific (``[Errno 2] ENOENT: ..
src/anthropic/lib/tools/agent_toolset.py:162
↓ 2 callers
Method
_get_azure_ad_token
(self)
src/anthropic/lib/foundry.py:262
↓ 2 callers
Method
_get_azure_ad_token
(self)
src/anthropic/lib/foundry.py:480
↓ 2 callers
Method
_get_last_assistant_message
(self)
src/anthropic/lib/tools/_beta_runner.py:323
↓ 2 callers
Method
_get_last_assistant_message
(self)
src/anthropic/lib/tools/_beta_runner.py:458
↓ 2 callers
Function
_get_numeric
(value: StrBytesIntFloat, native_expected_type: str)
src/anthropic/_utils/_datetime_parse.py:33
↓ 2 callers
Function
_get_params
(client: BaseClient[Any, Any])
tests/test_client.py:46
↓ 2 callers
Method
_get_token
(self)
src/anthropic/lib/google_cloud/_client.py:319
↓ 2 callers
Method
_handle_item
The per-item body shared by :meth:`run`'s poll loop and :meth:`handle_item`. Runs a :class:`SessionToolRunner` for the work item's session wh
src/anthropic/lib/environments/_worker.py:604
↓ 2 callers
Function
_has_explicit_active_config
True if the user wrote a non-empty ``active_config`` pointer file. This is an explicit opt-in signal equivalent to setting ``ANTHROPIC_PROFILE``:
src/anthropic/lib/credentials/_constants.py:208
↓ 2 callers
Method
_has_static_credential
(request: httpx2.Request)
src/anthropic/lib/credentials/_auth.py:85
↓ 2 callers
Method
_hash_via_cache
(self, rel: str, full: Path, walk_start_ns: int)
src/anthropic/lib/tools/_file_store.py:266
↓ 2 callers
Function
_heartbeat_loop
Keep the work-item lease alive while a session is being served. ``work`` must be bound to a sub-client authenticated for the environment; thi
src/anthropic/lib/environments/_worker.py:166
↓ 2 callers
Method
_idempotency_key
(self)
src/anthropic/_base_client.py:881
↓ 2 callers
Function
_idle_script
Three empty polls, a fourth 301s later, a fifth, one claim, then one more empty poll before the script runs out.
tests/lib/environments/test_poller_method.py:343
↓ 2 callers
Function
_infer_region
Infer the AWS region from the environment variables or from the boto3 session if available.
src/anthropic/lib/bedrock/_client.py:69
↓ 2 callers
Method
_info_to_options
(self, info: PageInfo)
src/anthropic/_base_client.py:216
↓ 2 callers
Function
_is_async_callable
Whether calling the given object returns a coroutine. Unlike `inspect.iscoroutinefunction(obj)` this also handles class instances that define
src/anthropic/_middleware.py:73
↓ 2 callers
Method
_iter_events
(self)
src/anthropic/_streaming.py:51
↓ 2 callers
Function
_keeps_base_url
Whether a ``copy()`` stays on the parent's deployment. Tokens are only valid for the deployment that minted them, so the parent's :class:`Tok
src/anthropic/_client.py:76
↓ 2 callers
Function
_make
(fn: FunctionT)
src/anthropic/lib/tools/_beta_functions.py:426
← previous
next →
401–500 of 6,399, ranked by callers