Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
14,068 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
14,068
◇
Types & classes
4,501
↳
Endpoints
96
↓ 2 callers
Method
_add_client_headers
Merge this client's headers under the call's own, and record which ones came from the client. `anthropic-beta` is never recorded, as Bedrock
src/anthropic/_base_client.py:632
↓ 2 callers
Method
_adopt_container
Continue in the container of `reply` on later turns, unless the thread already names one: container-bound server tools reject a follow-up requ
src/anthropic/lib/threads/_thread_state.py:332
↓ 2 callers
Method
_append
(self, request: APIRequest)
tests/test_middleware.py:136
↓ 2 callers
Function
_append_header_value
Append `addition` to a comma-separated header value, skipping tokens that are already present so the same helper isn't recorded twice. Values
src/anthropic/_base_client.py:2903
↓ 2 callers
Method
_append_tool_results
Add `results` right after the reply, where the API takes them, ahead of messages added to the thread while it was handled.
src/anthropic/lib/tools/_beta_runner.py:462
↓ 2 callers
Method
_applicable_body
The request's JSON body when this middleware applies to it, `None` otherwise.
src/anthropic/lib/middleware/_fallbacks.py:344
↓ 2 callers
Method
_apply
(self, request: httpx2.Request, token: str)
src/anthropic/lib/credentials/_auth.py:79
↓ 2 callers
Method
_apply
(self, at: float, *step: Any)
tests/lib/environments/_schedules.py:60
↓ 2 callers
Method
_apply_listed
(self, ids: Sequence[str])
src/anthropic/lib/tools/_beta_session_runner.py:848
↓ 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. Skill
src/anthropic/lib/tools/_skills.py:65
↓ 2 callers
Function
_assert_only_files_and_dirs
(root: Path)
tests/lib/tools/test_skills.py:140
↓ 2 callers
Function
_assert_reply_params_are_left_off_the_compaction_request_only
( respx_mock: MockRouter, tool_choice: BetaToolChoiceParam, fallbacks: Union[List[BetaFallbackPara
tests/lib/tools/test_runners.py:3329
↓ 2 callers
Function
_assert_tool_runner_calls
(calls: List[MockRequestCall])
tests/lib/test_vertex.py:137
↓ 2 callers
Function
_assert_tool_runner_calls
(calls: t.List[MockRequestCall])
tests/lib/test_bedrock.py:766
↓ 2 callers
Function
_async_atomic_write_file
(target_path: AsyncPath, content: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:628
↓ 2 callers
Function
_async_refusal
The same as `_refusal`, for a call on the async class.
tests/lib/tools/toolsets/test_refusals.py:37
↓ 2 callers
Function
_async_validate_no_symlink_escape
(target_path: AsyncPath, memory_root: AsyncPath)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:659
↓ 2 callers
Method
_atomic_write_credentials
Atomic write to the credentials file (NOT the config file). `data` may hold `SecretStr` token values (see `_read_credentials`); they
src/anthropic/lib/credentials/_providers.py:460
↓ 2 callers
Function
_atomic_write_file
(target_path: Path, content: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:283
↓ 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:1513
↓ 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:2318
↓ 2 callers
Function
_bind_credentials_base_url
Return the provider this client should exchange tokens through. See `BaseURLBoundProvider`; any other provider (plain callables, custom impls
src/anthropic/_client.py:68
↓ 2 callers
Method
_build_middleware_chain
Build the middleware invocation chain. The chain only depends on the immutable `self._middleware` tuple so it is built once at constr
src/anthropic/_base_client.py:2246
↓ 2 callers
Function
_build_result_event
Build the result-event params matching `ev`'s tool-call kind. A custom tool call (`agent.custom_tool_use`) is answered with a `user.custom_to
src/anthropic/lib/tools/_beta_session_runner.py:257
↓ 2 callers
Method
_calls_among
A new ID can be that of a later call.
src/anthropic/lib/tools/_beta_session_runner.py:855
↓ 2 callers
Method
_check
(self, request: APIRequest, response: BaseAPIResponse[Any])
src/anthropic/lib/_retry.py:91
↓ 2 callers
Function
_check_message_threads_supported
(client: Anthropic | AsyncAnthropic)
src/anthropic/lib/threads/_beta_threads.py:564
↓ 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:60
↓ 2 callers
Method
_compact
(self, compaction: BetaCompactionConfigParam)
src/anthropic/lib/tools/_beta_runner.py:665
↓ 2 callers
Method
_compact
(self, compaction: BetaCompactionConfigParam)
src/anthropic/lib/tools/_beta_runner.py:1197
↓ 2 callers
Function
_compacted_response_with_an_unmodelled_block
()
tests/lib/tools/test_runners.py:2498
↓ 2 callers
Function
_compaction_response
()
tests/lib/tools/test_runners.py:795
↓ 2 callers
Function
_compaction_then_forecast_responses
()
tests/lib/tools/test_runners.py:3324
↓ 2 callers
Function
_config_file_path
Path to `<config_dir>/configs/<profile>.json` (non-secret, 0644).
src/anthropic/lib/credentials/_constants.py:183
↓ 2 callers
Function
_config_with_its_own_host_and_workspace
(tmp_path: pathlib.Path)
tests/lib/test_scoped_client.py:160
↓ 2 callers
Method
_create_with_recovery
(self, overrides: TurnOverrides, *, stream: Literal[False])
src/anthropic/lib/threads/_beta_threads.py:329
↓ 2 callers
Method
_create_with_recovery
(self, overrides: TurnOverrides, *, stream: Literal[False])
src/anthropic/lib/threads/_beta_threads.py:542
↓ 2 callers
Function
_credit_token
The refusal's minted credit token; only the beta surface carries one.
src/anthropic/lib/middleware/_fallbacks.py:1424
↓ 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:55
↓ 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:1232
↓ 2 callers
Function
_default_bash_env
The default environment of the bash subprocess, and the environment of `rg`, with the runner's own credentials scrubbed. The bash tool runs m
src/anthropic/lib/tools/agent_toolset.py:159
↓ 2 callers
Function
_default_worker_id
()
src/anthropic/lib/environments/_poller.py:85
↓ 2 callers
Function
_echo
(name: str, input: object)
tests/lib/tools/toolsets/_stubs.py:26
↓ 2 callers
Method
_end_failed_refresh
Release any waiters. Returns the stale token to serve if this was an advisory refresh, or `None` if the caller should re-raise `err`.
src/anthropic/lib/credentials/_cache.py:306
↓ 2 callers
Method
_end_refresh
(self, fresh: AccessToken, refresh: Refresh[_EventT])
src/anthropic/lib/credentials/_cache.py:285
↓ 2 callers
Method
_error_chain
(self, error: BaseException)
src/anthropic/_base_client.py:595
↓ 2 callers
Function
_error_details
The `error.details` object of the response body, or an empty one when the body has none.
src/anthropic/lib/threads/_thread_state.py:609
↓ 2 callers
Function
_eventstream_chunk_frame
Encode `payload` as one `chunk` event in AWS eventstream binary framing.
tests/lib/test_bedrock.py:580
↓ 2 callers
Function
_eventstream_frame
(header_values: t.Mapping[str, str], body: bytes)
tests/lib/test_bedrock.py:588
↓ 2 callers
Function
_expected_urls
(segments: tuple[str, str, str])
tests/lib/test_google_cloud.py:102
↓ 2 callers
Function
_expects_response_wrapper
Whether the given `cast_to` asks for the `APIResponse` wrapper itself.
src/anthropic/_base_client.py:3005
↓ 2 callers
Method
_failed_host
(self, request: httpx2.Request, cause: httpx2.RequestError)
src/anthropic/_base_client.py:586
↓ 2 callers
Method
_fallback
(self, request: APIRequest)
tests/test_middleware.py:164
↓ 2 callers
Function
_file_json
()
tests/lib/test_stainless_helpers.py:54
↓ 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
_forward_input_transformations
Copy `input_transformations` from a fallback's `message_start` that was not re-emitted onto the emitted `message_delta`, matching what a server-si
src/anthropic/lib/middleware/_fallbacks.py:1222
↓ 2 callers
Method
_from_state
(cls, client: ClientT, state: ThreadState[RunnableToolT, ResponseFormatT])
src/anthropic/lib/threads/_beta_threads.py:64
↓ 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:176
↓ 2 callers
Method
_get_azure_ad_token
(self)
src/anthropic/lib/foundry.py:254
↓ 2 callers
Method
_get_azure_ad_token
(self)
src/anthropic/lib/foundry.py:466
↓ 2 callers
Function
_get_numeric
(value: StrBytesIntFloat, native_expected_type: str)
src/anthropic/_utils/_datetime_parse.py:33
↓ 2 callers
Function
_get_own_core_schema
(cls: type[pydantic.BaseModel])
src/anthropic/_models.py:603
↓ 2 callers
Function
_get_params
(client: BaseClient[Any, Any])
tests/test_client.py:51
↓ 2 callers
Method
_get_token
(self)
src/anthropic/lib/google_cloud/_client.py:371
↓ 2 callers
Method
_hand_over_messages
Give the thread the history as the loop body left it. `reply` follows it unless `append_messages()` was called, which leaves the history to th
src/anthropic/lib/tools/_beta_runner.py:447
↓ 2 callers
Method
_handle_heartbeat
(self, item: Item, client: str, expected: str | None, token: Token | None)
tests/lib/environments/_fake_work_api.py:431
↓ 2 callers
Method
_handle_poll
(self, client: str)
tests/lib/environments/_fake_work_api.py:401
↓ 2 callers
Method
_handle_request
(self, thread: BetaMessageThread[ResponseFormatT])
src/anthropic/lib/tools/_beta_runner.py:661
↓ 2 callers
Method
_handle_request
(self, thread: BetaAsyncMessageThread[ResponseFormatT])
src/anthropic/lib/tools/_beta_runner.py:1193
↓ 2 callers
Method
_handle_stop
(self, item: Item, force: bool, token: Token | None)
tests/lib/environments/_fake_work_api.py:463
↓ 2 callers
Function
_has_explicit_active_config
True if the user wrote a non-empty `active_config` pointer file. The user has told us which profile is active. If the chain gets as far as th
src/anthropic/lib/credentials/_constants.py:212
↓ 2 callers
Method
_has_static_credential
(request: httpx2.Request)
src/anthropic/lib/credentials/_auth.py:76
↓ 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
Method
_idempotency_key
(self)
src/anthropic/_base_client.py:1086
↓ 2 callers
Method
_idles_on_calls
(self, thread: str)
tests/lib/tools/_fake_sessions_api.py:669
↓ 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:86
↓ 2 callers
Method
_info_to_options
(self, info: PageInfo)
src/anthropic/_base_client.py:254
↓ 2 callers
Function
_interrupted_sse_body
(id: str, text: str, error: type[httpx2.TransportError] | None)
tests/lib/threads/helpers.py:512
↓ 2 callers
Method
_invalidate_rejected
`invalidate()`, unless the cache already replaced `token`, the one a 401 rejected. A late 401 for an older token would otherwise force a refr
src/anthropic/lib/credentials/_cache.py:334
↓ 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
_is_rejected_as_earlier
(self, item: Item, token: Token | None)
tests/lib/environments/_fake_work_api.py:471
↓ 2 callers
Method
_iter_events
(self)
src/anthropic/_streaming.py:72
↓ 2 callers
Method
_keep
(self, text: str)
src/anthropic/lib/tools/agent_toolset.py:831
↓ 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 `TokenCache`
src/anthropic/_client.py:79
↓ 2 callers
Method
_kill_group
(self)
src/anthropic/lib/tools/agent_toolset.py:688
↓ 2 callers
Method
_list_memories
The store's memories — `basic` view (shas, no content) at `_LIST_PAGE_SIZE` per page unless the caller needs `full` pages. `memory_pre
src/anthropic/lib/tools/_memories.py:903
↓ 2 callers
Method
_logged
(self, id: str)
tests/lib/tools/_fake_sessions_api.py:653
↓ 2 callers
Function
_make
(fn: FunctionT)
src/anthropic/lib/tools/_beta_functions.py:427
↓ 2 callers
Method
_make_pin
Pin requests sharing the state to the entry being tried (or warn that there is none).
src/anthropic/lib/middleware/_fallbacks.py:386
↓ 2 callers
Method
_make_sse_decoder
( self, options: FinalRequestOptions | None = None, # noqa: ARG002 )
src/anthropic/_base_client.py:658
↓ 2 callers
Method
_make_status_error_from_response
( self, response: httpx2.Response, )
src/anthropic/_base_client.py:523
↓ 2 callers
Function
_make_zip
(path: Path, entries: dict[str, bytes])
tests/lib/tools/test_skills.py:64
↓ 2 callers
Method
_maybe_override_cast_to
(self, cast_to: type[ResponseT], options: FinalRequestOptions)
src/anthropic/_base_client.py:811
↓ 2 callers
Function
_merge_extra_json
Merge `extra_json` into `json_data` in place, as `_build_request` would. This runs before `_prepare_options` so that client hooks, such as Bedroc
src/anthropic/_base_client.py:2876
↓ 2 callers
Function
_merge_mappings
Merge two mappings of the same type, removing any values that are instances of `Omit`. In cases with duplicate keys the second mapping takes prec
src/anthropic/_base_client.py:2864
↓ 2 callers
Function
_merged_body
The non-streaming retry body: the fallback entry applied as a patch against the original params, plus the refusal's credit token when it minted on
src/anthropic/lib/middleware/_fallbacks.py:1583
↓ 2 callers
Function
_middleware_entry_mode
The raw-response mode the original caller entered the middleware chain with.
src/anthropic/_base_client.py:2973
↓ 2 callers
Function
_middleware_name
(middleware: object)
src/anthropic/_middleware.py:66
← previous
next →
901–1,000 of 14,068, ranked by callers