[BUG] Folded gateway-discovered model rows ignore gateway metadata and show Anthropic list pricing

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 0 comments · opened Aug 3, 2026

Preflight Checklist

  • [x] I have searched existing issues and this exact Claude Code gateway-discovery behavior has not been reported
  • [x] This is a single bug report: metadata selection when a discovered gateway model folds into a built-in row
  • [x] I reproduced this on Claude Code 2.1.220

What's Wrong?

When ANTHROPIC_BASE_URL points to an LLM gateway and CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1, Claude Code fetches the gateway's /v1/models. If a discovered model ID resolves to a built-in family, Claude Code folds it into the built-in row and discards the gateway-authored presentation metadata.

For example, the gateway returns:

{
  "id": "claude-opus-5",
  "display_name": "Claude Opus 5 · Bedrock US CRIS"
}

The /model picker renders the built-in Opus name, description, and Anthropic public list price instead. There is no indication that the row came from the gateway or that the serving route and effective price may differ from Anthropic direct. Unfolded discovered IDs correctly show the gateway-provided display_name; the loss occurs specifically during folding.

What Should Happen?

When a gateway-discovered model folds into a built-in row, Claude Code should preserve the gateway-provided display metadata and show gateway provenance. At minimum, it should suppress Anthropic public list pricing whenever ANTHROPIC_BASE_URL is overridden, because the gateway may route through Bedrock, Vertex, another provider, or negotiated pricing.

Steps to Reproduce

  1. Configure Claude Code with a custom ANTHROPIC_BASE_URL.
  2. Enable CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1.
  3. Have the gateway answer GET /v1/models?limit=1000 with claude-opus-5 and a serving-context display_name, such as Claude Opus 5 · Bedrock US CRIS.
  4. Open /model.
  5. Observe that the discovered model folds into the built-in Opus row.
  6. Observe that the row uses built-in copy and Anthropic list pricing, with no gateway provenance.

Expected Result

The folded row uses the gateway-provided display metadata (or clearly shows both), carries a gateway provenance marker, and does not claim Anthropic public list pricing for a gateway-served route.

Actual Result

Built-in metadata wins completely. Gateway serving context is hidden and Anthropic list pricing is shown even though it may not apply.

Claude Code Version

2.1.220

Platform

LLM gateway via Anthropic Messages compatibility API

Operating System

macOS

Additional Information

Gateway routing and authorization are correct; this report is about the picker metadata source after discovery folding. A related closed Cowork report (#52526) concerns ignored gateway names, but not Claude Code gateway discovery, folding, provenance, or incorrect pricing context.

View original on GitHub ↗