[FEATURE] Environment Variables/mapping for specific model version overrides

Status Fixed / completed
Maintainer reply ✓ Yes — ashwin-ant
Activity 6 comments · opened Jan 16, 2026 · closed Apr 18, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Problem Statement

Currently, Claude Code provides environment variables to override model aliases:

  • ANTHROPIC_DEFAULT_OPUS_MODEL → controls the opus alias
  • ANTHROPIC_DEFAULT_SONNET_MODEL → controls the sonnet alias
  • ANTHROPIC_DEFAULT_HAIKU_MODEL → controls the haiku alias

However, the /model command displays specific model versions as separate options (e.g., "Opus 4.1", "Opus 4.5"). These specific version entries are hardcoded and cannot be customized.

Use Case: Users leveraging cloud providers like AWS Bedrock or custom LLM gateways often need to use provider-specific model identifiers (e.g., Bedrock inference profile ARNs, cross-region inference IDs, or custom endpoint models). While the alias-based environment variables allow overriding one "opus" option, there's no way to configure custom endpoints for each specific version shown in the model picker.

Example Scenario:
A user with AWS Bedrock wants both Opus 4.1 and Opus 4.5 available in the /model picker, each pointing to different Bedrock inference profiles:

  • Opus 4.1 → arn:aws:bedrock:us-west-2:123456789:inference-profile/global.opus-4-1-profile
  • Opus 4.5 → arn:aws:bedrock:us-west-2:123456789:inference-profile/global.opus-4-5-profile

Currently, only one can be configured via ANTHROPIC_DEFAULT_OPUS_MODEL and if we pass Opus 4.5 inference profile it will show up in Claude Code as Opus 4.1 and Opus 4.5 will direct to the default model id.

Proposed Solution

Introduce additional environment variables for specific model versions:

# Opus versions

ANTHROPIC_OPUS_4_MODEL="custom-model-id-or-arn"
ANTHROPIC_OPUS_4_5_MODEL="custom-model-id-or-arn"

# Sonnet versions
ANTHROPIC_SONNET_4_MODEL="custom-model-id-or-arn"
ANTHROPIC_SONNET_4_5_MODEL="custom-model-id-or-arn"

# Haiku versions
ANTHROPIC_HAIKU_3_5_MODEL="custom-model-id-or-arn"

Alternative Solutions

Model mapping

Configuration through settings.json file where we can map models to the inference profiles/other models.

  {
    "modelOverrides": {
      "claude-opus-4-20250514": "arn:aws:bedrock:...:inference-profile/us.custom-opus-4",
      "claude-opus-4-5-20251101": "arn:aws:bedrock:...:inference-profile/global.custom-opus-4-5",
      "claude-sonnet-4-5-20250929": "custom-sonnet-model-id"
    }
  }

List of models

Even better solution would be to supply a list of models. This would add support for older models as well as newest ones. This list could be supplied through settings.json and look like:

  {
    "modelList": {
      [
      { "name": "Opus 4.5", "model": "arn:aws:bedrock:...:inference-profile/us.custom-opus-4-5"},
      { "name": "Opus 4.1", "model": "arn:aws:bedrock:...:inference-profile/global.custom-opus-4-1"},
      { "name": "Sonnet 4.5", "model": "custom-sonnet-model-id"}
    }
  }

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

Environment Setup

An enterprise organization has configured Claude Code to use AWS Bedrock with Application Inference Profiles.

# Developer's shell environment
export CLAUDE_CODE_USE_BEDROCK=1
export ANTHROPIC_DEFAULT_OPUS_MODEL="arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/opus-45-prod"
export ANTHROPIC_DEFAULT_SONNET_MODEL="arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/sonnet-45-prod"

---

Current Scenario: Developer Wants to Use Opus 4.5

Step 1: Developer launches Claude Code

  claude

Step 2: Developer types /model to change the model
Step 3: Claude Code displays the model picker with options:

  Select a model:
    > Default
      Opus 4.5
      Opus 4.1
      Haiku

Step 4: Developer selects Opus 4.5
Step 5: Claude Code attempts to use the hardcoded model ID claude-opus-4-5-20251101
Step 6: ❌ Request fails
Bedrock rejects the request because the developer only has permission to access models through inference profiles, not directly

Expected Behavior (With Proposed Feature)

Step 1: Administrator configures environment variables for all model versions:

  export CLAUDE_CODE_USE_BEDROCK=1

  # Alias overrides
  export ANTHROPIC_DEFAULT_OPUS_MODEL="arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/opus-45-prod"
  export ANTHROPIC_DEFAULT_SONNET_MODEL="arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/sonnet-45-prod"

  # Specific version overrides (NEW)
  export ANTHROPIC_OPUS_4_1_MODEL="arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/opus-41-prod"
  export ANTHROPIC_OPUS_4_5_MODEL="arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/opus-45-prod"
  export ANTHROPIC_HAIKU_4_5_MODEL="arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/haiku-4-5-prod"

Step 2: Developer launches Claude Code

claude

Step 3: Developer types /model to change the model

Step 4: Claude Code displays the model picker:

  Select a model:
    > Default
      Opus 4.5
      Opus 4.1
      Haiku

Step 5: Developer selects Opus 4.5
Step 6: Claude Code resolves Opus 4.5 → ANTHROPIC_OPUS_4_5_MODEL → arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/opus-45-prod
Step 7: ✅ Request succeeds through the managed inference profile

Additional Context

I have added a High Impact on this as it does confuse people and understandably requires explanation why Opus 4.5 is actually under Opus 4.1.

View original on GitHub ↗

6 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/17760
  2. https://github.com/anthropics/claude-code/issues/12969
  3. https://github.com/anthropics/claude-code/issues/10169

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

mbos-splunk · 7 months ago

Selected issues touch on parts of this one - this collects them all together.

mehdashti · 6 months ago

+1 — This is a real pain point for direct Anthropic API users too, not just Bedrock

While the original issue focuses on AWS Bedrock ARN mapping, I want to highlight that this same problem affects direct Anthropic API users who simply want to switch between model generations in the VSCode extension.

My Experience

I'm on a Max plan using Claude Code in VSCode. Here's what I tried and what failed:

Attempt 1: availableModels in ~/.claude/settings.json
{
  "availableModels": [
    "claude-opus-4-5-20251101",
    "claude-sonnet-4-5-20250929"
  ]
}

Result: availableModels is a restriction mechanism (enterprise allowlist), not an "add models" mechanism. Setting it actually removed built-in models from the picker instead of adding legacy ones.

Attempt 2: model field with full model ID
{
  "model": "claude-opus-4-5-20251101"
}

Result: Silently ignored. Claude Code continues running Opus 4.6.

Attempt 3: /model claude-opus-4-5-20251101 in session

Result: Also silently ignored. No error, no feedback — just stays on Opus 4.6.

Attempt 4: claudeCode.selectedModel in VSCode settings
{
  "claudeCode.selectedModel": "claude-opus-4-5-20251101"
}

Result: Same — silently ignored.

Why This Matters

Different model generations have different strengths. Sometimes I want:

  • Opus 4.5 for tasks where it performed better in my specific domain
  • Sonnet 4.5 for lighter tasks where 4.6 is overkill and slower
  • Opus 4.6 for complex reasoning (current default)

Being locked to only the latest generation removes user choice. The model picker currently shows only 3 options (Default/Sonnet/Haiku) with no way to access any previous generation.

Proposed Enhancement (expanding on the OP's modelList idea)

The simplest solution for direct API users would be:

{
  "customModels": [
    { "label": "Opus 4.5", "model": "claude-opus-4-5-20251101" },
    { "label": "Sonnet 4.5", "model": "claude-sonnet-4-5-20250929" },
    { "label": "Opus 4.1", "model": "claude-opus-4-1-20250805" }
  ]
}

These would appear in the /model picker alongside the built-in options. This is backward-compatible, requires no changes to existing behavior, and solves both the Bedrock ARN use case AND the direct API "I want legacy models" use case.

Environment

  • OS: Linux (Debian)
  • Claude Code: VSCode Extension (latest)
  • Plan: Max
  • Provider: Direct Anthropic API
East-rayyy · 5 months ago

@mbos-splunk — I built exactly this. claude-alias-patch patches Claude Code to dynamically register model aliases from ANTHROPIC_DEFAULT_*_MODEL env vars. Define ANTHROPIC_DEFAULT_GEMINI_MODEL, ANTHROPIC_DEFAULT_GPT_MODEL, or any alias you want in ~/.claude/settings.json — they show up in the model picker, Task tool, and agent definitions.

Single install script that auto-patches your instance. No re-patching needed when you add or change models — just edit settings and restart Claude.

ashwin-ant collaborator · 4 months ago

This was fixed in v2.1.73 — A new modelOverrides setting lets you map each model-picker entry to a custom provider model ID (e.g., a Bedrock ARN). If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.

github-actions[bot] · 4 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.