Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Claude
  • CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
  • Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
  • One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
  • Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
  • Hooks That Block Destructive Actions: a PreToolUse Gate That Allows, Asks or Denies
  • Choosing a Claude Code Extension: Skill, Hook, Rules File, Subagent, Slash Command or Plugin
  • Rolling Out Claude Code to a Team: Settings Precedence, dontAsk in CI, a Hook for Every-Time Rules and a Plugin for Five Repos
  • A Claude Code Review Bot in CI: Headless -p, JSON Findings, Team Rules in Git and a Person on the Merge
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Configuring MCP Servers in Claude Code: A Command or a URL, Three Scopes, and Three Moves When One Breaks
  • The Claude Messages API: Your First Call, Field by Field
  • Claude Tool Use: How tool_use and tool_result Work in the Messages API
  • Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
  • Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
  • Claude Streaming Events: The Event Order, message_stop, Tool Arguments, Stop Reasons and a WebSocket Relay
  • Images, PDFs and Thinking Blocks in the Claude Messages API: Typed Blocks In, Typed Blocks Out
  • Getting Data Into Claude: PDF Documents, the Files API, Search Results and Citations
  • Opus, Sonnet or Haiku: Pick the Claude Model per Job, and Test the Request When a New Release Arrives
  • Adaptive Thinking and Effort in Claude: Two Dials, Set per Workload, and the Thinking Block You Must Pass Back
  • Claude Cost Tracking From usage: Count Before, Cap During, Read After, Then Find the Line That Drives the Bill
  • Claude Cache Breakpoints: Where to Put cache_control, How to Move It With the Chat, and Why the Reads Stay at Zero
  • Claude Message Batches or Real Time: Choose by Who Is Waiting, Match by custom_id, Resend Only the Failures
  • Calling Claude Through Amazon Bedrock, Google Cloud and Microsoft Foundry: Same Call, Different Door
  • The Life Cycle of a Claude App: Six Phases, a Model That Retires, and a Release Gate for Every Change
  • Pinning Claude Model IDs and Upgrading Safely: One Change at a Time, a Golden-Set Replay and a Staged Rollout
  • Content Boundaries and Schema Design for Claude: Fence the Input in a Tag, Let the Output Say I Don't Know
  • The Agentic Loop and stop_reason: Keep Turning on tool_use, Stop on end_turn, Cap the Turns
  • The Claude Agent SDK: query(), ClaudeAgentOptions and @tool, in Python and TypeScript
  • Fix the Agent: Four Broken Claude Agent SDK Configs, From the Symptom to the One Wrong Line
  • Claude Managed Agents: Cloud Sandbox, Self-Hosted Sandbox or Self-Hosted Service
  • Agent SDK Hooks for Deterministic Actions: PreToolUse, PostToolUse, and Four Hooks That Fail Silently
  • Memory and Context-Window Patterns for Claude Agents: Context Editing, Compaction and the Memory Tool
  • Reading an Agent Trace: Five Signatures, Five Missing Patterns, and How Long a Fact Must Live
  • Tool Descriptions for Claude: How Claude Picks a Tool, and How to Stop It Picking the Wrong One
  • Tool Input Schemas and Error Responses for Claude: Required Fields, Enums, is_error and a Retry Flag
  • Tool Response Shaping and a Lean Tool Set: Give Claude a Sticky Note, Not the Filing Cabinet
  • Fix the Tool Schema: Read the Trace, Fix the Card, Re-Run (Four Real Schema Bugs)
  • Client Tools, Server Tools and Approval Gates: Who Runs the Tool, and Who Says Yes First
  • Built-in Tool, Custom Tool, Skill or MCP Server? Pick the Lightest One That Fits
  • System Prompt or User Turn: Where Each Instruction Goes, and Output Limits Your Code Enforces
  • Refine the Prompt One Line at a Time, Then Clean and Fence the Customer's Text
  • Prompt Revision Driven by Evals: Name the Cause, Change One Thing, Rerun the Whole Suite
  • Long-Running Sessions: Compact, Prune, Isolate or Start Fresh, Decided by Naming the Failure
  • Context Isolation Through Subagents: Read the Logs Elsewhere, Keep One Line
  • Defensive Parsing of Claude Replies: Check the Stop Reason, Read the Block or the Text, Then Validate the Values
  • Full Context or Retrieval: Choose by Corpus Size, Cost and Freshness
  • Skepticism Toward Confident Output: Check the Quote, the Record and the Sum Before You Send
  • Debugging a Claude App: Three Error Types, the Recovery Each One Earns, and the First Failing Row
  • Six Ways a 200 Can Still Be Wrong: Hallucination, Refusal, Under-Acting, Context Loss, Format Drift and Inconsistency
  • Fix the Cause, Not the Symptom: Four Recovery Drills for an LLM App, Each Checked on a New Input
  • Integration Layer or Model Output? Three Taps and Three Questions to Find Where a Wrong Answer Lives
  • Which Test Layer Owns the Failure? Unit, Functional, Integration and End-to-End Tests for a Claude App
  • Designing an Overnight Document Pipeline on Claude: Batch Lane, Live Lane, a Cached Prefix and a custom_id Reconcile
  • Proving a Model Upgrade Is Ready: A Frozen Golden Set, a Calibrated Judge, the Right Layer and a Release Gate
  • From Requirement to Design for a Claude App: Eight Requirements, Five Elements and a Trace With No Gaps
  • Build a Claude Refund App: the Messages API, Two Tools, an MCP Server and a Hook in One Loop
  • Ship a Claude App: an Eval Gate, Two Guardrail Layers, a Cost Check From usage and a Pinned Model
  • Lab: a 30-Case Golden Set, a Calibrated Judge and a Per-Slice CI Gate on a Claude Refund App
  • Lab: Cut a Claude App's Bill by 62 Percent With Usage Data, Layered Cache Breakpoints and a Batch Job
  • Lab: Three Planted Bugs in a Claude App, a Vague Prompt, a Mistyped Tool Schema and a Broken Stream Handler
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Lab: Harden a Claude App, an Uncalibrated Judge, a Retry Loop That Retries Everything and a Hook Matcher With a Gap
  • Lab: Turn a Claude App Into a Reusable Template, One Pinned Model Id, No Key in Code and Evals Built From Data
  • Building an MCP Server: Tools, Resources and Prompts in Python and TypeScript
  • MCP Transports: stdio or Streamable HTTP, and Who Starts the Server
  • Deploying and Authenticating an MCP Server: Environment Keys for stdio, Bearer Tokens and Scopes for HTTP
  1. Blog
  2. /
  3. Claude
  4. /
  5. Building with the Claude API

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.

Chaand Sheikh

·27 November 2026Building with the Claude API

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

RouteOperated byPython client class
Claude APIAnthropicAnthropic
Claude Platform on AWSAnthropicAnthropicAWS (client in beta)
Claude Models on Google Cloud, Anthropic managedAnthropicAnthropicGoogleCloud
Microsoft Foundry (on Azure)AnthropicAnthropicFoundry
Amazon BedrockAWS, a partnerAnthropicBedrockMantle
Claude Models on Google Cloud, Google managed (Vertex AI)Google, a partnerAnthropicVertex

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 AnthropicBedrockMantle with an AWS region, and its model id carries an anthropic. prefix.
  • Google managed (Vertex AI) uses AnthropicVertex with a project and a region.
  • Foundry uses AnthropicFoundry with 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.

The call is the same, the rest is not Stays the same request: model, max_tokens, messages reply: content, stop_reason, usage Changes per platform 1. client class one for each platform 2. sign-in AWS, Google Cloud, API key or Entra ID 3. model id prefix, URL or deployment name 4. features read the platform's page SupportDesk make_client(platform) then client.messages.create(...)
The order is the same at every counter. Check the four things around it.

What changes, one by one

WhatHow it differs
Client classOne per platform, as in the table above
Sign-inThe 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 idBedrock adds the anthropic. prefix. On the Google managed route the model sits in the URL. On Foundry it's your deployment name.
FeaturesEach 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

CheckQuestion to ask
Client classWhich class does this platform use?
Sign-inWhich identity does it accept?
Model idHow does this platform name the model?
FeaturesDoes 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"?

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in Claude · 23 of 66

Previous
Claude Message Batches or Real Time: Choose by Who Is Waiting, Match by custom_id, Resend Only the Failures
Next post
The Life Cycle of a Claude App: Six Phases, a Model That Retires, and a Release Gate for Every Change

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.

On this page

  • One order, three counters
  • Six ways to reach Claude
  • clients.py: one client per platform, one call
  • One call, six routes
  • What changes, one by one
  • features.py: check the job before you pick the platform
  • Common mistakes
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

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)

Single logo

Empowering Education, One Course at a Time

About
About usContact usFAQs
Legal
Terms of ServicePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.