Calling Claude Through Amazon Bedrock, Google Cloud and Microsoft Foundry: Same Call, Different Door
One support app makes one Messages call, through six routes to Claude. The request and the Message stay the same; the client class, the sign-in, the model id and the feature list change, and a small table tells you what to check before you pick a platform.
What you will learn
- Name the six ways to reach Claude and which client class each one uses
- Keep the Messages call identical while the client, sign-in and model id change per platform
- Check a job's needs, such as Message Batches or the Files API, against a platform's feature list before choosing it
Before you start
- The Claude Messages API: your first call
- Basic Python
A support app called SupportDesk makes one Messages call. While you develop, it calls the Claude API with an API key. In production, the company wants the same call to run on Amazon Bedrock, inside its own AWS account. The Claude docs name three reasons a team picks a cloud platform: existing cloud commitments, compliance requirements, and one cloud bill.
So what changes when the call goes through someone else's door? Four things: the client class, the sign-in, the model id and the features. The request itself does not.
One order, three counters
Think of ordering the same coffee at three different counters.
- Each counter has its own card reader. Some take a key, others take your cloud credentials. That's the sign-in.
- Each counter has its own menu names: the same drink, a different name. That's the model id.
- Each counter has a smaller menu, and some items simply aren't served. That's the feature list.
The order slip is the same at every counter. The counter around it is not.
Six ways to reach Claude
| Route | Operated by | Python client class |
|---|---|---|
| Claude API | Anthropic | Anthropic |
| Claude Platform on AWS | Anthropic | AnthropicAWS (client in beta) |
| Claude Models on Google Cloud, Anthropic managed | Anthropic | AnthropicGoogleCloud |
| Microsoft Foundry (on Azure) | Anthropic | AnthropicFoundry |
| Amazon Bedrock | AWS, a partner | AnthropicBedrockMantle |
| Claude Models on Google Cloud, Google managed (Vertex AI) | Google, a partner | AnthropicVertex |
Each route has its own client class, and feature availability varies by platform. Use the platform's own client, not the first-party client with a changed base URL: the platform client knows how to sign in and where to put the model id.
clients.py: one client per platform, one call
In the lecture's project, make_client returns one client class for each platform, and ask makes the same call on all of them:
"""One client class per platform. The Messages call stays the same."""
from anthropic import Anthropic, AnthropicAWS, AnthropicFoundry
from anthropic import AnthropicBedrockMantle, AnthropicGoogleCloud
from anthropic import AnthropicVertex
import stand_in
PROJECT = "support-demo"
WORKSPACE = "wrkspc_demo"
MODEL_IDS = {"claude_api": "claude-sonnet-5-5",
"bedrock": "anthropic.claude-sonnet-5-5",
"gcp_google": "claude-sonnet-5-5",
"gcp_anthropic": "claude-sonnet-5-5",
"foundry": "claude-sonnet-5-5",
"claude_on_aws": "claude-sonnet-5-5"}
def make_client(platform):
# test credentials + mock transport; real code omits them
opts = stand_in.options(platform)
if platform == "claude_api":
return Anthropic(**opts)
if platform == "bedrock":
return AnthropicBedrockMantle(aws_region="us-east-1", **opts)
if platform == "gcp_google":
return AnthropicVertex(project_id=PROJECT, region="global", **opts)
if platform == "gcp_anthropic":
return AnthropicGoogleCloud(project=PROJECT,
workspace_id=WORKSPACE, **opts)
if platform == "foundry":
return AnthropicFoundry(resource=PROJECT, **opts)
if platform == "claude_on_aws":
return AnthropicAWS(aws_region="us-west-2",
workspace_id=WORKSPACE, **opts)
raise ValueError(f"unknown platform: {platform}")
def ask(platform, question):
"""the same Messages call on every platform"""
client = make_client(platform)
return client.messages.create(
model=MODEL_IDS[platform],
max_tokens=64,
messages=[{"role": "user", "content": question}],
)
- Bedrock uses
AnthropicBedrockMantlewith an AWS region, and its model id carries ananthropic.prefix. - Google managed (Vertex AI) uses
AnthropicVertexwith a project and a region. - Foundry uses
AnthropicFoundrywith your resource name. - The call at the bottom is the same
messages.create, with the same fields, everywhere.
About stand_in.options: the project runs with no key and no cloud account. A stand-in passes test credentials and an httpx mock transport to the real SDK client classes, records where each request went, and answers with one scripted "test model reply". Real code leaves those options out, and each client signs in the way its platform does.
One call, six routes
Here's what run_all.py printed when it asked "Where is my refund?" through every client:
client and host
claude_api Anthropic api.anthropic.com
bedrock AnthropicBedrockMantle bedrock-mantle.us-east-1.api.aws
gcp_google AnthropicVertex aiplatform.googleapis.com
gcp_anthropic AnthropicGoogleCloud claude.googleapis.com
foundry AnthropicFoundry support-demo.services.ai.azure.com
claude_on_aws AnthropicAWS aws-external-anthropic.us-west-2.api.aws
model id sent
claude_api claude-sonnet-5-5 in the body
bedrock anthropic.claude-sonnet-5-5 in the body
gcp_google claude-sonnet-5-5 in the URL
gcp_anthropic claude-sonnet-5-5 in the body
foundry claude-sonnet-5-5 in the body
claude_on_aws claude-sonnet-5-5 in the body
one reply shape: yes
Six clients, six different hosts. On Bedrock the model id carries the prefix. On the Google managed route the model goes into the URL, not the body. And every client hands back the same Message object: the last line checks that the stop reason, the first block type and the usage looked identical across all six. The hosts are where the real SDK classes sent the request; the reply is the stand-in's.
What changes, one by one
| What | How it differs |
|---|---|
| Client class | One per platform, as in the table above |
| Sign-in | The Bedrock and Claude Platform on AWS clients sign with your AWS credentials. The Google client uses Application Default Credentials. The Foundry client takes an API key or an Entra ID token. |
| Model id | Bedrock adds the anthropic. prefix. On the Google managed route the model sits in the URL. On Foundry it's your deployment name. |
| Features | Each platform's docs page lists what is not supported. Read it for the platform you use. |
features.py: check the job before you pick the platform
Before you choose a platform, compare what the job needs with what each platform's page lists. The project keeps two small tables taken from the "features not supported" sections of those pages:
"""Check what a job needs against what each platform lists, before choosing one."""
NOT_THERE = {
"bedrock": {"message_batches", "files_api", "server_side_fallback"},
"gcp_google": {"message_batches", "files_api", "server_side_fallback"},
"foundry": {"message_batches", "server_side_fallback"},
}
LISTED = {
"bedrock": {"prompt_caching", "structured_outputs"},
"gcp_google": {"prompt_caching", "structured_outputs"},
"claude_on_aws": {"message_batches", "files_api", "prompt_caching"},
}
def check(platform, needs):
if platform == "claude_api":
return "available"
missing = sorted(set(needs) & NOT_THERE.get(platform, set()))
if missing:
return "missing: " + ", ".join(missing)
if set(needs) <= LISTED.get(platform, set()):
return "listed as supported"
return "check the platform page"
The order of the checks matters: the "not there" list first, then the "listed" list, and anything else gets "check the platform page". The code never guesses.
Two jobs, run through pick_platform.py:
job: nightly refund audit needs message_batches
claude_api available
bedrock missing: message_batches
gcp_google missing: message_batches
gcp_anthropic check the platform page
foundry missing: message_batches
claude_on_aws listed as supported
job: cheaper repeat questions needs prompt_caching, structured_outputs
claude_api available
bedrock listed as supported
gcp_google listed as supported
gcp_anthropic check the platform page
foundry check the platform page
claude_on_aws check the platform page
The nightly audit needs Message Batches, and three platform pages list them as missing. Claude Platform on AWS lists them as supported. The same pages that list server-side fallback as missing point to a client-side fallback pattern instead (see fallback models for an LLM app). And where the table has no answer, the output says so.
Feature lists change. Treat this table as a habit, not a fact sheet: check the current page of the platform you use before you commit to it.
Common mistakes
- Changing only the base URL. Each platform signs in its own way, so the first-party client pointed at another host won't authenticate. Use the platform's own client class.
- One model string everywhere. The id differs: a prefix on Bedrock, a deployment name on Foundry.
- Assuming every feature is there. Batches, the Files API and server-side fallback are missing on some platforms. Check the job's needs first.
- Putting keys in code. The test credentials in the project exist only for the stand-in. Real clients read your cloud credentials.
Quick recap
| Check | Question to ask |
|---|---|
| Client class | Which class does this platform use? |
| Sign-in | Which identity does it accept? |
| Model id | How does this platform name the model? |
| Features | Does its page list everything this job needs? |
Same Messages call. Then check the platform.
Try it yourself
Add a third job to JOBS in pick_platform.py that needs files_api. Before you run it, predict the line for each of the six platforms. Which ones say "missing", and which say "check the platform page"?
Related course on Udemy
Claude Certified Developer - Foundations (CCDV-F) Exam Prep
Build and ship Claude apps: the API, agents, tools and MCP, prompts, evals, security and model choice.View on Udemy ↗: Claude Certified Developer - Foundations (CCDV-F) Exam Prep (paid course, opens in a new tab)Related posts
The Claude Messages API: Your First Call, Field by Field
One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.
Claude Tool Use: How tool_use and tool_result Work in the Messages API
Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.
Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.
Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.