DEV Community

Cover image for Running Claude Code on AWS Bedrock Instead of the Anthropic API (a weekend rabbit hole)
PriyanshuValiya
PriyanshuValiya

Posted on

Running Claude Code on AWS Bedrock Instead of the Anthropic API (a weekend rabbit hole)

I've been learning Claude Code for agentic development lately, but I didn't want to burn through paid API credits while I was still figuring out how the tool actually works. Every wrong prompt, every abandoned session, every "let me just try this real quick" costs money when you're hitting the Anthropic API directly.

So I spent a weekend building a small LiteLLM proxy that lets the Claude Code CLI talk to Amazon Nova on AWS Bedrock instead. Same agent loop, same tool calling, same workflow you'd get with Claude Code normally just pointed at a different backend, running on AWS credits instead of API billing.

The problem I was actually trying to solve

I looked at the usual options for cheap/free agentic coding practice and none of them held up for real sessions:

  • Ollama locally - needs a beefy machine with real RAM and GPU headroom. Most people don't have that sitting around, and I didn't want to buy it just to practice.
  • Free-tier providers like OpenRouter - you hit token limits within a handful of basic prompts. Not nearly enough runway for long-running agentic workflows where the model is calling tools back and forth for a while. I wanted something that let me learn tool use, agent loops, and long context handling without either of those walls showing up mid-session.

What I built

A LiteLLM proxy sitting between Claude Code's CLI and AWS Bedrock, translating requests so Claude Code thinks it's talking to Anthropic's API while it's actually routing to Amazon Nova.

A few things I locked down on purpose:

  • No artificial session caps. It's self-hosted, so there's no vendor imposed limit on how long or how often I can run sessions.
  • Everything runs on AWS credits, not API billing.
  • Roughly 20–35% cheaper per token than Claude Haiku pricing, based on current Bedrock rates.
  • IAM scoped to a single model. I locked the role down so the proxy physically can't invoke anything more expensive, even by accident.
  • AWS Budget alerts wired in, so I'm not finding out about a runaway bill after the fact. The Docker image and config are public if you want to poke at it yourself: https://github.com/PriyanshuValiya/Claude-Code/blob/main/README.md

Where this actually helps (and where it doesn't)

This is genuinely one of the more practical setups I've found for running long agentic sessions without either buying hardware or hitting a free-tier wall every ten minutes. If you're trying to internalize how these coding agents plan, call tools, and recover from errors, having room to run long sessions matters more than having the "best" model underneath.

But I want to be straight about what this is not: it's not free Claude. It's a translation layer that lets Claude Code's client talk to a different model entirely. Amazon Nova is not Claude, and the outputs, reasoning quality, and tool-calling behavior won't match what you'd get from Anthropic's actual models. If you're evaluating Claude Code itself, or building something you plan to ship, this setup will give you a skewed picture.

What it's good for is exactly what I built it for: learning the mechanics of agentic coding tools - the loop, the tool calls, the context management without worrying about a credit card every time a session runs long.

Takeaway

If you're in the same spot I was, wanting to learn Claude Code without either buying a GPU rig or getting cut off after three prompts, a Bedrock proxy is a reasonable middle ground. Just don't mistake it for the real thing when it's time to judge the model itself, that comparison only makes sense against Anthropic's actual API.

Top comments (1)

Collapse
 
merbayerp profile image
Mustafa ERBAY

Nice write-up! I especially appreciate the distinction between learning the agent workflow and evaluating the model. One thing I’d also consider is keeping the proxy provider-agnostic. If the CLI only targets an OpenAI-compatible (or similar) interface, you can swap Bedrock, Anthropic, OpenAI, Gemini, or even a local model without changing the client. That makes the proxy a long-term architectural layer rather than just a cost optimization for one provider.