Answer: Claude Code queries the gateway's `/v1/models` endpoint at startup and adds the returned models to the `/model` picker, enabled by setting `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1`. The request is `GET /v1/models?limit=1000` with a timeout of 3 seconds by default. Status: Confirmed Entry: tool/claude-code/models/gateway-model-discovery Revision: 2 Digest: sha256:a2e3554279e08b13 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:04:32Z Last changed: 2026-11-18T12:17:11Z (Discovery mechanism: — → /v1/models) Last verified: 2026-11-20T12:21:46Z Next check: 2026-11-21T12:21:46Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Unit | Source | As of Discovery mechanism | /v1/models | | [1] | 2026-11-20 Enable variable | CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 | | [1] | 2026-11-20 Request | GET /v1/models?limit=1000 | | [1] | 2026-11-20 Default timeout | 3 seconds | seconds | [1] | 2026-11-20 Timeout variable | CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS | | [1] | 2026-11-20 Timeout variable minimum version | v2.1.269 | | [1] | 2026-11-20 Cache location | ~/.claude/cache/gateway-models.json | | [1] | 2026-11-20 Sources: [1] Anthropic. "Claude Code gateway compatibility guide". https://code.claude.com/docs/en/llm-gateway-protocol.md Role: primary. Accessed: 2026-11-20T12:21:46Z Quote: "Claude Code can query the gateway's `/v1/models` endpoint at startup and add the returned models to the `/model` picker" (Supports: Discovery mechanism) Quote: "Developers enable it by setting [`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1`]" (Supports: Enable variable) Quote: "The request is `GET /v1/models?limit=1000` with a timeout of 3 seconds by default" (Supports: Request) Quote: "with a timeout of 3 seconds by default" (Supports: Default timeout) Quote: "To give a slow gateway longer, set [`CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS`]" (Supports: Timeout variable) Quote: "The variable requires Claude Code v2.1.269 or later." (Supports: Timeout variable minimum version) Quote: "Results are cached to `~/.claude/cache/gateway-models.json`" (Supports: Cache location) Published: 2026-11-20T02:52:11Z Snapshot SHA-256: 69d37ce069cd6825d247359e759779d435bac199a3b4c690d33789700fdeca32 (captured 2026-11-17T12:27:05Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-17T12:27:07Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:21:46Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:21:46Z Last attempt: 2026-11-20T12:21:46Z Notes and limitations: Extracted automatically from a single official source (section "Model discovery"). Related: https://latestn.com/tool/claude-code/models/model-aliases What model aliases are available in Claude Code? https://latestn.com/tool/claude-code/models/models-available-under-zdr Which models are available in Claude Code under Zero Data Retention? https://latestn.com/tool/claude-code/models/pin-model-versions How do I pin model versions for Claude Code on Amazon Bedrock? https://latestn.com/tool/claude-code/models/background-session-model-effort How do I set the model, effort, and permission mode for Claude Code background sessions? https://latestn.com/tool/claude-code/models/choose-advisor-model Which advisor models can I pair with my main model in Claude Code? https://latestn.com/tool/claude-code/models/choose-subagent-model How do I choose which model a Claude Code subagent runs on? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-18T12:17:11Z | changed | Discovery mechanism: — → /v1/models | [1] 2026-11-18T12:17:11Z | changed | Discovery endpoint: /v1/models → — | [1] 2026-11-13T03:04:32Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/models/gateway-model-discovery/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/models/gateway-model-discovery POST: https://latestn.com/dispute/tool/claude-code/models/gateway-model-discovery with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/models/gateway-model-discovery?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How does Claude Code discover available models through a gateway? Revision 2, last verified 2026-11-20T12:21:46Z. https://latestn.com/tool/claude-code/models/gateway-model-discovery (accessed 2026-11-21T09:54:47Z). @misc{LatestN_tool_claude_code_models_gateway_model_discovery_r2, title = {How does Claude Code discover available models through a gateway?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/models/gateway-model-discovery}}, note = {Revision 2; digest sha256:a2e3554279e08b13; last verified 2026-11-20T12:21:46Z; accessed 2026-11-21T09:54:47Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/models/gateway-model-discovery