Calling Opus 4.7 from LangChain via Bedrock's Anthropic-compatible endpoint (Mantle)
This page has been translated by machine translation. View original
The official AWS blog for Claude Opus 4.7, released today, introduced a client called AnthropicBedrockMantle.
from anthropic import AnthropicBedrockMantle
client = AnthropicBedrockMantle(aws_region=REGION)
The Mantle documentation only describes OpenAI-compatible APIs (Chat Completions / Responses). I was curious where this client actually connects, so I investigated.
Identifying the endpoint from debug logs
I enabled debug logging and called AnthropicBedrockMantle.
pip install "anthropic[bedrock]"
import logging
logging.basicConfig(level=logging.DEBUG)
from anthropic import AnthropicBedrockMantle
client = AnthropicBedrockMantle(aws_region="ap-northeast-1")
response = client.messages.create(
model="anthropic.claude-opus-4-7",
max_tokens=256,
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.content[0].text)
It worked without any problems, and the following lines were output in the log.
DEBUG:anthropic._base_client:Sending HTTP Request: POST https://bedrock-mantle.ap-northeast-1.api.aws/anthropic/v1/messages
INFO:httpx:HTTP Request: POST https://bedrock-mantle.ap-northeast-1.api.aws/anthropic/v1/messages "HTTP/1.1 200 OK"
The bedrock-mantle endpoint had a path /anthropic/v1/messages. This is an Anthropic Messages API-compatible endpoint, separate from the OpenAI-compatible paths described in the Mantle documentation (/v1/chat/completions, /v1/responses).
Support status for each path
These are the results of trying each path with Opus 4.7.
| API path | Format | Opus 4.7 |
|---|---|---|
/v1/models |
OpenAI-compatible | ✅ Listed |
/v1/chat/completions |
OpenAI-compatible | ❌ "This model is not supported" |
/v1/responses |
OpenAI-compatible | ❌ "This model is not supported" |
/anthropic/v1/messages |
Anthropic-compatible | ✅ Responds normally |
At present, only Opus 4.7 supports this Anthropic-compatible path; it was not available for Opus 4.6 or Sonnet 4.6.
Calling it directly with curl
Now that I knew the endpoint, I also verified it with curl. The SigV4 signing service name is bedrock-mantle.
curl -s -X POST \
"https://bedrock-mantle.ap-northeast-1.api.aws/anthropic/v1/messages" \
--aws-sigv4 "aws:amz:ap-northeast-1:bedrock-mantle" \
--user "${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}" \
-H "x-amz-security-token: ${AWS_SESSION_TOKEN}" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "anthropic.claude-opus-4-7",
"max_tokens": 64,
"messages": [{"role": "user", "content": "Hello!"}]
}'
{
"model": "claude-opus-4-7",
"content": [
{
"type": "text",
"text": "Hello! How can I help you today?"
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 24,
"output_tokens": 15,
"service_tier": "standard"
}
}
Note that the anthropic-version header is required.
Calling with the plain Anthropic SDK + a short-term Bedrock API key
Now for the main topic. If the endpoint is compatible with the Anthropic Messages API, the plain Anthropic client should work simply by swapping base_url, so I tried it.
For authentication, I used a short-term Bedrock API key. It can be issued with aws-bedrock-token-generator and is valid for up to 12 hours. There is no need to create an IAM user; it can be generated from your current credentials.
pip install aws-bedrock-token-generator
from aws_bedrock_token_generator import provide_token
import anthropic
token = provide_token(region='ap-northeast-1')
client = anthropic.Anthropic(
base_url="https://bedrock-mantle.ap-northeast-1.api.aws/anthropic",
api_key=token
)
response = client.messages.create(
model="anthropic.claude-opus-4-7",
max_tokens=64,
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.content[0].text)
print(f"model: {response.model}")
print(f"usage: input={response.usage.input_tokens}, output={response.usage.output_tokens}")
Hello! How can I help you today?
model: claude-opus-4-7
usage: input=24, output=15
It worked. With the plain Anthropic SDK, I was able to call Opus 4.7 via Bedrock with the same feel as the Anthropic API. The key points are the following three:
- Set
base_urltohttps://bedrock-mantle.{region}.api.aws/anthropic - Pass the short-term Bedrock API key as
api_key - Beyond that, the same code as for the regular Anthropic API works as is
This may make it possible to leverage existing code and tooling written for the Anthropic SDK within Bedrock's secure environment.
Verified with LangChain as well
ChatAnthropic from langchain-anthropic also worked just by swapping anthropic_api_url.
pip install langchain-anthropic
from aws_bedrock_token_generator import provide_token
from langchain_anthropic import ChatAnthropic
token = provide_token(region='ap-northeast-1')
llm = ChatAnthropic(
model="anthropic.claude-opus-4-7",
anthropic_api_key=token,
anthropic_api_url="https://bedrock-mantle.ap-northeast-1.api.aws/anthropic",
max_tokens=64,
)
response = llm.invoke("Amazon Bedrockとは?1行で。")
print(response.content)
Amazon Bedrockとは、AWSが提供する、複数の基盤モデル(FM)をAPI経由で利用できるフルマネージド型の生成AIサービスです。
I confirmed that for any ecosystem based on the Anthropic SDK, models via Bedrock can be used just by swapping the endpoint.
Summary
Bedrock Mantle has gained an Anthropic Messages API-compatible endpoint (/anthropic/v1/messages).
Until now Mantle only offered OpenAI-compatible APIs (Chat Completions / Responses), but a strategic partnership between OpenAI and Amazon was announced in February 2026, and this seems to be an expansion in the direction of bundling each vendor's native APIs as part of that trend.
There are currently the following limitations.
- Only Opus 4.7 is supported (Opus 4.6 / Sonnet 4.6 are not supported)
- The
/anthropic/v1/messagespath is not yet described in the official documentation
It is too early for production use at this point, but being able to call models via Bedrock seamlessly even from workloads that use the Anthropic SDK is very appealing. I look forward to future developments.
