Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
12,522 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
12,522
◇
Types & classes
4,093
↳
Endpoints
47
Function
test_another_writers_edit_after_a_lost_upload_response_still_wins
( tmp_path: Path, caplog: pytest.LogCaptureFixture )
tests/lib/tools/memory_sync/test_lost_response.py:222
Method
test_anthropic_project_env_beats_google_cloud_project
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_google_cloud.py:338
Method
test_any_other_failed_hop_is_not_resent
( self, respx_mock: MockRouter, entry: BetaFallbackParam, speed: Literal["stan
tests/lib/test_refusal_fallback.py:870
Method
test_any_other_failed_hop_is_not_resent
( self, respx_mock: MockRouter, entry: BetaFallbackParam, speed: Literal["stan
tests/lib/test_refusal_fallback.py:967
Method
test_any_other_failed_hop_is_not_resent
( self, respx_mock: MockRouter, entry: BetaFallbackParam, speed: Literal["stan
tests/lib/test_refusal_fallback_streaming.py:1680
Method
test_any_other_failed_hop_is_not_resent
( self, respx_mock: MockRouter, entry: BetaFallbackParam, speed: Literal["stan
tests/lib/test_refusal_fallback_streaming.py:1931
Function
test_anyof_schema
()
tests/lib/_parse/test_transform.py:45
Function
test_api_exclude
(send: Send)
tests/test_prepare.py:458
Method
test_api_key_and_auth_token_rejected
(self)
tests/lib/test_google_cloud.py:349
Method
test_api_key_and_auth_token_rejected
(self)
tests/lib/test_google_cloud.py:1311
Method
test_api_key_arg_beats_explicit_creds
api_key constructor arg takes highest precedence.
tests/lib/test_aws_auth.py:133
Method
test_api_key_arg_returns_false
(self)
tests/lib/test_aws_auth.py:41
Function
test_api_key_arg_takes_precedence_over_env
(monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws.py:329
Method
test_api_key_arg_uses_api_key_mode
(self)
tests/lib/test_bedrock_mantle.py:219
Function
test_api_key_auth
(respx_mock: MockRouter)
tests/lib/test_bedrock.py:407
Function
test_api_key_auth_async
(respx_mock: MockRouter)
tests/lib/test_bedrock.py:425
Function
test_api_key_env_mutual_exclusion
(monkeypatch: t.Any)
tests/lib/test_bedrock.py:472
Function
test_api_key_from_env
(monkeypatch: t.Any)
tests/lib/test_bedrock.py:441
Method
test_api_key_header_override_does_not_send_two_credentials
(self, client_cls: ClientClass)
tests/test_header_case_sensitivity.py:100
Function
test_api_key_mode_no_region_no_base_url_errors
API key mode without region or base_url should error.
tests/lib/test_aws.py:389
Function
test_api_key_mode_no_region_with_base_url
API key mode should work without a region if base_url is provided.
tests/lib/test_aws.py:382
Method
test_api_key_mode_returns_bearer_auth_header
(self)
tests/lib/test_bedrock_mantle.py:236
Method
test_api_key_mode_sends_foundry_key_as_x_api_key
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_azure.py:256
Method
test_api_key_moved_to_x_api_key_by_hand
(self, client_cls: ClientClass)
tests/test_header_case_sensitivity.py:268
Function
test_api_key_mutual_exclusion
()
tests/lib/test_bedrock.py:454
Function
test_api_key_mutual_exclusion_async
()
tests/lib/test_bedrock.py:463
Method
test_api_key_precedence_preserved
( self, respx_mock: MockRouter, clean_env: pytest.MonkeyPatch, tmp_path: pathlib.Path )
tests/lib/test_credentials.py:2867
Function
test_api_key_request
(respx_mock: MockRouter)
tests/lib/test_aws.py:419
Function
test_api_key_request_async
(respx_mock: MockRouter)
tests/lib/test_aws.py:441
Method
test_api_key_returns_none
(self, clean_env: pytest.MonkeyPatch)
tests/lib/test_credentials.py:2146
Method
test_appends_the_fallback_credit_beta_to_both_the_original_and_hop_requests
( self, respx_mock: MockRouter )
tests/lib/test_refusal_fallback_streaming.py:349
Method
test_appends_to_a_helper_tag_already_on_the_request
(self, respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:710
Method
test_appends_to_betas_already_on_the_request
(self, respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:682
Function
test_application_inference_profile
(respx_mock: MockRouter)
tests/lib/test_bedrock.py:221
Method
test_applications_conversation_id_comes_before_the_primary_thread
( self, spans: Spans, respx_mock: MockRouter )
tests/lib/tools/test_open_telemetry.py:2511
Function
test_archive_top_dir_detection
()
tests/lib/tools/test_skills.py:144
Method
test_arg_takes_precedence_over_env
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws_auth.py:237
Method
test_arg_takes_precedence_over_env
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws_auth.py:302
Method
test_arg_takes_precedence_over_env
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws_auth.py:327
Method
test_arg_takes_precedence_over_env
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws_auth.py:394
Function
test_array_brackets
(method: str)
tests/test_qs.py:76
Function
test_array_comma
(method: str)
tests/test_qs.py:57
Function
test_array_format_controls_file_field_names
( array_format: ArrayFormat, expected_top_level: list[tuple[str, FileTypes]], expected_nested: lis
tests/test_extract_files.py:82
Function
test_array_repeat
()
tests/test_qs.py:68
Function
test_array_schema
()
tests/lib/_parse/test_transform.py:184
Function
test_ask_call_of_terminated_thread_does_not_block_idle_stop
The API takes no result for an ask-gated call once its thread has terminated, so the runner does not hold it and makes its idle stop.
tests/lib/tools/test_session_runner.py:1526
Function
test_ask_tool_blocks_without_confirmation
An `agent.tool_use` whose `evaluated_permission` is `ask` (an `always_ask` tool) must NOT execute on arrival — it is held until the matching `
tests/lib/tools/test_session_runner.py:662
Function
test_ask_tool_denied_never_executes
A `deny` confirmation resolves the held call without executing it: nothing runs, nothing is posted (the denial itself resolves the call server
tests/lib/tools/test_session_runner.py:716
Function
test_ask_tool_executes_after_allow_confirmation
An `allow` confirmation releases the held call: the tool runs, the result is posted, and the yielded call records `confirmation="allow"`.
tests/lib/tools/test_session_runner.py:684
Function
test_asks_confirm_before_a_call_runs_while_the_reply_streams
(setup: SetupFactory, family: str)
tests/lib/tools/test_runner_eager_toolsets.py:123
Method
test_assigned_base_url_takes_every_route
(self, respx_mock: MockRouter)
tests/lib/test_google_cloud.py:1611
Method
test_assistant_message
(self)
tests/lib/tools/test_mcp_tool.py:187
Method
test_async_401_invalidates_and_retries_once
Async client 401 behavior mirrors sync: invalidate the cache and retry the current request once with a freshly minted token.
tests/lib/test_credentials.py:3460
Method
test_async_aclose_via_context_manager
`async with AsyncAnthropic(...)` exits cleanly and cascades close.
tests/lib/test_credentials.py:3494
Method
test_async_api_key_mode_sends_foundry_key_as_x_api_key
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_azure.py:284
Method
test_async_authorized_user_refresh_flow
Async client calling a CredentialsFile(authorized_user) provider: the blocking refresh_token POST runs on the worker thread via asyncify.
tests/lib/test_credentials.py:3414
Function
test_async_aws_client_in_api_key_mode_sends_only_the_bearer
()
tests/lib/test_scoped_client.py:252
Method
test_async_azure_ad_token_provider
Test async client with async Azure AD token provider.
tests/lib/test_azure.py:138
Method
test_async_base_url_from_region
(self)
tests/lib/test_bedrock_mantle.py:353
Method
test_async_batch_create_starts_its_span_with_the_request_count
( self, beta: bool, respx_mock: MockRouter )
tests/test_open_telemetry.py:2695
Method
test_async_batch_results_span_covers_the_download
(self, spans: Spans, respx_mock: MockRouter)
tests/test_open_telemetry.py:1140
Method
test_async_batches_keep_the_header
( self, send: AsyncSendBatch, async_client: AsyncAnthropicBedrockMantle, respx_mock: MockRouter )
tests/lib/test_bedrock_mantle.py:797
Method
test_async_batches_send_no_header_when_no_profile_is_set
( self, send: AsyncSendBatch, async_client: AsyncAnthropicBedrockMantle, respx_mock: MockRouter )
tests/lib/test_bedrock_mantle.py:823
Method
test_async_batches_send_the_client_default_header_unless_the_request_names_one
( self, send: AsyncSendBatch, user_profile_id: str | Omit, sent: str,
tests/lib/test_bedrock_mantle.py:861
Method
test_async_bedrock_middleware_sees_canonical_request
(self, respx_mock: MockRouter)
tests/test_middleware.py:1974
Function
test_async_call_from_inside_a_member_is_a_contract_error_and_cancellation_releases_the_lock
()
tests/lib/tools/toolsets/test_pipeline.py:1114
Method
test_async_call_reads_the_platform_off_the_event_loop
( self, spans: Spans, respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch )
tests/test_open_telemetry.py:2404
Method
test_async_callable_object_handles_requests
(self, respx_mock: MockRouter)
tests/test_middleware.py:534
Method
test_async_caller_api_key_header_wins_case_insensitively
(self)
tests/lib/test_azure.py:335
Method
test_async_caller_authorization_header_wins_case_insensitively
(self)
tests/lib/test_azure.py:321
Function
test_async_calls_run_one_at_a_time
()
tests/lib/tools/toolsets/test_pipeline.py:1331
Function
test_async_calls_run_one_at_a_time_and_close_waits
()
tests/lib/tools/toolsets/test_computer_pipeline.py:515
Method
test_async_client_accepts_async_callable_object
(self)
tests/test_middleware.py:528
Method
test_async_client_has_same_restrictions
(self)
tests/lib/test_bedrock_mantle.py:338
Function
test_async_client_path_clears_api_key_and_sets_bearer
The same invariants hold for `AsyncAnthropic` — verifies the `ClientT` typevar threads sync/async correctly through `copy()`.
tests/lib/test_scoped_client.py:77
Method
test_async_client_rejects_non_callable
(self)
tests/test_middleware.py:578
Method
test_async_client_rejects_sync_callable_object
(self)
tests/test_middleware.py:549
Method
test_async_client_rejects_sync_handle_async_override
(self)
tests/test_middleware.py:586
Method
test_async_client_workspace_id_is_kept
( self, async_client: AsyncAnthropicBedrockMantle, respx_mock: MockRouter )
tests/lib/test_bedrock_mantle.py:895
Function
test_async_close_and_async_with_mark_the_toolset_closed_async
()
tests/lib/tools/toolsets/test_runner.py:728
Method
test_async_close_cascades_to_credentials
AsyncAnthropic.close() cascades to self.credentials.close().
tests/lib/test_credentials.py:3477
Function
test_async_close_from_inside_a_member_does_not_wait_for_itself
()
tests/lib/tools/toolsets/test_pipeline.py:1266
Function
test_async_close_waits_for_accepted_calls_to_settle
()
tests/lib/tools/toolsets/test_pipeline.py:1226
Method
test_async_concurrent_requests_single_flight
Concurrent async requests sharing a TokenCache cause at most one provider call — the single-flight guarantee holds across async workers.
tests/lib/test_credentials.py:3441
Function
test_async_confirm_may_be_a_coroutine_or_a_plain_function
()
tests/lib/tools/toolsets/test_computer_pipeline.py:395
Function
test_async_confirm_may_be_a_coroutine_or_a_plain_function
()
tests/lib/tools/toolsets/test_confirm.py:250
Method
test_async_context_manager_requires_input_schema
(self)
tests/lib/tools/test_functions.py:551
Method
test_async_context_manager_tool_lazy_enter_and_cleanup
(self)
tests/lib/tools/test_functions.py:496
Method
test_async_copy_parity
(self)
tests/lib/test_google_cloud.py:1045
Method
test_async_copy_with_different_base_url_exchanges_per_client
Async mirror of the sync test: `copy(base_url=...)` leaves the parent exchanging at, and presenting tokens from, its own host.
tests/lib/test_credentials.py:3385
Method
test_async_copy_with_same_base_url_shares_token_exchange
(self, respx_mock: MockRouter)
tests/lib/test_credentials.py:3400
Function
test_async_copy_x_stainless_helper_header_appends
()
tests/lib/test_bedrock.py:732
Method
test_async_copy_x_stainless_helper_header_appends
(self)
tests/lib/test_bedrock_mantle.py:413
Function
test_async_count_tokens_accepts_a_type
(async_client: AsyncAnthropic, respx_mock: MockRouter)
tests/lib/test_output_format_helpers.py:92
Function
test_async_count_tokens_rejects_a_schema_dict
(async_client: AsyncAnthropic)
tests/lib/test_output_format_helpers.py:104
Method
test_async_create
( self, message: dict[str, Any], content_mode: str, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:7783
Method
test_async_disabled_spans_leave_the_body_of_the_response_alone
( self, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:2461
Method
test_async_dropped_stream
(self, spans: Spans, caplog: pytest.LogCaptureFixture, reads: int)
tests/test_open_telemetry.py:1661
Method
test_async_each_kind_of_page
(self, call: ResourceList, spans: Spans, respx_mock: MockRouter)
tests/test_open_telemetry.py:7700
Method
test_async_each_resource
(self, call: ResourceCall, spans: Spans, respx_mock: MockRouter)
tests/test_open_telemetry.py:7659
← previous
next →
5,401–5,500 of 12,522, ranked by callers