Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
9,455 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
9,455
◇
Types & classes
3,151
↳
Endpoints
25
↓ 2,291 callers
Function
assert_matches_type
( type_: Any, value: object, *, path: list[str], allow_none: bool = False, )
tests/utils.py:48
↓ 1,512 callers
Method
get
(self, key: str, default: object = None)
tests/lib/tools/toolsets/test_interface.py:163
↓ 1,256 callers
Method
parse
(self, query: str)
src/anthropic/_qs.py:33
↓ 703 callers
Method
list
(self, _session_id: str, *, limit: int = 1000, extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:216
↓ 660 callers
Function
make_request_options
Create a dict of type RequestOptions without keys of NotGiven values.
src/anthropic/_base_client.py:2348
↓ 508 callers
Method
create
(self, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:685
↓ 505 callers
Method
retrieve
(self, version: str, *, skill_id: str)
tests/lib/tools/test_skills.py:392
↓ 465 callers
Method
post
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1498
↓ 427 callers
Function
path_template
Interpolate {name} placeholders in `template` from keyword arguments. Args: template: The template string containing {name} placeholders.
src/anthropic/_utils/_path.py:78
↓ 402 callers
Function
is_given
(obj: _T | NotGiven | Omit)
src/anthropic/_utils/_utils.py:156
↓ 389 callers
Function
strip_not_given
(obj: None)
src/anthropic/_utils/_utils.py:306
↓ 324 callers
Method
update
(self, memory_id: str, *, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:688
↓ 227 callers
Method
delete
(self, memory_id: str, *, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:691
↓ 180 callers
Method
archive
Hide a `completed`, `failed`, or `canceled` dream from the default list of dreams. Archiving a `pending` or `running` dream
src/anthropic/resources/beta/dreams.py:311
↓ 149 callers
Method
get
The file's bytes; `None` when absent.
src/anthropic/lib/tools/_file_store.py:151
↓ 117 callers
Method
call
(self, context: BetaToolsetCallContext, name: str, input: object)
tests/lib/tools/toolsets/test_runnable.py:90
↓ 111 callers
Method
remove
Delete a file or subtree; absent — and the banned store root — do nothing.
src/anthropic/lib/tools/_file_store.py:232
↓ 92 callers
Method
add
Add two numbers.
tests/lib/tools/test_functions.py:470
↓ 89 callers
Function
async_to_raw_response_wrapper
Higher order function that takes one of our bound API methods and wraps it to support returning the raw `APIResponse` object directly.
src/anthropic/_response.py:802
↓ 89 callers
Function
async_to_streamed_response_wrapper
Higher order function that takes one of our bound API methods and wraps it to support streaming and returning the raw `APIResponse` object directl
src/anthropic/_response.py:714
↓ 89 callers
Function
to_raw_response_wrapper
Higher order function that takes one of our bound API methods and wraps it to support returning the raw `APIResponse` object directly.
src/anthropic/_response.py:785
↓ 89 callers
Function
to_streamed_response_wrapper
Higher order function that takes one of our bound API methods and wraps it to support streaming and returning the raw `APIResponse` object directl
src/anthropic/_response.py:695
↓ 81 callers
Method
construct
( # pyright: ignore[reportIncompatibleMethodOverride] __cls: Type[ModelT], _fields_set: set[s
src/anthropic/_models.py:228
↓ 81 callers
Function
run_sync
Drive one reconcile pass without clock bookkeeping. The public cadence path (`sync_if_due` plus the clock) is exercised by the worker tests;
tests/lib/tools/memory_sync/conftest.py:33
↓ 78 callers
Method
stream
(self, _session_id: str, *, extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:206
↓ 73 callers
Function
_write_profile
Test helper: lay out `configs/<profile>.json` and optionally `credentials/<profile>.json` under `config_dir`. Accepts either the new nested `
tests/lib/test_credentials.py:136
↓ 69 callers
Method
_build_request
( self, options: FinalRequestOptions, *, retries_taken: int = 0, )
src/anthropic/_base_client.py:524
↓ 63 callers
Method
get_final_message
Waits until the stream has been read to completion and returns the accumulated `Message` object.
src/anthropic/lib/streaming/_messages.py:94
↓ 63 callers
Method
tool_runner
( self, *, max_tokens: int, messages: Iterable[BetaMessageParam], mode
src/anthropic/resources/beta/messages/messages.py:1379
↓ 62 callers
Method
call
(self, input: dict[str, Any])
tests/lib/tools/test_session_runner.py:251
↓ 62 callers
Method
until_done
Blocks until the stream has been consumed
src/anthropic/lib/streaming/_messages.py:123
↓ 59 callers
Method
set
Set a spend limit. Upsert keyed on (scope, period): setting a limit that already exists overwrites it in place. A Claude Ent
src/anthropic/resources/beta/organization/spend_limits/spend_limits.py:232
↓ 57 callers
Function
parse_datetime
(value: Union[datetime, StrBytesIntFloat])
src/anthropic/_utils/_compat.py:40
↓ 56 callers
Function
message_body
(*, model: str = "claude-opus-4-6")
tests/test_middleware.py:62
↓ 54 callers
Method
json
(self)
src/anthropic/_request.py:58
↓ 54 callers
Function
setup
(sync: bool, client: Anthropic, async_client: AsyncAnthropic, respx_mock: MockRouter)
tests/lib/tools/test_runner_eager_tools.py:1159
↓ 51 callers
Function
reply
A reply that asks for tool results.
tests/lib/tools/test_runner_eager_tools.py:840
↓ 50 callers
Method
close
(self)
tests/lib/tools/toolsets/_stubs.py:62
↓ 50 callers
Function
get_response
Convert a fixture file into a stream of bytes for testing.
tests/lib/streaming/helpers.py:18
↓ 49 callers
Function
_end_turn_response
()
tests/lib/tools/test_runners.py:1019
↓ 48 callers
Function
replies_of
What the runner yields, whether it is the sync or the async one.
tests/lib/tools/test_runner_eager_tools.py:1163
↓ 46 callers
Function
call
The model calls `lookup(key=key)` with the id `toolu_<key>`. `json_input` is the input as sent, which may be cut off.
tests/lib/tools/test_runner_eager_tools.py:801
↓ 44 callers
Function
sse_response
(body: str)
tests/lib/test_refusal_fallback_streaming.py:93
↓ 43 callers
Function
done
The reply that ends the conversation.
tests/lib/tools/test_runner_eager_tools.py:850
↓ 43 callers
Method
download
Download File Args: file_id: ID of the File. workspace_id: Optional header to select the Workspace for this req
src/anthropic/resources/files.py:170
↓ 43 callers
Function
make_sync_client
(**kwargs: Any)
tests/test_middleware.py:54
↓ 42 callers
Function
_run_with_fakes
( *, events: FakeAsyncEvents, tools: list[Any], max_idle: float | None = None, environment
tests/lib/tools/test_session_runner.py:284
↓ 41 callers
Function
_terminated
()
tests/lib/tools/test_session_runner.py:106
↓ 41 callers
Function
_tool_use
( id: str, name: str, input: dict[str, Any], *, evaluated_permission: str | None = None, )
tests/lib/tools/test_session_runner.py:75
↓ 40 callers
Method
run
Run Deployment Now Args: deployment_id: Unique identifier of the deployment to run. betas: Optional header to s
src/anthropic/resources/beta/deployments.py:557
↓ 38 callers
Function
texts
(content: Any)
tests/lib/tools/toolsets/_fakes.py:315
↓ 37 callers
Method
cancel
Stop a `pending` or `running` dream. The response shows `status` as `canceled`, unless the dream reached `completed` or `fai
src/anthropic/resources/beta/dreams.py:381
↓ 37 callers
Method
get
(self, __key: str)
src/anthropic/_types.py:199
↓ 36 callers
Function
collect
(stream: Stream[BetaRawMessageStreamEvent])
tests/lib/test_refusal_fallback_streaming.py:153
↓ 36 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/_client.py:458
↓ 36 callers
Function
message
(model: str, **overrides: Any)
tests/lib/test_refusal_fallback.py:40
↓ 35 callers
Function
create_stream
( client: Anthropic, *, betas: List[AnthropicBetaParam] | Omit = omit )
tests/lib/test_refusal_fallback_streaming.py:198
↓ 35 callers
Function
events_of
What the stream yields, whether it is the sync or the async one.
tests/lib/tools/test_runner_eager_tools.py:1173
↓ 35 callers
Method
get_token
Return a valid bearer token, refreshing if necessary.
src/anthropic/lib/credentials/_cache.py:179
↓ 35 callers
Function
make_sync_client
(**kwargs: Any)
tests/lib/test_refusal_fallback_streaming.py:73
↓ 35 callers
Method
to_dict
(self)
tests/lib/tools/toolsets/_stubs.py:52
↓ 34 callers
Function
_sent_request_bodies
(respx_mock: MockRouter)
tests/lib/tools/test_runners.py:2457
↓ 34 callers
Function
make_sync_client
(**kwargs: Any)
tests/lib/test_refusal_fallback.py:32
↓ 32 callers
Function
beta_read_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:668
↓ 32 callers
Method
decode
(self, line: str)
src/anthropic/_streaming.py:450
↓ 31 callers
Function
first_reply
The timeline up to the second request, which is everything about the first reply.
tests/lib/tools/test_runner_eager_tools.py:868
↓ 31 callers
Function
make_async_client
(**kwargs: Any)
tests/test_middleware.py:58
↓ 30 callers
Function
merge_headers
Compose header layers into a single layer: a plain mapping, as `default_headers=` and `extra_headers=` accept, that still carries an `Omit` for ev
src/anthropic/_base_client.py:2589
↓ 30 callers
Function
refusal
(model: str, fallback_credit_token: str | None = None)
tests/lib/test_refusal_fallback.py:57
↓ 29 callers
Function
_tool_use_response
(tool_name: str, tool_use_id: str, input: Union[Dict[str, Any], None] = None)
tests/lib/tools/test_runners.py:996
↓ 29 callers
Method
compact_before_next_turn
Compact the conversation before the model's next turn. This only schedules the compaction. Once the current turn has finished, including
src/anthropic/lib/tools/_beta_runner.py:237
↓ 29 callers
Function
create_message
( client: Anthropic, *, betas: List[AnthropicBetaParam] | Omit = omit, fallbacks: List[BetaFal
tests/lib/test_refusal_fallback.py:74
↓ 29 callers
Function
send
(client: Anthropic | AsyncAnthropic)
tests/test_prepare.py:117
↓ 29 callers
Function
state_block
(content: Any)
tests/lib/tools/toolsets/_fakes.py:319
↓ 29 callers
Method
wait
(self, context: BetaToolsetCallContext, input: BetaBrowserWaitInput)
tests/lib/tools/toolsets/_fakes.py:196
↓ 28 callers
Function
provider
()
tests/lib/test_google_cloud.py:248
↓ 28 callers
Method
sleep
(self, _seconds: float)
tests/lib/environments/test_poller_method.py:336
↓ 27 callers
Function
construct_type
Loose coercion to the expected type with construction of nested values. If the given value does not match the expected type then it is returned a
src/anthropic/_models.py:585
↓ 27 callers
Function
parse_date
(value: Union[date, StrBytesIntFloat])
src/anthropic/_utils/_compat.py:36
↓ 27 callers
Method
resolve
Stage one of a call: the registry row for `name`, or the refusal the model reads (an unknown name, a member this application disabled, or one
src/anthropic/lib/tools/_toolsets/_base.py:213
↓ 27 callers
Method
tool_result
Run one member `tool_use` and build its `tool_result` block, for callers driving `messages.create` themselves. Follows the tool runne
src/anthropic/lib/tools/_toolsets/_runnable.py:139
↓ 26 callers
Method
count_tokens
Count the number of tokens in a Message. The Token Count API can be used to count the number of tokens in a Message, includi
src/anthropic/resources/messages/messages.py:1291
↓ 26 callers
Function
deepcopy_with_paths
Copy only the containers along the given paths. Used to guard against mutation by extract_files without copying the entire structure. Only di
src/anthropic/_files.py:144
↓ 26 callers
Method
open
Resolve `root`; creates nothing — only `create_root` makes the folder.
src/anthropic/lib/tools/_file_store.py:100
↓ 25 callers
Function
extract_files
Recursively extract files from the given dictionary based on specified paths. A path may look like this ['foo', 'files', '<array>', 'data'].
src/anthropic/_utils/_utils.py:37
↓ 25 callers
Method
root
(self)
src/anthropic/lib/tools/_file_store.py:119
↓ 25 callers
Function
to_async_iter
Convert a synchronous iterator to an asynchronous one.
tests/lib/streaming/helpers.py:25
↓ 25 callers
Method
to_dict
(self)
tests/lib/test_stainless_helpers.py:24
↓ 24 callers
Method
put
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1578
↓ 24 callers
Function
transform_schema
Transforms a JSON schema to ensure it conforms to the API's expectations. Args: json_schema (Dict[str, Any]): The original JSON sche
src/anthropic/lib/_parse/_transform.py:54
↓ 22 callers
Function
default_credentials
Resolve a `CredentialResult` from the environment per the credential-resolution spec. First match wins. Implements steps 2-5 of the spec prec
src/anthropic/lib/credentials/_chain.py:76
↓ 22 callers
Function
make_client
(client_cls: ClientClass, **kwargs: Any)
tests/test_header_case_sensitivity.py:29
↓ 22 callers
Function
updated
(path: str, content: str, *, was: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:77
↓ 21 callers
Function
beta_tool
(func: FunctionT)
src/anthropic/lib/tools/_beta_functions.py:350
↓ 21 callers
Function
build
(client: Anthropic | AsyncAnthropic, **options: Any)
tests/test_header_case_sensitivity.py:34
↓ 21 callers
Method
copy
( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] — narrows `credentials` to No
src/anthropic/lib/aws/_client.py:172
↓ 21 callers
Function
make
The model holding `data`, made in each of the ways a model gets made.
tests/test_prepare.py:419
↓ 21 callers
Function
request_bodies
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:99
↓ 21 callers
Method
start
(self)
examples/memory/basic.py:50
↓ 21 callers
Method
to_dict
(self)
tests/lib/tools/test_session_runner.py:264
next →
1–100 of 9,455, ranked by callers