anthropic 0.68.1__py3-none-any.whl → 0.69.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. anthropic/_version.py +1 -1
  2. anthropic/lib/streaming/_beta_messages.py +1 -0
  3. anthropic/lib/tools/__init__.py +7 -0
  4. anthropic/lib/tools/_beta_builtin_memory_tool.py +245 -0
  5. anthropic/lib/tools/_beta_functions.py +30 -0
  6. anthropic/lib/tools/_beta_runner.py +18 -6
  7. anthropic/resources/beta/files.py +10 -10
  8. anthropic/resources/beta/messages/batches.py +12 -12
  9. anthropic/resources/beta/messages/messages.py +59 -15
  10. anthropic/resources/beta/models.py +4 -4
  11. anthropic/resources/completions.py +2 -2
  12. anthropic/resources/models.py +4 -4
  13. anthropic/types/beta/__init__.py +35 -0
  14. anthropic/types/beta/beta_clear_tool_uses_20250919_edit_param.py +38 -0
  15. anthropic/types/beta/beta_clear_tool_uses_20250919_edit_response.py +18 -0
  16. anthropic/types/beta/beta_context_management_config_param.py +15 -0
  17. anthropic/types/beta/beta_context_management_response.py +13 -0
  18. anthropic/types/beta/beta_count_tokens_context_management_response.py +10 -0
  19. anthropic/types/beta/beta_input_tokens_clear_at_least_param.py +13 -0
  20. anthropic/types/beta/beta_input_tokens_trigger_param.py +13 -0
  21. anthropic/types/beta/beta_memory_tool_20250818_command.py +26 -0
  22. anthropic/types/beta/beta_memory_tool_20250818_create_command.py +18 -0
  23. anthropic/types/beta/beta_memory_tool_20250818_delete_command.py +15 -0
  24. anthropic/types/beta/beta_memory_tool_20250818_insert_command.py +21 -0
  25. anthropic/types/beta/beta_memory_tool_20250818_param.py +23 -0
  26. anthropic/types/beta/beta_memory_tool_20250818_rename_command.py +18 -0
  27. anthropic/types/beta/beta_memory_tool_20250818_str_replace_command.py +21 -0
  28. anthropic/types/beta/beta_memory_tool_20250818_view_command.py +19 -0
  29. anthropic/types/beta/beta_message.py +4 -0
  30. anthropic/types/beta/beta_message_tokens_count.py +6 -0
  31. anthropic/types/beta/beta_raw_message_delta_event.py +4 -0
  32. anthropic/types/beta/beta_stop_reason.py +3 -1
  33. anthropic/types/beta/beta_tool_union_param.py +2 -0
  34. anthropic/types/beta/beta_tool_uses_keep_param.py +13 -0
  35. anthropic/types/beta/beta_tool_uses_trigger_param.py +13 -0
  36. anthropic/types/beta/message_count_tokens_params.py +7 -1
  37. anthropic/types/beta/message_create_params.py +4 -0
  38. anthropic/types/model.py +2 -0
  39. anthropic/types/model_param.py +2 -0
  40. anthropic/types/stop_reason.py +3 -1
  41. {anthropic-0.68.1.dist-info → anthropic-0.69.0.dist-info}/METADATA +19 -19
  42. {anthropic-0.68.1.dist-info → anthropic-0.69.0.dist-info}/RECORD +44 -26
  43. {anthropic-0.68.1.dist-info → anthropic-0.69.0.dist-info}/WHEEL +0 -0
  44. {anthropic-0.68.1.dist-info → anthropic-0.69.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,10 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from ..._models import BaseModel
4
+
5
+ __all__ = ["BetaCountTokensContextManagementResponse"]
6
+
7
+
8
+ class BetaCountTokensContextManagementResponse(BaseModel):
9
+ original_input_tokens: int
10
+ """The original token count before context management was applied"""
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal, Required, TypedDict
6
+
7
+ __all__ = ["BetaInputTokensClearAtLeastParam"]
8
+
9
+
10
+ class BetaInputTokensClearAtLeastParam(TypedDict, total=False):
11
+ type: Required[Literal["input_tokens"]]
12
+
13
+ value: Required[int]
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal, Required, TypedDict
6
+
7
+ __all__ = ["BetaInputTokensTriggerParam"]
8
+
9
+
10
+ class BetaInputTokensTriggerParam(TypedDict, total=False):
11
+ type: Required[Literal["input_tokens"]]
12
+
13
+ value: Required[int]
@@ -0,0 +1,26 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Union
4
+ from typing_extensions import Annotated, TypeAlias
5
+
6
+ from ..._utils import PropertyInfo
7
+ from .beta_memory_tool_20250818_view_command import BetaMemoryTool20250818ViewCommand
8
+ from .beta_memory_tool_20250818_create_command import BetaMemoryTool20250818CreateCommand
9
+ from .beta_memory_tool_20250818_delete_command import BetaMemoryTool20250818DeleteCommand
10
+ from .beta_memory_tool_20250818_insert_command import BetaMemoryTool20250818InsertCommand
11
+ from .beta_memory_tool_20250818_rename_command import BetaMemoryTool20250818RenameCommand
12
+ from .beta_memory_tool_20250818_str_replace_command import BetaMemoryTool20250818StrReplaceCommand
13
+
14
+ __all__ = ["BetaMemoryTool20250818Command"]
15
+
16
+ BetaMemoryTool20250818Command: TypeAlias = Annotated[
17
+ Union[
18
+ BetaMemoryTool20250818ViewCommand,
19
+ BetaMemoryTool20250818CreateCommand,
20
+ BetaMemoryTool20250818StrReplaceCommand,
21
+ BetaMemoryTool20250818InsertCommand,
22
+ BetaMemoryTool20250818DeleteCommand,
23
+ BetaMemoryTool20250818RenameCommand,
24
+ ],
25
+ PropertyInfo(discriminator="command"),
26
+ ]
@@ -0,0 +1,18 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["BetaMemoryTool20250818CreateCommand"]
8
+
9
+
10
+ class BetaMemoryTool20250818CreateCommand(BaseModel):
11
+ command: Literal["create"]
12
+ """Command type identifier"""
13
+
14
+ file_text: str
15
+ """Content to write to the file"""
16
+
17
+ path: str
18
+ """Path where the file should be created"""
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["BetaMemoryTool20250818DeleteCommand"]
8
+
9
+
10
+ class BetaMemoryTool20250818DeleteCommand(BaseModel):
11
+ command: Literal["delete"]
12
+ """Command type identifier"""
13
+
14
+ path: str
15
+ """Path to the file or directory to delete"""
@@ -0,0 +1,21 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["BetaMemoryTool20250818InsertCommand"]
8
+
9
+
10
+ class BetaMemoryTool20250818InsertCommand(BaseModel):
11
+ command: Literal["insert"]
12
+ """Command type identifier"""
13
+
14
+ insert_line: int
15
+ """Line number where text should be inserted"""
16
+
17
+ insert_text: str
18
+ """Text to insert at the specified line"""
19
+
20
+ path: str
21
+ """Path to the file where text should be inserted"""
@@ -0,0 +1,23 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
9
+
10
+ __all__ = ["BetaMemoryTool20250818Param"]
11
+
12
+
13
+ class BetaMemoryTool20250818Param(TypedDict, total=False):
14
+ name: Required[Literal["memory"]]
15
+ """Name of the tool.
16
+
17
+ This is how the tool will be called by the model and in `tool_use` blocks.
18
+ """
19
+
20
+ type: Required[Literal["memory_20250818"]]
21
+
22
+ cache_control: Optional[BetaCacheControlEphemeralParam]
23
+ """Create a cache control breakpoint at this content block."""
@@ -0,0 +1,18 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["BetaMemoryTool20250818RenameCommand"]
8
+
9
+
10
+ class BetaMemoryTool20250818RenameCommand(BaseModel):
11
+ command: Literal["rename"]
12
+ """Command type identifier"""
13
+
14
+ new_path: str
15
+ """New path for the file or directory"""
16
+
17
+ old_path: str
18
+ """Current path of the file or directory"""
@@ -0,0 +1,21 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["BetaMemoryTool20250818StrReplaceCommand"]
8
+
9
+
10
+ class BetaMemoryTool20250818StrReplaceCommand(BaseModel):
11
+ command: Literal["str_replace"]
12
+ """Command type identifier"""
13
+
14
+ new_str: str
15
+ """Text to replace with"""
16
+
17
+ old_str: str
18
+ """Text to search for and replace"""
19
+
20
+ path: str
21
+ """Path to the file where text should be replaced"""
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from ..._models import BaseModel
7
+
8
+ __all__ = ["BetaMemoryTool20250818ViewCommand"]
9
+
10
+
11
+ class BetaMemoryTool20250818ViewCommand(BaseModel):
12
+ command: Literal["view"]
13
+ """Command type identifier"""
14
+
15
+ path: str
16
+ """Path to directory or file to view"""
17
+
18
+ view_range: Optional[List[int]] = None
19
+ """Optional line range for viewing specific lines"""
@@ -9,6 +9,7 @@ from .beta_usage import BetaUsage
9
9
  from .beta_container import BetaContainer
10
10
  from .beta_stop_reason import BetaStopReason
11
11
  from .beta_content_block import BetaContentBlock, BetaContentBlock as BetaContentBlock
12
+ from .beta_context_management_response import BetaContextManagementResponse
12
13
 
13
14
  __all__ = ["BetaMessage"]
14
15
 
@@ -61,6 +62,9 @@ class BetaMessage(BaseModel):
61
62
  ```
62
63
  """
63
64
 
65
+ context_management: Optional[BetaContextManagementResponse] = None
66
+ """Information about context management operations applied during the request."""
67
+
64
68
  model: Model
65
69
  """
66
70
  The model that will complete your prompt.\n\nSee
@@ -1,11 +1,17 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from typing import Optional
4
+
3
5
  from ..._models import BaseModel
6
+ from .beta_count_tokens_context_management_response import BetaCountTokensContextManagementResponse
4
7
 
5
8
  __all__ = ["BetaMessageTokensCount"]
6
9
 
7
10
 
8
11
  class BetaMessageTokensCount(BaseModel):
12
+ context_management: Optional[BetaCountTokensContextManagementResponse] = None
13
+ """Information about context management applied to the message."""
14
+
9
15
  input_tokens: int
10
16
  """
11
17
  The total number of tokens across the provided list of messages, system prompt,
@@ -7,6 +7,7 @@ from ..._models import BaseModel
7
7
  from .beta_container import BetaContainer
8
8
  from .beta_stop_reason import BetaStopReason
9
9
  from .beta_message_delta_usage import BetaMessageDeltaUsage
10
+ from .beta_context_management_response import BetaContextManagementResponse
10
11
 
11
12
  __all__ = ["BetaRawMessageDeltaEvent", "Delta"]
12
13
 
@@ -24,6 +25,9 @@ class Delta(BaseModel):
24
25
 
25
26
 
26
27
  class BetaRawMessageDeltaEvent(BaseModel):
28
+ context_management: Optional[BetaContextManagementResponse] = None
29
+ """Information about context management operations applied during the request."""
30
+
27
31
  delta: Delta
28
32
 
29
33
  type: Literal["message_delta"]
@@ -4,4 +4,6 @@ from typing_extensions import Literal, TypeAlias
4
4
 
5
5
  __all__ = ["BetaStopReason"]
6
6
 
7
- BetaStopReason: TypeAlias = Literal["end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal"]
7
+ BetaStopReason: TypeAlias = Literal[
8
+ "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal", "model_context_window_exceeded"
9
+ ]
@@ -8,6 +8,7 @@ from typing_extensions import TypeAlias
8
8
  from .beta_tool_param import BetaToolParam
9
9
  from .beta_tool_bash_20241022_param import BetaToolBash20241022Param
10
10
  from .beta_tool_bash_20250124_param import BetaToolBash20250124Param
11
+ from .beta_memory_tool_20250818_param import BetaMemoryTool20250818Param
11
12
  from .beta_web_fetch_tool_20250910_param import BetaWebFetchTool20250910Param
12
13
  from .beta_web_search_tool_20250305_param import BetaWebSearchTool20250305Param
13
14
  from .beta_tool_text_editor_20241022_param import BetaToolTextEditor20241022Param
@@ -28,6 +29,7 @@ BetaToolUnionParam: TypeAlias = Union[
28
29
  BetaCodeExecutionTool20250522Param,
29
30
  BetaCodeExecutionTool20250825Param,
30
31
  BetaToolComputerUse20241022Param,
32
+ BetaMemoryTool20250818Param,
31
33
  BetaToolComputerUse20250124Param,
32
34
  BetaToolTextEditor20241022Param,
33
35
  BetaToolTextEditor20250124Param,
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal, Required, TypedDict
6
+
7
+ __all__ = ["BetaToolUsesKeepParam"]
8
+
9
+
10
+ class BetaToolUsesKeepParam(TypedDict, total=False):
11
+ type: Required[Literal["tool_uses"]]
12
+
13
+ value: Required[int]
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal, Required, TypedDict
6
+
7
+ __all__ = ["BetaToolUsesTriggerParam"]
8
+
9
+
10
+ class BetaToolUsesTriggerParam(TypedDict, total=False):
11
+ type: Required[Literal["tool_uses"]]
12
+
13
+ value: Required[int]
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import List, Union, Iterable
5
+ from typing import List, Union, Iterable, Optional
6
6
  from typing_extensions import Required, Annotated, TypeAlias, TypedDict
7
7
 
8
8
  from ..._utils import PropertyInfo
@@ -15,8 +15,10 @@ from .beta_tool_choice_param import BetaToolChoiceParam
15
15
  from .beta_thinking_config_param import BetaThinkingConfigParam
16
16
  from .beta_tool_bash_20241022_param import BetaToolBash20241022Param
17
17
  from .beta_tool_bash_20250124_param import BetaToolBash20250124Param
18
+ from .beta_memory_tool_20250818_param import BetaMemoryTool20250818Param
18
19
  from .beta_web_fetch_tool_20250910_param import BetaWebFetchTool20250910Param
19
20
  from .beta_web_search_tool_20250305_param import BetaWebSearchTool20250305Param
21
+ from .beta_context_management_config_param import BetaContextManagementConfigParam
20
22
  from .beta_tool_text_editor_20241022_param import BetaToolTextEditor20241022Param
21
23
  from .beta_tool_text_editor_20250124_param import BetaToolTextEditor20250124Param
22
24
  from .beta_tool_text_editor_20250429_param import BetaToolTextEditor20250429Param
@@ -106,6 +108,9 @@ class MessageCountTokensParams(TypedDict, total=False):
106
108
  details and options.
107
109
  """
108
110
 
111
+ context_management: Optional[BetaContextManagementConfigParam]
112
+ """Configuration for context management operations."""
113
+
109
114
  mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam]
110
115
  """MCP servers to be utilized in this request"""
111
116
 
@@ -225,6 +230,7 @@ Tool: TypeAlias = Union[
225
230
  BetaCodeExecutionTool20250522Param,
226
231
  BetaCodeExecutionTool20250825Param,
227
232
  BetaToolComputerUse20241022Param,
233
+ BetaMemoryTool20250818Param,
228
234
  BetaToolComputerUse20250124Param,
229
235
  BetaToolTextEditor20241022Param,
230
236
  BetaToolTextEditor20250124Param,
@@ -15,6 +15,7 @@ from .beta_text_block_param import BetaTextBlockParam
15
15
  from .beta_tool_union_param import BetaToolUnionParam
16
16
  from .beta_tool_choice_param import BetaToolChoiceParam
17
17
  from .beta_thinking_config_param import BetaThinkingConfigParam
18
+ from .beta_context_management_config_param import BetaContextManagementConfigParam
18
19
  from .beta_request_mcp_server_url_definition_param import BetaRequestMCPServerURLDefinitionParam
19
20
 
20
21
  __all__ = ["MessageCreateParamsBase", "MessageCreateParamsNonStreaming", "MessageCreateParamsStreaming"]
@@ -109,6 +110,9 @@ class MessageCreateParamsBase(TypedDict, total=False):
109
110
  container: Optional[str]
110
111
  """Container identifier for reuse across requests."""
111
112
 
113
+ context_management: Optional[BetaContextManagementConfigParam]
114
+ """Configuration for context management operations."""
115
+
112
116
  mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam]
113
117
  """MCP servers to be utilized in this request"""
114
118
 
anthropic/types/model.py CHANGED
@@ -14,6 +14,8 @@ Model: TypeAlias = Union[
14
14
  "claude-sonnet-4-20250514",
15
15
  "claude-sonnet-4-0",
16
16
  "claude-4-sonnet-20250514",
17
+ "claude-sonnet-4-5",
18
+ "claude-sonnet-4-5-20250929",
17
19
  "claude-3-5-sonnet-latest",
18
20
  "claude-3-5-sonnet-20241022",
19
21
  "claude-3-5-sonnet-20240620",
@@ -16,6 +16,8 @@ ModelParam: TypeAlias = Union[
16
16
  "claude-sonnet-4-20250514",
17
17
  "claude-sonnet-4-0",
18
18
  "claude-4-sonnet-20250514",
19
+ "claude-sonnet-4-5",
20
+ "claude-sonnet-4-5-20250929",
19
21
  "claude-3-5-sonnet-latest",
20
22
  "claude-3-5-sonnet-20241022",
21
23
  "claude-3-5-sonnet-20240620",
@@ -4,4 +4,6 @@ from typing_extensions import Literal, TypeAlias
4
4
 
5
5
  __all__ = ["StopReason"]
6
6
 
7
- StopReason: TypeAlias = Literal["end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal"]
7
+ StopReason: TypeAlias = Literal[
8
+ "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal", "model_context_window_exceeded"
9
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: anthropic
3
- Version: 0.68.1
3
+ Version: 0.69.0
4
4
  Summary: The official Python library for the anthropic API
5
5
  Project-URL: Homepage, https://github.com/anthropics/anthropic-sdk-python
6
6
  Project-URL: Repository, https://github.com/anthropics/anthropic-sdk-python
@@ -80,7 +80,7 @@ message = client.messages.create(
80
80
  "content": "Hello, Claude",
81
81
  }
82
82
  ],
83
- model="claude-sonnet-4-20250514",
83
+ model="claude-sonnet-4-5-20250929",
84
84
  )
85
85
  print(message.content)
86
86
  ```
@@ -113,7 +113,7 @@ async def main() -> None:
113
113
  "content": "Hello, Claude",
114
114
  }
115
115
  ],
116
- model="claude-sonnet-4-20250514",
116
+ model="claude-sonnet-4-5-20250929",
117
117
  )
118
118
  print(message.content)
119
119
 
@@ -155,7 +155,7 @@ async def main() -> None:
155
155
  "content": "Hello, Claude",
156
156
  }
157
157
  ],
158
- model="claude-sonnet-4-20250514",
158
+ model="claude-sonnet-4-5-20250929",
159
159
  )
160
160
  print(message.content)
161
161
 
@@ -180,7 +180,7 @@ stream = client.messages.create(
180
180
  "content": "Hello, Claude",
181
181
  }
182
182
  ],
183
- model="claude-sonnet-4-20250514",
183
+ model="claude-sonnet-4-5-20250929",
184
184
  stream=True,
185
185
  )
186
186
  for event in stream:
@@ -202,7 +202,7 @@ stream = await client.messages.create(
202
202
  "content": "Hello, Claude",
203
203
  }
204
204
  ],
205
- model="claude-sonnet-4-20250514",
205
+ model="claude-sonnet-4-5-20250929",
206
206
  stream=True,
207
207
  )
208
208
  async for event in stream:
@@ -244,7 +244,7 @@ def get_weather(location: str) -> str:
244
244
 
245
245
  runner = client.beta.messages.tool_runner(
246
246
  max_tokens=1024,
247
- model="claude-sonnet-4-20250514",
247
+ model="claude-sonnet-4-5-20250929",
248
248
  tools=[get_weather],
249
249
  messages=[
250
250
  {"role": "user", "content": "What is the weather in SF?"},
@@ -277,7 +277,7 @@ async def main() -> None:
277
277
  "content": "Say hello there!",
278
278
  }
279
279
  ],
280
- model="claude-sonnet-4-20250514",
280
+ model="claude-sonnet-4-5-20250929",
281
281
  ) as stream:
282
282
  async for text in stream.text_stream:
283
283
  print(text, end="", flush=True)
@@ -299,7 +299,7 @@ To get the token count for a message without creating it you can use the `client
299
299
 
300
300
  ```py
301
301
  count = client.messages.count_tokens(
302
- model="claude-sonnet-4-20250514",
302
+ model="claude-sonnet-4-5-20250929",
303
303
  messages=[
304
304
  {"role": "user", "content": "Hello, world"}
305
305
  ]
@@ -329,7 +329,7 @@ await client.messages.batches.create(
329
329
  {
330
330
  "custom_id": "my-first-request",
331
331
  "params": {
332
- "model": "claude-sonnet-4-20250514",
332
+ "model": "claude-sonnet-4-5-20250929",
333
333
  "max_tokens": 1024,
334
334
  "messages": [{"role": "user", "content": "Hello, world"}],
335
335
  },
@@ -337,7 +337,7 @@ await client.messages.batches.create(
337
337
  {
338
338
  "custom_id": "my-second-request",
339
339
  "params": {
340
- "model": "claude-sonnet-4-20250514",
340
+ "model": "claude-sonnet-4-5-20250929",
341
341
  "max_tokens": 1024,
342
342
  "messages": [{"role": "user", "content": "Hi again, friend"}],
343
343
  },
@@ -380,7 +380,7 @@ message = client.messages.create(
380
380
  "content": "Hello!",
381
381
  }
382
382
  ],
383
- model="anthropic.claude-sonnet-4-20250514-v1:0",
383
+ model="anthropic.claude-sonnet-4-5-20250929-v1:0",
384
384
  )
385
385
  print(message)
386
386
  ```
@@ -522,7 +522,7 @@ message = client.messages.create(
522
522
  "role": "user",
523
523
  }
524
524
  ],
525
- model="claude-sonnet-4-20250514",
525
+ model="claude-sonnet-4-5-20250929",
526
526
  metadata={},
527
527
  )
528
528
  print(message.metadata)
@@ -569,7 +569,7 @@ try:
569
569
  "content": "Hello, Claude",
570
570
  }
571
571
  ],
572
- model="claude-sonnet-4-20250514",
572
+ model="claude-sonnet-4-5-20250929",
573
573
  )
574
574
  except anthropic.APIConnectionError as e:
575
575
  print("The server could not be reached")
@@ -610,7 +610,7 @@ message = client.messages.create(
610
610
  "content": "Hello, Claude",
611
611
  }
612
612
  ],
613
- model="claude-sonnet-4-20250514",
613
+ model="claude-sonnet-4-5-20250929",
614
614
  )
615
615
  print(message._request_id) # req_018EeWyXxfu5pfWkrYcMdjWG
616
616
  ```
@@ -645,7 +645,7 @@ client.with_options(max_retries=5).messages.create(
645
645
  "content": "Hello, Claude",
646
646
  }
647
647
  ],
648
- model="claude-sonnet-4-20250514",
648
+ model="claude-sonnet-4-5-20250929",
649
649
  )
650
650
  ```
651
651
 
@@ -677,7 +677,7 @@ client.with_options(timeout=5.0).messages.create(
677
677
  "content": "Hello, Claude",
678
678
  }
679
679
  ],
680
- model="claude-sonnet-4-20250514",
680
+ model="claude-sonnet-4-5-20250929",
681
681
  )
682
682
  ```
683
683
 
@@ -760,7 +760,7 @@ response = client.messages.with_raw_response.create(
760
760
  "role": "user",
761
761
  "content": "Hello, Claude",
762
762
  }],
763
- model="claude-sonnet-4-20250514",
763
+ model="claude-sonnet-4-5-20250929",
764
764
  )
765
765
  print(response.headers.get('X-My-Header'))
766
766
 
@@ -794,7 +794,7 @@ with client.messages.with_streaming_response.create(
794
794
  "content": "Hello, Claude",
795
795
  }
796
796
  ],
797
- model="claude-sonnet-4-20250514",
797
+ model="claude-sonnet-4-5-20250929",
798
798
  ) as response:
799
799
  print(response.headers.get("X-My-Header"))
800
800