claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

How to use claude code via AWS Bedrock Access Gateway?

Open marcomayer opened this issue 6 months ago • 1 comments

I have not found a way to use our Sonnet-4 and Opus-4 models deployed on AWS Bedrock via the Access Gateway (https://github.com/aws-samples/bedrock-access-gateway) which is basically an open-ai compatible API endpoint.

Is there one, if so how does it work? If not, is this planned?

marcomayer avatar Jun 03 '25 11:06 marcomayer

That likely won't work since Claude Code uses the Anthropic (or Boto3) SDK to talk to either Anthorpics API or AWS Bedrock and the Bedrock Access Gateway is specifically an OpenAI compatible API...

You can get Claude Code working with LiteLLM Proxy though, as it also has an Anthropic compatible set of endpoints. Also works great with direct access to Bedrock (Claude Code that is)

MadsRC avatar Jun 03 '25 11:06 MadsRC

That's correct, no plans to support other API formats at this time.

rboyce-ant avatar Jun 03 '25 16:06 rboyce-ant

@MadsRC okay so I could setup LiteLLM Proxy to forward the requests back and forth to AWS Bedrock Access Gateway? Or would one need to replace the Gateway with LiteLLM?

marcomayer avatar Jun 03 '25 17:06 marcomayer

@MadsRC okay so I could setup LiteLLM Proxy to forward the requests back and forth to AWS Bedrock Access Gateway? Or would one need to replace the Gateway with LiteLLM?

You could do either. Not sure how well it would work in front of Bedrock Access Gateway, since it would be traveling through several translation layers. But it could work.

I'd have it skip the Access Gateway and talk directly to Bedrock if possible though. At that point though, you could also just point Claude Code at Bedrock.

MadsRC avatar Jun 03 '25 17:06 MadsRC

You could do either. Not sure how well it would work in front of Bedrock Access Gateway, since it would be traveling through several translation layers. But it could work.

I'd have it skip the Access Gateway and talk directly to Bedrock if possible though. At that point though, you could also just point Claude Code at Bedrock.

I'll give that a shot then. Can't skip the Access Gateway, I guess that's a common situation in many companies as they want to provide access to Claude via Bedrock but not just give out AWS Accounts with direct bedrock access. Instead have the Gateway which gives control over usage/costs per API Key etc. I think you should reconsider adding this @rboyce-ant in the near future, if it's too difficult to use Claude Code in an enterprise environment companies are forced to other agents/providers.

marcomayer avatar Jun 03 '25 17:06 marcomayer

@MadsRC just FIY, the LiteLLM Proxy path didn't work because you can't tell LiteLLM to provide an anthropic-API endpoint while calling a openai compatible API :/ So it can't do the translation. And when I set it up as a anthropic-model then it can't communicate with Bedrock Gateway API. So back to square zero.

marcomayer avatar Jun 04 '25 12:06 marcomayer

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 13 '25 14:08 github-actions[bot]