Envoy Proxy to SAP AI Core to Anthropic
Run Claude Code with SAP Generative AI Hub Models
In Part 1 we built an Envoy Proxy that attaches an OAuth 2.0 JWT and rewrites request paths so they match SAP AI Core’s inference-endpoint schema for OpenAI models.
In this follow-up we will:
- Add support for Anthropic models to the Envoy configuration.
- Use the Anthropic Python SDK to call the Sonnet-4.5 model hosted in AI Core.
- Configure Claude Code so it can generate code with the same model.

Using the Anthropic Python SDK
Start the Envoy with our configuration from the Part 1 envoy-aicore.yaml:
$ envoy -c envoy-aicore.yaml
Next, run a slightly modified example that calls a Sonnet-4.5 model :
from anthropic import AnthropicBedrock
client = AnthropicBedrock()
response = client.messages.create(
model="d7ed726e32394096",
max_tokens=1024,
tools=[
{
"type": "bash_20250124",
"name": "bash"
}
],
messages=[
{"role": "user", "content": "List all Python files in the current directory."}
]
)
print(response.content)
Two changes compared with the standard sample:
- We instantiate
AnthropicBedrock, because AI Core provides Anthropic models through AWS Bedrock. - We pass the AI Core
Deployment ID(d7ed726e32394096) instead of a model name.
For convenience we will supply the base URL via an environment variable rather than hard-coding it:
$ ANTHROPIC_BEDROCK_BASE_URL=http://localhost:8100 \
uv run -w anthropic["bedrock"] test-anthropic.py
If you run the script now you will receive:
anthropic.NotFoundError: Error code: 404
Envoy logs reveal why:
[2025-12-14T16:57:56.549Z] "POST /model/d7ed726e32394096/invoke HTTP/1.1" 404 - 198 0 130 130 "-" "AnthropicBedrock/Python 0.75.0" ...
AI Core expects the path /v2/inference/deployments, not /model.
Insert a new route into envoy-aicore.yaml:
- match:
prefix: "/bedrock/model"
route:
prefix_rewrite: "/v2/inference/deployments"
auto_host_rewrite: true
cluster: aicore
timeout: 300s
request_headers_to_add:
- header:
key: "AI-Resource-Group"
value: "default"
append_action: ADD_IF_ABSENT
Here we:
- Use the
/bedrockprefix in the base URL to keep the config organized. - Replace the
/bedrock/modelprefix with the required AI Core path. - Add the mandatory
AI-Resource-Groupheader. - Forward the request to the
aicorecluster.
Restart the Envoy and rerun the script (notice the new BASE_URL):
$ export ANTHROPIC_BEDROCK_BASE_URL=http://localhost:8100/bedrock
$ uv run -w anthropic["bedrock"] test-anthropic.py
[ToolUseBlock(id='toolu_bdrk_01G9A1A62B7a4RPGEUzVvHEZ', input={'command': 'ls -la *.py'}, name='bash', type='tool_use')]
Success! 🎉
Here is the full template: envoy-aicore.yaml
Connecting Claude Code
Anthropic’s code-generation tooling is extremely handy, so let’s wire it up.
Install Claude Code and configure additional settings:
export ANTHROPIC_BEDROCK_BASE_URL=http://localhost:8100/bedrock
export CLAUDE_CODE_SKIP_BEDROCK_AUTH=1
export CLAUDE_CODE_USE_BEDROCK=1
export ANTHROPIC_DEFAULT_SONNET_MODEL=d7ed726e32394096
export ANTHROPIC_DEFAULT_HAIKU_MODEL=d99de4372f34321e
export ANTHROPIC_MODEL=$ANTHROPIC_DEFAULT_SONNET_MODEL
Start the claude CLI and try something fun at the prompt:
> create a minesweeper game using js, html and css
Claude Code will propose the file structure and generate the HTML, CSS and JavaScript automatically:
● I'll create a Minesweeper game for you with HTML, CSS, and JavaScript. Let me create the necessary files.
● Write(minesweeper.html)
⎿ Wrote 38 lines to minesweeper.html
...
Enjoy your freshly generated Minesweeper game!

Recap
- We routed Anthropic Bedrock traffic through Envoy, which injects the correct JWT and rewrites paths for SAP AI Core.
- We successfully called the Sonnet-4.5 model from the Anthropic Python SDK.
- We configured Claude Code to leverage the same deployment and generated a working game.
Your Envoy Proxy is now ready for further experiments — try it with Agents, MCP, or any other Bedrock-compatible tools!