How to use claude code via AWS Bedrock Access Gateway?
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?
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)
That's correct, no plans to support other API formats at this time.
@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?
@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.
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.
@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.
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.