Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`AnthropicBedrock` 2.x sends `anthropic_version: 2026-10-21`, which Bedrock rejects for Claude Sonnet 4.5, Opus 4.5 and Opus 4.6

Open Beginner friendly
#2,031 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@charan-rathore is already working on this.

Since Oct 23, 2026.

  • #2032 by @charan-rathore — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
aws, python
Domain
backend, cloud

Research direction

Start in src/anthropic/lib/bedrock/_client.py and inspect how the Bedrock client sets the default anthropic_version; the issue includes the changed lines and a reproduction. Add or locate tests for the Bedrock request body, including older and newer Claude models. Done means requests use a version accepted by the affected models while preserving the documented override behavior.

Written by the indexing model from the issue text.

Description

Since 2.0.0, the Bedrock client's default request body anthropic_version is the Messages API version 2026-10-21 instead of bedrock-2023-05-31:

# src/anthropic/lib/bedrock/_client.py
-DEFAULT_VERSION = "bedrock-2023-05-31"
-        options.json_data.setdefault("anthropic_version", DEFAULT_VERSION)
+        options.json_data.setdefault("anthropic_version", ANTHROPIC_API_VERSION)

Bedrock rejects that value for some Claude models that are still available there:

anthropic.BadRequestError: Error code: 400 - {'message': 'Invalid API version: 2026-10-21'}

The same code works on 1.17.0. Newer models (Claude Opus 4.8, Sonnet 4.6, Haiku 4.5 and the Claude 5 family) accept the new value, so only the older models break. The 2.0.0 changelog doesn't mention any change to Bedrock (or Vertex) request versioning.

Reproduction
# pip install "anthropic[bedrock]==2.1.0"
# auth: AWS_BEARER_TOKEN_BEDROCK or the usual AWS credential chain
import anthropic

client = anthropic.AnthropicBedrock(aws_region="us-east-1")

for model in [
    "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
    "global.anthropic.claude-opus-4-5-20251101-v1:0",
    "us.anthropic.claude-opus-4-6-v1",
    "us.anthropic.claude-opus-5-5",  # works, for comparison
]:
    for extra_body in (None, {"anthropic_version": "bedrock-2023-05-31"}):
        try:
            client.messages.create(
                model=model,
                max_tokens=16,
                messages=[{"role": "user", "content": "Say ok"}],
                extra_body=extra_body,
            )
            result = "ok"
        except anthropic.APIStatusError as e:
            result = f"{e.status_code} {e.message}"
        print(f"{model:48} override={extra_body is not None!s:5} -> {result}")

Output with anthropic==2.1.0:

us.anthropic.claude-sonnet-4-5-20250929-v1:0     override=False -> 400 Error code: 400 - {'message': 'Invalid API version: 2026-10-21'}
us.anthropic.claude-sonnet-4-5-20250929-v1:0     override=True  -> ok
global.anthropic.claude-opus-4-5-20251101-v1:0   override=False -> 400 Error code: 400 - {'message': 'Invalid API version: 2026-10-21'}
global.anthropic.claude-opus-4-5-20251101-v1:0   override=True  -> ok
us.anthropic.claude-opus-4-6-v1                  override=False -> 400 Error code: 400 - {'message': 'Invalid API version: 2026-10-21'}
us.anthropic.claude-opus-4-6-v1                  override=True  -> ok
us.anthropic.claude-opus-5-5                     override=False -> ok
us.anthropic.claude-opus-5-5                     override=True  -> ok

With anthropic==1.17.0, all eight requests succeed, since the default there is bedrock-2023-05-31.

Expected behavior

The Bedrock client sends a version that every Claude model on Bedrock accepts, as 1.x did, or it picks the version per model.

Workaround

Pass extra_body={"anthropic_version": "bedrock-2023-05-31"}. The client only sets the field when the body doesn't already have one.

Possibly related

2.0.0 made the same change to AnthropicVertex (vertex-2023-10-16 → 2026-10-21). I couldn't verify whether Vertex rejects it for any models.

Environment
  • anthropic 2.1.0 (2.0.0 has the same default); works on 1.17.0
  • Python 3.13
  • Bedrock region us-east-1
Dominant language
Python
Stars
4k
Forks
892
Avg merge
6m
Merged PRs (30d)
4

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anthropics/anthropic-sdk-python

All issues in anthropics/anthropic-sdk-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.