Anthropic SDK for Python 1.3

Last reviewed Sep 12, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. Python 3155 lines · 3.8K tokens
  2. Anthropic SDK for Python 1.3131 lines · 3.7K tokens
Total286 lines · 7.5K tokens

CWE Coverage

  • 20
  • 23
  • 36
  • 59
  • 78
  • 79
  • 89
  • 95
  • 117
  • 208
  • 209
  • 214
  • 250
  • 295
  • 319
  • 328
  • 338
  • 347
  • 367
  • 379
  • 409
  • 416
  • 426
  • 427
  • 459
  • 470
  • 488
  • 502
  • 532
  • 611
  • 639
  • 674
  • 732
  • 770
  • 772
  • 776
  • 798
  • 807
  • 829
  • 862
  • 916
  • 918
  • 922
  • 1104
  • 1333
  • 1395
  • 1426
  • 1427

Prompt Preview

Apply the Python 3 baseline first, then these rules for applications built on the anthropic package 1.3 release line. The 1.x line requires Python 3.10 or later and sends requests through httpx2 rather than httpx. Confirm each rule against the exact 1.3 release you deploy, and treat every model output — text, tool arguments, and generated files — as untrusted data produced from a context an attacker may have influenced.

Version scope and upgrade from 0.x

  • Pin anthropic to a 1.3 release and run it on Python 3.10 or later, which the 1.x line requires.
  • Import transports, timeouts, and custom clients from httpx2; passing a client from the separate httpx package to http_client raises TypeError.
  • Remove temperature, top_p, and top_k from Messages calls, because 1.x deleted those parameters instead of ignoring them.
  • Replace the removed schema-dict output_format argument with output_config={"format": {...}} when moving structured-output code onto 1.x; typed helpers still accept output_format=MyModel.
  • Delete every client.completions.create() path, since 1.x removed the legacy Text Completions API entirely.
  • Await .parse(), .read(), .text(), and .json() on an AsyncAPIResponse, and use .text() for text and .read() for bytes rather than reading them as properties.
  • Send header values as str with one casing per name, because 1.x matches header names case-insensitively and no longer accepts bytes values.
  • Pass an explicit region to AnthropicBedrock and AsyncAnthropicBedrock, which raise ValueError at construction when