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.

Setup for each agent and cloud

How each coding agent connects to each cloud, checked 28 Oct 2026. — = not listed in the agent's docs.
AgentAmazon Bedrock (AWS)Google Cloud (Vertex AI / Agent Platform)Microsoft Azure
Claude CodeRun /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 BedrockRun /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 AIMicrosoft 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 CLISet 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 BedrockPer 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
AiderSet 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 BedrockLog in with the gcloud CLI, set VERTEXAI_PROJECT and VERTEXAI_LOCATION, then run aider --model vertex_ai/<model>.Source: Aider docs: Vertex AISet 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—

Gemini CLI's authentication page lists Google sign-in, a Gemini API key and Vertex AI only, so there is no Bedrock or Azure option to show. The same page says Gemini CLI was replaced by Antigravity CLI on 18 June 2026 for unpaid-tier and Google One users. Gemini CLI authentication docs

Cost notes

Claude list prices per million tokens (input / output). Checked 28 Oct 2026.
ModelClaude API list priceGoogle 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

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 .

Prices exclude tax. Cloud and agent docs change often, so check the live page before you rely on a number.