Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
5,068 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
5,068
◇
Types & classes
1,620
↳
Endpoints
13
↓ 3 callers
Function
_backoff
(attempt: int)
src/anthropic/lib/environments/_poller.py:30
↓ 3 callers
Function
_beat_ok
(ttl_seconds: int = 0)
tests/lib/environments/test_worker.py:594
↓ 3 callers
Function
_config_dir
Resolve the config directory. ``ANTHROPIC_CONFIG_DIR`` env var → platform default. Platform defaults: * Linux & macOS: ``~/.config/ant
src/anthropic/lib/credentials/_constants.py:67
↓ 3 callers
Method
_enforce_trailing_slash
(self, url: URL)
src/anthropic/_base_client.py:420
↓ 3 callers
Function
_fs_error
(op: str, file_path: str, e: OSError)
src/anthropic/lib/tools/agent_toolset.py:182
↓ 3 callers
Function
_get_annotated_type
If the given type is an `Annotated` type then it is returned, if not `None` is returned. This also unwraps the type when applicable, e.g. `Requir
src/anthropic/_utils/_transform.py:116
↓ 3 callers
Method
_get_page_items
(self)
src/anthropic/_base_client.py:210
↓ 3 callers
Function
_is_fatal_4xx
(err: Exception)
src/anthropic/lib/environments/_poller.py:38
↓ 3 callers
Function
_is_supported_image_type
(mime_type: str)
src/anthropic/lib/tools/mcp.py:108
↓ 3 callers
Function
_jitter
(low: float, high: float)
src/anthropic/lib/environments/_poller.py:34
↓ 3 callers
Function
_json_dumps_secrets
``json.dumps`` with ``SecretStr`` values unwrapped at dump time. Returns bytes so call sites can pass the result inline (request content, ``o
src/anthropic/lib/credentials/_secrets.py:95
↓ 3 callers
Method
_make_status_error
( self, err_msg: str, *, body: object, response: httpx.Response, )
src/anthropic/_client.py:522
↓ 3 callers
Function
_make_tar
(path: Path, members: list[tuple[tarfile.TarInfo, bytes]])
tests/lib/tools/test_skills.py:80
↓ 3 callers
Function
_make_zip_infos
(path: Path, entries: list[tuple[zipfile.ZipInfo, bytes]])
tests/lib/tools/test_skills.py:93
↓ 3 callers
Function
_message_response
()
tests/lib/test_credentials.py:1956
↓ 3 callers
Function
_messages
(caplog: pytest.LogCaptureFixture)
tests/lib/environments/test_worker.py:612
↓ 3 callers
Function
_not_found_result
(tool_use_id: str)
tests/lib/tools/test_runners.py:1013
↓ 3 callers
Function
_read_file_content
(full_path: Path, memory_path: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:354
↓ 3 callers
Function
_redact_body
Truncate a token-endpoint error body for safe inclusion in an exception.
src/anthropic/lib/credentials/_workload.py:58
↓ 3 callers
Method
_request_api_list
( self, model: Type[object], page: Type[SyncPageT], options: FinalRequestOptio
src/anthropic/_base_client.py:1405
↓ 3 callers
Function
_request_id
(resp: httpx.Response)
src/anthropic/lib/credentials/_workload.py:53
↓ 3 callers
Method
_resolve_base_url
base_url precedence: top-level config field → bound (the owning client's base_url, via :meth:`bind_base_url`) → default. Validated aga
src/anthropic/lib/credentials/_providers.py:275
↓ 3 callers
Function
_resolve_max_bytes
Resolve a configured cap to an effective size limit. ``not_given`` selects ``default``; ``None`` disables the size check (uncapped); a positi
src/anthropic/lib/tools/agent_toolset.py:130
↓ 3 callers
Function
_run_heartbeat_loop
( monkeypatch: pytest.MonkeyPatch, script: list[tuple[float, Any]] )
tests/lib/environments/test_worker.py:598
↓ 3 callers
Function
_safe_json
(text: str)
src/anthropic/lib/middleware/_fallbacks.py:1510
↓ 3 callers
Function
_seam_block
The synthetic `fallback` content block marking one model boundary.
src/anthropic/lib/middleware/_fallbacks.py:1405
↓ 3 callers
Method
_should_retry
(self, response: httpx.Response)
src/anthropic/_base_client.py:841
↓ 3 callers
Method
_signal
(self)
src/anthropic/lib/tools/_beta_session_runner.py:173
↓ 3 callers
Function
_strip_traceback
Detach the frames chained onto ``err`` before raising from it. Foreign frames (json decoder, httpx transport) hold raw payloads — request bod
src/anthropic/lib/credentials/_secrets.py:104
↓ 3 callers
Function
_tar_special
(name: str, type: bytes, linkname: str = "")
tests/lib/tools/test_skills.py:71
↓ 3 callers
Function
_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:154
↓ 3 callers
Function
_unwrap_secret
Inverse of :func:`_wrap_secret_fields` for a single value; pass-through for values that were never wrapped (absent or non-string fields).
src/anthropic/lib/credentials/_secrets.py:83
↓ 3 callers
Function
_validate_profile_name
Reject profile names that could escape the config directory. Profile names come from user-controlled sources (``ANTHROPIC_PROFILE``, the ``ac
src/anthropic/lib/credentials/_constants.py:135
↓ 3 callers
Function
_wrap_secret_fields
Wrap the secret fields of a parsed JSON object in ``SecretStr``. Called at every boundary where credential material enters SDK code. Tracebac
src/anthropic/lib/credentials/_secrets.py:51
↓ 3 callers
Function
add_response_ids
(obj: BaseModel, *, request_id: str | None, workspace_id: str | None)
src/anthropic/_models.py:850
↓ 3 callers
Method
arm
(Re)start the idle countdown from now and wake the watchdog. Deferred while any gated call is held or in flight — stopping then would
src/anthropic/lib/tools/_beta_session_runner.py:194
↓ 3 callers
Function
async_mcp_tool
Convert an MCP tool to an async runnable tool for ``tool_runner()``. Example:: from anthropic.lib.tools.mcp import async_mcp_tool
src/anthropic/lib/tools/mcp.py:416
↓ 3 callers
Method
bind_base_url
Adopt the owning client's ``base_url`` as a fallback for the token exchange. Slots between the config file's own ``base_url`` field and
src/anthropic/lib/credentials/_providers.py:229
↓ 3 callers
Function
body
()
tests/decoders/test_jsonl.py:17
↓ 3 callers
Method
call
(self, input: object)
src/anthropic/lib/tools/_tool_dispatch.py:43
↓ 3 callers
Method
close
Close the underlying HTTPX client. The client will *not* be usable after this.
src/anthropic/_base_client.py:1042
↓ 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
Method
create
Create a new memory file with the specified content.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:139
↓ 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
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: httpx.Request)
tests/lib/test_scoped_client.py:126
↓ 3 callers
Method
has_next_page
(self)
src/anthropic/pagination.py:36
↓ 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_union_type
(typ: type)
src/anthropic/_utils/_typing.py:40
↓ 3 callers
Method
iter_bytes
(self, chunk_size: int | None = None)
src/anthropic/_legacy_response.py:444
↓ 3 callers
Function
json_response
(body: Any, status: int)
tests/lib/test_refusal_fallback_streaming.py:97
↓ 3 callers
Function
make_async_bedrock_client
(**kwargs: Any)
tests/test_middleware.py:1829
↓ 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:1845
↓ 3 callers
Function
make_bedrock_client
(**kwargs: Any)
tests/test_middleware.py:1825
↓ 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:1841
↓ 3 callers
Function
make_vertex_client
(**kwargs: Any)
tests/test_middleware.py:1833
↓ 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:208
↓ 3 callers
Method
read
Read and return the binary response content.
src/anthropic/_response.py:475
↓ 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:421
↓ 3 callers
Function
strip_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:76
↓ 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
↓ 2 callers
Method
__aenter__
(self)
src/anthropic/lib/tools/agent_toolset.py:300
↓ 2 callers
Method
__aenter__
(self)
tests/lib/tools/test_session_runner.py:151
↓ 2 callers
Method
__enter__
(self)
src/anthropic/_streaming.py:172
↓ 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: httpx.Response, cast_to: type[R], client: BaseClient[A
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:68
↓ 2 callers
Method
__stream__
(self)
src/anthropic/_streaming.py:86
↓ 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: httpx.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:63
↓ 2 callers
Function
_assert_only_files_and_dirs
(root: Path)
tests/lib/tools/test_skills.py:99
↓ 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:353
↓ 2 callers
Function
_async_atomic_write_file
(target_path: AsyncPath, content: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:610
↓ 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:281
↓ 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:1264
↓ 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:2017
↓ 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:130
↓ 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:74
↓ 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:319
↓ 2 callers
Function
_close_credentials
Release any resources owned by a credential provider, if it exposes ``close()``.
src/anthropic/_client.py:67
↓ 2 callers
Function
_collect_error
(match: Match[str])
scripts/utils/ruffen-docs.py:39
← previous
next →
301–400 of 5,068, ranked by callers