ANTHROPIC_DEFAULT_OPUS_MODEL env var not honored when selecting Opus 4.5 from /model list

Status Fixed / completed
Maintainer reply None cached
Activity 9 comments · opened Jan 12, 2026 · closed Feb 19, 2026

Bug Description

When specifying the ANTHROPIC_DEFAULT_OPUS_MODEL environment variable pointing to Claude Opus 4.5 (via AWS Bedrock), selecting "Opus 4.5" from the /model list does not honor the environment variable. Instead, it results in an AWS Bedrock error.

However, when selecting "Opus 4.1" from the /model list, Claude Opus 4.5 is correctly used (as specified in the env var).

Steps to Reproduce

  1. Set ANTHROPIC_DEFAULT_OPUS_MODEL environment variable to a Claude Opus 4.5 Bedrock inference profile ARN
  2. Start Claude Code
  3. Run /model and select "Opus 4.5"
  4. Observe: AWS Bedrock error occurs (env var not honored)

Expected Behavior

Selecting "Opus 4.5" from the /model list should use the model specified in ANTHROPIC_DEFAULT_OPUS_MODEL environment variable.

Actual Behavior

  • Selecting "Opus 4.5" ignores the ANTHROPIC_DEFAULT_OPUS_MODEL env var and causes an error
  • Selecting "Opus 4.1" correctly uses the Opus 4.5 model specified in the env var

Environment

  • Using AWS Bedrock as the model provider
  • ANTHROPIC_DEFAULT_OPUS_MODEL set to Opus 4.5 inference profile ARN

View original on GitHub ↗

9 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/13647
  2. https://github.com/anthropics/claude-code/issues/16982
  3. https://github.com/anthropics/claude-code/issues/13242

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

brandon-pltsci · 7 months ago

Confirming this bug + Binary Analysis

I can confirm this exact issue on Claude Code 2.1.19 with AWS Bedrock on macOS.

Binary Analysis Findings

I analyzed the Claude Code binary (~/.local/share/claude/versions/2.1.19) and found evidence that confirms this is a wiring bug:

1. Only ONE Opus environment variable exists:

ANTHROPIC_DEFAULT_HAIKU_MODEL
ANTHROPIC_DEFAULT_OPUS_MODEL    ← Only one Opus variable
ANTHROPIC_DEFAULT_SONNET_MODEL

2. Display name mapping logic in binary:

if (R.includes("claude-opus-4-5")) return "Opus 4.5";
if (R.includes("claude-opus-4-1")) return "Opus 4.1";
if (R.includes("claude-opus-4")) return "Opus 4";

3. Current environment:

$ env | grep ANTHROPIC_DEFAULT_OPUS_MODEL
ANTHROPIC_DEFAULT_OPUS_MODEL=global.anthropic.claude-opus-4-5-20251101-v1:0

The model ID clearly indicates version 4.5: claude-opus-**4-5**-20251101

The Bug

The menu options are wired backwards:

  • "Opus 4.1" menu option → reads ANTHROPIC_DEFAULT_OPUS_MODEL ✓ (but shouldn't)
  • "Opus 4.5" menu option → ignores ANTHROPIC_DEFAULT_OPUS_MODEL ✗ (but should read it)

Impact

  • Users cannot override the Opus 4.5 model selection via environment variables
  • The variable name ANTHROPIC_DEFAULT_OPUS_MODEL suggests it should be for the latest/default Opus model (4.5), not 4.1
  • Workaround: Select "Opus 4.1" to use your custom Opus 4.5 model (confusing!)

Suggested Fix

Swap the environment variable usage so that:

  1. "Opus 4.5" menu option uses ANTHROPIC_DEFAULT_OPUS_MODEL
  2. "Opus 4.1" menu option uses a separate variable (e.g., ANTHROPIC_OPUS_4_1_MODEL) or hardcoded model ID
cacack · 6 months ago

I found my here as we use application inference profiles to attach cost allocation tags which provide usage attribution. While tracing down a significant portion of Bedrock spent that wasn't properly attributed, I discovered this /model selection of Opus 4.1 (really our Opus 4.5 application inference profile) vs Opus 4.5.

jondestoppeleire · 6 months ago

Confirming: Short model names in custom agent frontmatter also affected on Bedrock

Environment: Claude Code 2.1.31, AWS Bedrock, macOS

Issue: Custom agents defined in .claude/agents/*.md with model: opus in frontmatter spawn as Opus 4.1 instead of Opus 4.5, even when the main session is correctly using Opus 4.5 via full Bedrock ARN in settings.json.

Configuration:

// settings.json - main session works correctly
"model": "us.anthropic.claude-opus-4-5-20251101-v1:0"
# agents/my-agent.md - spawns as Opus 4.1 ❌
model: opus

Evidence: TUI displays "Opus 4.1" when spawning custom agents that specify model: opus, despite parent session running Opus 4.5.

~~Workaround: Use full Bedrock ARN in agent frontmatter:~~

model: us.anthropic.claude-opus-4-5-20251101-v1:0

~~This confirms the short name → model ID resolution bug extends beyond the /model menu to custom agent frontmatter on Bedrock.~~

jondestoppeleire · 6 months ago

Correction: Custom agent frontmatter model field non-functional on Bedrock

My previous comment was incorrect. After testing multiple approaches, none work for custom agents on Bedrock:

| Frontmatter Value | Result |
|-------------------|--------|
| model: opus | Spawns as Opus 4.1 ❌ |
| model: us.anthropic.claude-opus-4-5-20251101-v1:0 (Bedrock ARN) | Spawns as Opus 4.1 ❌ |
| model: claude-opus-4-5-20251101 (Anthropic-style ID) | Spawns as Opus 4.1 ❌ |

Environment: Claude Code 2.1.31, AWS Bedrock, macOS, main session correctly running Opus 4.5

freeformz · 6 months ago

IMO this situation is now even more annoying with Opus 4.6 as there are now two 4.6 options:
Opus 4.6 - Opus 4.6 · Most capable for complex work
Opus (1M context) - Opus 4.6 for long sessions

cacack · 6 months ago

Very confusing for my users, as they will now see 3x models for Opus in /model, where Opus 4.1 is actually the Opus 4.6 provided through my application inference profile in Bedrock that they should use.. 😮‍💨

 ❯ 2. Opus 4.1 ✔             Opus 4.1 · Legacy
   3. Opus 4.6               Opus 4.6 · Most capable for complex work
   4. Opus (1M context)      Opus 4.6 for long sessions
freeformz · 6 months ago

I believe this is now fixed. Since I have ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, & ANTHROPIC_DEFAULT_HAIKU_MODEL set those are the only models that I see when I type /model now. Not sure if that's the best way to handle it, but 🤷 .

github-actions[bot] · 6 months ago

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.