Run coding agents on your own cloud bill
Claude Code, OpenAI Codex CLI, Aider and Gemini CLI can send their model calls to Amazon Bedrock, Google Cloud's Vertex AI or Microsoft Azure instead of a subscription. Usage then lands on your cloud invoice, per token. Below: who that suits, when a subscription still wins, the setup for each pairing and the cost catches.
Checked on · from official provider and product pages (links under every row).
Who it's for, and when it beats a subscription
This is for developers and teams who already have an AWS, Google Cloud or Azure account and want coding-agent usage billed there, with the access controls and budgets they already use.
- Spend you already manage in a cloud account. On Bedrock, Vertex AI or Foundry, Claude Code usage is billed per token to your organization, shows up in your cloud billing console and is capped with your cloud's budget controls. Codex on Bedrock works the same way: access, billing, quotas and regions are managed in your AWS account. Claude Code docs: Manage costs OpenAI Help: Use Codex with Amazon Bedrock
- Light or irregular use. Claude Pro is $20 a month ($17 on annual billing) and includes Claude Code; Max starts at $100 a month. Per-token billing has no monthly fee, so it can come out cheaper if you only code with an agent a few days a month. Claude plans and pricing
- Heavy daily use: compare before you switch. Anthropic's figure for Claude Code on per-token billing across enterprise deployments is about $13 per developer per active day and $150-250 per developer per month, with 90% of users under $30 per active day. It is an average at list price, and Anthropic advises a small pilot to measure your own spend. Pro and Max have usage limits, so the comparison isn't like for like, but those monthly figures are above Pro's $20 and Max's $100 starting price. Claude Code docs: Manage costs Claude plans and pricing
- Not a like-for-like price comparison. OpenAI says API token prices are separate from subscription usage and shouldn't be used to estimate what a plan includes. Codex used with an API key has no cloud-based features such as GitHub code review or Slack. Codex pricing
Setup for each agent and cloud
| Agent | Amazon Bedrock (AWS) | Google Cloud (Vertex AI / Agent Platform) | Microsoft Azure |
|---|---|---|---|
| Claude Code | Run /setup-bedrock, or set CLAUDE_CODE_USE_BEDROCK=1 and AWS_REGION. Sign in with an AWS profile, access keys or a Bedrock API key (AWS_BEARER_TOKEN_BEDROCK).Source: Claude Code docs: Amazon Bedrock | Run /setup-vertex, or set CLAUDE_CODE_USE_VERTEX=1, CLOUD_ML_REGION and ANTHROPIC_VERTEX_PROJECT_ID. Sign in with gcloud credentials or a service account key. Request Claude access in Model Garden first.Source: Claude Code docs: Google Vertex AI | Microsoft Foundry: set CLAUDE_CODE_USE_FOUNDRY=1 and ANTHROPIC_FOUNDRY_RESOURCE. Sign in with an API key (ANTHROPIC_FOUNDRY_API_KEY) or Entra ID (az login). No setup wizard.Source: Claude Code docs: Microsoft Foundry |
| OpenAI Codex CLI | Set model_provider in ~/.codex/config.toml to amazon-bedrock-runtime (cross-Region; OpenAI recommends it for new setups) or amazon-bedrock (Mantle, in-Region), plus AWS_REGION or a region under [model_providers.amazon-bedrock.aws]. Auth: AWS_BEARER_TOKEN_BEDROCK or AWS IAM credentials. OpenAI's help article lists CLI 0.128.0 or later.Source: Codex docs: Use ChatGPT Work and Codex with Amazon Bedrock OpenAI Help: Configure Codex with Amazon Bedrock | Per OpenAI's release notes, Codex CLI 0.165.0 added a built-in Google Cloud Vertex AI provider: set model_provider = "gcp". The settings below come from the linked source-code commits rather than from OpenAI's docs. Project and location come from GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION (default global), or from project_id and location under [model_providers.gcp]. Credentials come from gcloud auth application-default print-access-token by default.Source: OpenAI release notes: Codex CLI 0.165.0 (GitHub) Codex source: built-in Google Cloud Vertex AI provider (GitHub commit) Codex source: GCP project and location settings (GitHub commit) | Add a custom [model_providers.azure] block with base_url = "https://YOUR_PROJECT_NAME.openai.azure.com/openai", env_key = "AZURE_OPENAI_API_KEY", query_params = { api-version = "2025-04-01-preview" } and wire_api = "responses" (the values in OpenAI's example).Source: Codex docs: Advanced configuration |
| Aider | Set up AWS credentials with the AWS CLI or environment variables, enable the model in the Bedrock console, then pick it with --model. Some models need an inference profile ID instead of the model ID.Source: Aider docs: Amazon Bedrock | Log in with the gcloud CLI, set VERTEXAI_PROJECT and VERTEXAI_LOCATION, then run aider --model vertex_ai/<model>.Source: Aider docs: Vertex AI | Set AZURE_API_KEY, AZURE_API_VERSION and AZURE_API_BASE, then run aider --model azure/<your deployment name> (OpenAI models).Source: Aider docs: Azure |
| Gemini CLI | — | Set GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION, then sign in with gcloud credentials, a service account key or a Google Cloud API key and choose Vertex AI.Source: Gemini CLI authentication docs | — |
Cost notes
| Model | Claude API list price | Google Vertex AI, Global |
|---|---|---|
| Claude Sonnet 5.5 | $2 / $10 | $2.00 / $10.00 |
| Claude Opus 5.5 | $4 / $20 | $4.00 / $20.00 |
Vertex figures are from the Global tab of Google's page, which lists the same rates as Anthropic's own page for these two models. Anthropic says regional and multi-region endpoints carry a 10% premium over global endpoints, and that Bedrock and Google-managed Vertex have their own regional pricing, so check your region on their pages. Amazon and Microsoft load their per-token tables by script, so we don't quote them: read the live tables on the AWS Bedrock page and, for OpenAI models, the Azure OpenAI page. Claude on Foundry is billed at Anthropic's standard rates (see below). Claude API pricing (including cloud platform pricing) Google Cloud: Vertex AI generative AI pricing AWS: Amazon Bedrock pricing Microsoft: Azure OpenAI pricing (OpenAI models)
Caveats
- On Bedrock and Vertex, if you don't pin a primary model, Claude Code bills at the Opus rate, which is higher than Sonnet. On Foundry there is no startup model check, so requests fail if the default model isn't deployed. Claude Code docs: Amazon Bedrock Claude Code docs: Google Vertex AI Claude Code docs: Microsoft Foundry
- Pin your model versions. Claude Code's docs say that without pinning, the sonnet alias resolves to Sonnet 4.5 on Amazon Bedrock and Google Cloud's Vertex AI (Agent Platform), not Sonnet 5.5, and the opus alias resolves to Opus 4.6 on Microsoft Foundry. Set
ANTHROPIC_DEFAULT_SONNET_MODEL,ANTHROPIC_DEFAULT_OPUS_MODELandANTHROPIC_DEFAULT_HAIKU_MODELto the exact model IDs you want, so the model you run, and the price row above that applies, are the ones you chose. Claude Code docs: Amazon Bedrock Claude Code docs: Google Vertex AI Claude Code docs: Microsoft Foundry Claude Code docs: Model configuration - Foundry has no setup wizard. Claude on Foundry is billed through the Azure Marketplace in Claude Consumption Units at $0.01 each, rated at standard per-model rates, and US Data Zone Standard deployments carry a 1.1x multiplier. Claude Code docs: Microsoft Foundry Claude API pricing (including cloud platform pricing)
- Prompt caching on Claude Code: the default 5-minute cache write costs $2.50 per million tokens on Sonnet 5.5 (against $2 base input) and $5 on Opus 5.5 (against $4). A 1-hour cache TTL (
ENABLE_PROMPT_CACHING_1H=1) bills writes at $4 on Sonnet 5.5 and $8 on Opus 5.5, which is 2x the base input price. Cache reads cost less than base input. Claude Code docs: Microsoft Foundry Claude API pricing (including cloud platform pricing) - Anthropic recommends a dedicated AWS account or GCP project for Claude Code, to simplify cost tracking and access control. Claude Code docs: Amazon Bedrock Claude Code docs: Google Vertex AI
- Claude Code's WebSearch tool is not available on Amazon Bedrock. Claude Code docs: Amazon Bedrock
- Codex on Bedrock does not offer image generation, voice transcription, the cloud plugin store, cloud configuration and policies, or Codex cloud agents (review, security, web). Fast Mode isn't available either, and hosted web search is unavailable on the Runtime provider (OpenAI points to Mantle for it). OpenAI Help: Use Codex with Amazon Bedrock Codex docs: Use ChatGPT Work and Codex with Amazon Bedrock
- Codex on Google Cloud (Vertex AI): per OpenAI's release notes, the built-in provider arrived in Codex CLI 0.165.0. In its source code, reasoning summaries, custom tools, web search and image generation are disabled on this provider. OpenAI release notes: Codex CLI 0.165.0 (GitHub) Codex source: built-in Google Cloud Vertex AI provider (GitHub commit)
- Vertex AI model access for Claude is a request in Model Garden that may take 24-48 hours to approve. Claude Code docs: Google Vertex AI
- Claude Code's session cost figure is computed locally at list price. For what you were actually billed, use your cloud billing console. Claude Code docs: Manage costs
FAQ
Can I run Claude Code on Amazon Bedrock, Google Vertex AI or Microsoft Azure?
Yes. On Bedrock, run /setup-bedrock or set CLAUDE_CODE_USE_BEDROCK=1 and AWS_REGION. On Vertex AI, run /setup-vertex or set CLAUDE_CODE_USE_VERTEX=1, CLOUD_ML_REGION and ANTHROPIC_VERTEX_PROJECT_ID, after requesting Claude access in Model Garden. On Azure it runs through Microsoft Foundry with CLAUDE_CODE_USE_FOUNDRY=1 and ANTHROPIC_FOUNDRY_RESOURCE, and there is no setup wizard. Claude Code docs: Amazon Bedrock Claude Code docs: Google Vertex AI Claude Code docs: Microsoft Foundry
Is per-token cloud billing cheaper than a Claude Pro or Max subscription?
It depends on how much you use it. Claude Pro is $20 a month and Max starts at $100 a month. Per-token billing has no monthly fee, so it can come out cheaper for light or irregular use. Anthropic's enterprise average for Claude Code on per-token billing is about $13 per developer per active day and $150-250 per developer per month, so heavy daily users should run a small pilot before switching. Claude plans and pricing Claude Code docs: Manage costs
Can OpenAI Codex CLI use Amazon Bedrock or Google Cloud?
Yes. For Bedrock, set model_provider in ~/.codex/config.toml to amazon-bedrock-runtime or amazon-bedrock and authenticate with AWS credentials or a Bedrock API key. Codex CLI 0.165.0 added a built-in Google Cloud Vertex AI provider (model_provider = "gcp"). Codex on Bedrock does not offer image generation, voice transcription or Codex cloud agents. Codex docs: Use ChatGPT Work and Codex with Amazon Bedrock OpenAI Help: Configure Codex with Amazon Bedrock OpenAI release notes: Codex CLI 0.165.0 (GitHub) OpenAI Help: Use Codex with Amazon Bedrock
Which Claude model does Claude Code use on Bedrock or Vertex AI if I don't pin one?
If you don't pin a primary model on Bedrock or Vertex AI, Claude Code bills at the Opus rate, and the sonnet alias resolves to Sonnet 4.5 rather than Sonnet 5.5. Set ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL to the exact model IDs you want. Claude Code docs: Amazon Bedrock Claude Code docs: Google Vertex AI Claude Code docs: Model configuration
Sources
Every fact on this page comes from the official pages below, opened on .
- Claude Code docs: Amazon Bedrock, checked 28 Oct 2026
- Claude Code docs: Google Vertex AI, checked 28 Oct 2026
- Claude Code docs: Microsoft Foundry, checked 28 Oct 2026
- Claude Code docs: Manage costs, checked 28 Oct 2026
- Claude plans and pricing, checked 28 Oct 2026
- Claude API pricing (including cloud platform pricing), checked 28 Oct 2026
- Google Cloud: Vertex AI generative AI pricing, checked 28 Oct 2026
- AWS: Amazon Bedrock pricing, checked 28 Oct 2026
- Microsoft: Azure OpenAI pricing (OpenAI models), checked 28 Oct 2026
- OpenAI Help: Configure Codex with Amazon Bedrock, checked 28 Oct 2026
- OpenAI Help: Use Codex with Amazon Bedrock, checked 28 Oct 2026
- Codex docs: Advanced configuration, checked 28 Oct 2026
- Codex pricing, checked 28 Oct 2026
- OpenAI release notes: Codex CLI 0.165.0 (GitHub), checked 28 Oct 2026
- Codex source: built-in Google Cloud Vertex AI provider (GitHub commit), checked 28 Oct 2026
- Codex source: GCP project and location settings (GitHub commit), checked 28 Oct 2026
- Gemini CLI authentication docs, checked 28 Oct 2026
- Aider docs: Amazon Bedrock, checked 28 Oct 2026
- Aider docs: Vertex AI, checked 28 Oct 2026
- Aider docs: Azure, checked 28 Oct 2026
- Codex docs: Use ChatGPT Work and Codex with Amazon Bedrock, checked 28 Oct 2026
- Claude Code docs: Model configuration, checked 28 Oct 2026
Related
- AI subscriptions: what $20 a month gets you across tools.
- AI usage limits: what each plan includes and what happens when you hit the limit.
- Cheapest AI models: per-token API prices.
- Coding agent tier list