[BUG] Bedrock + `ANTHROPIC_MODEL` / inference profiles not being used for 3.5 Haiku requests

Resolved 💬 2 comments Opened Mar 17, 2025 by clayallsopp Closed Mar 18, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [x] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.45
  • Operating System: MacOS 15.3.1
  • Terminal: Ghostty

Bug Description

After using Claude Code for a bit, using a custom inference profile on Bedrock, I eventually hit an error related to missing permissions.

Steps to Reproduce

CLAUDE_CODE_USE_BEDROCK=1 DISABLE_PROMPT_CACHING=1 ANTHROPIC_MODEL="arn:aws:bedrock:us-east-1:xxx:custom-inference-profile/abc" claude

Eventually, I hit this error:

 Bash(npx something)…

Bash command                                                                                                    │
│                                                                                                                 │
│   npx something                                                                                  │
│   API Error: 403 {"Message":"User: arn:aws:sts::xxx:assumed-role/xxx is    │
│   not authorized to perform: bedrock:InvokeModelWithResponseStream on resource:                                 │
│   arn:aws:bedrock:us-east-1:245200388354:inference-profile/us.anthropic.claude-3-5-haiku-20241022-v1:0          │
│   because no session policy allows the bedrock:InvokeModelWithResponseStream action"}

(I can reproduce this for a specific task on one repo)

Expected Behavior

There should be a way to use Bedrock/IAM-assigned inference profiles for all types of requests.

Actual Behavior

I think what's happening is $ANTHROPIC_MODEL is used for 3.7 requests, but 3.5 requests fall back to the default value above, which I won't have IAM doesn't have access to.

I'm not 100% sure but I think this implies two environment variables are needed? (e.g. ANTHROPIC_MODEL and ANTHROPIC_HAIKU_MODEL etc)

Additional Context

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗