Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
12,274 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
12,274
◇
Types & classes
3,937
↳
Endpoints
46
↓ 2,801 callers
Function
assert_matches_type
( type_: Any, value: object, *, path: list[str], allow_none: bool = False, )
tests/utils.py:62
↓ 1,957 callers
Method
get
(self, key: str, default: object = None)
tests/lib/tools/toolsets/test_interface.py:163
↓ 1,551 callers
Method
parse
(self, query: str)
src/anthropic/_qs.py:33
↓ 942 callers
Method
list
(self, _session_id: str, *, limit: int = 1000, extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:1713
↓ 864 callers
Method
post
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1628
↓ 797 callers
Function
make_request_options
Create a dict of type RequestOptions without keys of NotGiven values.
src/anthropic/_base_client.py:2533
↓ 749 callers
Method
create
(self, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:685
↓ 626 callers
Method
retrieve
(self, version: str, *, skill_id: str)
tests/lib/tools/test_skills.py:422
↓ 514 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
↓ 470 callers
Function
is_given
(obj: _T | NotGiven | Omit)
src/anthropic/_utils/_utils.py:156
↓ 469 callers
Function
strip_not_given
(obj: None)
src/anthropic/_utils/_utils.py:306
↓ 426 callers
Method
update
(self, memory_id: str, *, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:688
↓ 390 callers
Method
append
Stage messages for the next turn, skipping the reply just recorded and deferring while a turn is in flight.
src/anthropic/lib/threads/_thread_state.py:107
↓ 301 callers
Method
delete
(self, memory_id: str, *, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:691
↓ 280 callers
Method
until_done
Blocks until the stream has been consumed
src/anthropic/lib/streaming/_messages.py:125
↓ 268 callers
Function
queue_responses
Answer the next `len(responses)` Messages API requests with `responses`, in order. An exception is raised in place of a response.
tests/lib/threads/helpers.py:287
↓ 236 callers
Function
message_response
( id: str, text: str = "Hi!", *, tool_use_id: str | None = None, tool_name: str = "get_wea
tests/lib/threads/helpers.py:293
↓ 205 callers
Function
request_bodies
(respx_mock: MockRouter)
tests/lib/threads/helpers.py:935
↓ 199 callers
Function
user
(text: str)
tests/lib/threads/helpers.py:165
↓ 194 callers
Method
stream
(self, _session_id: str, *, extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:219
↓ 191 callers
Function
attributes
(span: ReadableSpan)
tests/test_open_telemetry.py:210
↓ 184 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:325
↓ 180 callers
Method
get
The file's bytes; `None` when absent.
src/anthropic/lib/tools/_file_store.py:151
↓ 180 callers
Method
send
(self, session_id: str, *, events: list[Any], extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:244
↓ 166 callers
Method
one
(self, name: str)
tests/test_open_telemetry.py:154
↓ 152 callers
Method
tool_runner
( self, *, max_tokens: int, messages: Iterable[BetaMessageParam], mode
src/anthropic/resources/beta/messages/messages.py:1681
↓ 143 callers
Method
with_options
The copy that sends a thread's tool results is this client: the fake events record every send.
tests/lib/tools/test_session_runner.py:304
↓ 141 callers
Function
make_thread
A thread on the sync client; `model` and `max_tokens` default to values no test depends on.
tests/lib/threads/helpers.py:75
↓ 134 callers
Function
make_client
(spans: Spans, **options: Any)
tests/test_open_telemetry.py:179
↓ 131 callers
Method
remove
Delete a file or subtree; absent — and the banned store root — do nothing.
src/anthropic/lib/tools/_file_store.py:232
↓ 117 callers
Method
call
(self, context: BetaToolsetCallContext, name: str, input: object)
tests/lib/tools/toolsets/test_runnable.py:90
↓ 115 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:804
↓ 115 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:787
↓ 114 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:716
↓ 114 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:697
↓ 113 callers
Method
add
Add two numbers.
tests/lib/tools/test_functions.py:470
↓ 111 callers
Method
option
(self, **options: Any)
tests/test_open_telemetry.py:159
↓ 90 callers
Function
stream_response
(events: Sequence[dict[str, Any]] | None = None)
tests/test_open_telemetry.py:605
↓ 87 callers
Function
continue_from
(previous_message_id: str)
tests/lib/threads/helpers.py:279
↓ 82 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:143
↓ 81 callers
Method
construct
( # pyright: ignore[reportIncompatibleMethodOverride] __cls: Type[ModelT], _fields_set: set[s
src/anthropic/_models.py:296
↓ 81 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:96
↓ 80 callers
Function
beta_tool
(func: FunctionT)
src/anthropic/lib/tools/_beta_functions.py:350
↓ 80 callers
Method
copy
Create a new client instance re-using the same options given to the current client with optional overriding. A credential passed her
src/anthropic/_client.py:453
↓ 80 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
↓ 79 callers
Function
create
(client: Any, **kwargs: Any)
tests/test_open_telemetry.py:258
↓ 77 callers
Function
parse_datetime
(value: Union[datetime, StrBytesIntFloat])
src/anthropic/_utils/_compat.py:40
↓ 76 callers
Method
call
(self, input: dict[str, Any])
tests/lib/tools/test_session_runner.py:266
↓ 75 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:263
↓ 69 callers
Method
_build_request
( self, options: FinalRequestOptions, *, retries_taken: int = 0, )
src/anthropic/_base_client.py:595
↓ 67 callers
Method
named
(self, name: str)
tests/test_open_telemetry.py:151
↓ 63 callers
Method
json
(self)
src/anthropic/_request.py:58
↓ 63 callers
Method
one
(self, name: str)
tests/lib/tools/test_open_telemetry.py:129
↓ 61 callers
Function
make_async_thread
A thread on the async client; `model` and `max_tokens` default to values no test depends on.
tests/lib/threads/helpers.py:80
↓ 61 callers
Method
set_messages_params
Update the parameters for the next API call. This invalidates any cached tool responses. With `run_tools_eagerly`, a tool call of the
src/anthropic/lib/tools/_beta_runner.py:284
↓ 60 callers
Method
option
(self, **options: Any)
tests/lib/tools/test_open_telemetry.py:134
↓ 58 callers
Function
attributes
(span: ReadableSpan)
tests/lib/tools/test_open_telemetry.py:143
↓ 58 callers
Function
beta_async_tool
(func: AsyncFunctionT)
src/anthropic/lib/tools/_beta_functions.py:480
↓ 58 callers
Method
close
(self)
tests/lib/tools/toolsets/_stubs.py:62
↓ 58 callers
Function
get_response
Convert a fixture file into a stream of bytes for testing.
tests/lib/streaming/helpers.py:18
↓ 58 callers
Function
sse_response
(body: str)
tests/lib/test_refusal_fallback_streaming.py:97
↓ 56 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
↓ 56 callers
Function
message_body
(*, model: str = "claude-opus-4-6")
tests/test_middleware.py:63
↓ 55 callers
Function
make
The model holding `data`, made in each of the ways a model gets made.
tests/test_prepare.py:419
↓ 55 callers
Method
run
Run Deployment Now Args: deployment_id: Unique identifier of the deployment to run. betas: This endpoint is in
src/anthropic/resources/beta/deployments.py:586
↓ 54 callers
Function
setup
(sync: bool, client: Anthropic, async_client: AsyncAnthropic, respx_mock: MockRouter)
tests/lib/tools/test_runner_eager_tools.py:1159
↓ 53 callers
Function
assistant
(text: str = "Hi!")
tests/lib/threads/helpers.py:185
↓ 53 callers
Function
parse_date
(value: Union[date, StrBytesIntFloat])
src/anthropic/_utils/_compat.py:36
↓ 52 callers
Method
get
(self, __key: str)
src/anthropic/_types.py:311
↓ 51 callers
Function
_end_turn_response
()
tests/lib/tools/test_runners.py:993
↓ 51 callers
Function
reply
A reply that asks for tool results.
tests/lib/tools/test_runner_eager_tools.py:840
↓ 50 callers
Function
make_async_client
(spans: Spans, **options: Any)
tests/test_open_telemetry.py:186
↓ 49 callers
Function
_terminated
()
tests/lib/tools/test_session_runner.py:115
↓ 49 callers
Function
message
(model: str, **overrides: Any)
tests/lib/test_refusal_fallback.py:44
↓ 49 callers
Function
request_threads
The `thread` param of each request, or `None` for a request sent without one.
tests/lib/threads/helpers.py:939
↓ 48 callers
Method
decode
(self, line: str)
src/anthropic/_streaming.py:393
↓ 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
↓ 48 callers
Function
tool_use_message
(city: str = "SF")
tests/lib/tools/test_open_telemetry.py:74
↓ 47 callers
Function
roles
(messages: Iterable[BetaMessageParam | dict[str, Any]])
tests/lib/threads/helpers.py:283
↓ 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
↓ 46 callers
Method
to_dict
(self)
tests/lib/tools/test_session_runner.py:279
↓ 46 callers
Method
wait
(self, context: BetaToolsetCallContext, input: BetaBrowserWaitInput)
tests/lib/tools/toolsets/_fakes.py:196
↓ 45 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:360
↓ 45 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:1562
↓ 44 callers
Function
_run_with_fakes
( *, events: FakeAsyncEvents, tools: list[Any], max_idle: float | None = None, environment
tests/lib/tools/test_session_runner.py:309
↓ 44 callers
Function
make_runner
(*, stream: Literal[False] = False, **fields: Any)
tests/lib/threads/helpers.py:90
↓ 44 callers
Method
named
(self, name: str)
tests/lib/tools/test_open_telemetry.py:126
↓ 43 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:400
↓ 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:193
↓ 43 callers
Function
make_sync_client
(**kwargs: Any)
tests/test_middleware.py:55
↓ 42 callers
Function
make_sync_client
(**kwargs: Any)
tests/lib/test_refusal_fallback_streaming.py:77
↓ 42 callers
Method
sleep
(self, _seconds: float)
tests/lib/environments/test_poller_method.py:352
↓ 41 callers
Function
collect
(stream: Stream[BetaRawMessageStreamEvent])
tests/lib/test_refusal_fallback_streaming.py:157
↓ 41 callers
Function
create_stream
( client: Anthropic, *, betas: List[AnthropicBetaParam] | Omit = omit, speed: Literal["standar
tests/lib/test_refusal_fallback_streaming.py:211
↓ 41 callers
Function
make_sync_client
(**kwargs: Any)
tests/lib/test_refusal_fallback.py:36
↓ 41 callers
Function
respond
(request: httpx2.Request)
tests/lib/test_bedrock.py:869
↓ 39 callers
Function
refusal
(model: str, fallback_credit_token: str | None = None)
tests/lib/test_refusal_fallback.py:61
↓ 38 callers
Function
_sent_request_bodies
(respx_mock: MockRouter)
tests/lib/tools/test_runners.py:2466
↓ 38 callers
Function
send
(client: Anthropic | AsyncAnthropic)
tests/test_prepare.py:117
next →
1–100 of 12,274, ranked by callers