claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Feature Request] Add 'claude model list' CLI command for non-interactive model queries

Open ThePlenkov opened this issue 1 year ago • 3 comments

Problem

Currently, there is no way to programmatically query available Claude models from the CLI without starting an interactive session and using /model.

Current Workarounds

  1. Interactive only: Start claude session → type /model → consumes tokens for LLM processing
  2. No CLI command: claude model list doesn't exist
  3. API directly: Must use curl with API keys manually

Requested Feature

Add a claude model subcommand for non-interactive model queries:

# List all available models
claude model list

# Output:
# ID                              NAME            TYPE      CONTEXT
# claude-sonnet-4-5-20250929     Sonnet 4.5      Latest    200K
# claude-3-5-sonnet-20241022     Sonnet 3.5      Standard  200K  
# claude-3-opus-20240229         Opus 3          Premium   200K
# claude-3-5-haiku-20241022      Haiku 3.5       Fast      200K

# Show current model for session
claude model current

# Show model info
claude model info claude-sonnet-4-5-20250929

Use Cases

  1. Scripting/Automation - Check available models before running tasks
  2. Cost Optimization - Programmatically select cheapest model for task
  3. CI/CD Pipelines - Validate model availability before running agents
  4. Documentation - Generate up-to-date model lists
  5. Debugging - Verify which models are accessible with current API key

Comparison with Similar Tools

GitHub CLI:

gh api /repos/:owner/:repo  # Direct API access
gh repo view                # Formatted output

Docker CLI:

docker images               # List available images
docker inspect <image>      # Show image details

Claude Code (requested):

claude model list           # List available models (no LLM inference)
claude model current        # Show current session model

Benefits

  • ✅ Zero token cost (no LLM inference needed)
  • ✅ Scriptable (parseable output for automation)
  • ✅ Fast (no interactive session startup)
  • ✅ Consistent with modern CLI patterns
  • ✅ Better DX for power users

Implementation Notes

  • Should work without starting interactive session
  • Output should be parseable (consider --json flag)
  • Cache model list locally (refresh periodically)
  • Respect API provider (Anthropic, Bedrock, Vertex)

Related Issues

  • #10169 - Custom Bedrock models not discoverable in /model command list
  • #10717 - /model returns old version of models

Environment:

  • Platform: Linux (WSL2)
  • Version: Claude Code v2.0.x
  • Use case: Automation scripts, CI/CD integration

ThePlenkov avatar Nov 28 '25 10:11 ThePlenkov

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 29 '25 10:12 github-actions[bot]

bump

alanspires avatar Jan 09 '26 06:01 alanspires

+1, this would be nice to have. We have custom models setup on Bedrock and choosing models when switching between a claude subscription and Bedrock use is a pain.

amitmahbubani avatar Jan 13 '26 11:01 amitmahbubani

I'd definitely also like this feature

ctmeiva avatar Mar 27 '26 07:03 ctmeiva

That woud be usefull please give it some attention.

mhd64real avatar Apr 07 '26 04:04 mhd64real

I think this feature will make Claude Code more user-friendly.

junelin66 avatar Apr 10 '26 14:04 junelin66

bump

kessenma avatar Apr 16 '26 21:04 kessenma

+1 anything that has versions should be listable

theasanofi avatar Apr 21 '26 16:04 theasanofi

+10000000000 This would be super useful to be able to configure some inhouse tools to use the correct models programatically

MartinGonzalez avatar Apr 26 '26 17:04 MartinGonzalez

Please add this in - there's exactly no possible way to find this out right now - not even what claude.ai tells us to do even...

$ curl https://api.anthropic.com/v1/models \

-H "Authorization: Bearer $CLAUDE_CODE_OAUTH_TOKEN"
-H "anthropic-version: 2023-06-01" {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."},"request_id":"req_011Cad8bMLnLV5K51nXzeLJ8"}

gitcnd avatar May 02 '26 04:05 gitcnd

you can see the existing models via running claude, then /model

ke@Kyles-MacBook-Pro-2 ws % claude
           Claude Code v2.1.114                                                                          
▗ ▗   ▖ ▖  Sonnet 4.6 with high effort · Claude Max                                                      
           ~/ws                                                                                          
  ▘▘ ▝▝    Welcome to Opus 4.7 xhigh! · /effort to tune speed vs. intelligence                           
                                                                                                         
❯ /model                                                                                                                                                                  
                                                                                                         
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Select model                                                                                                                                                          
  Switch between Claude models. Applies to this session and future Claude Code sessions. For other/previous model names, specify with --model.                            
                                                                                                                                                                          
    1. Default (recommended)  Opus 4.7 with 1M context · Most capable for complex work                                                                                    
  ❯ 2. Sonnet ✔               Sonnet 4.6 · Best for everyday tasks                                                                                                        
    3. Sonnet (1M context)    Sonnet 4.6 with 1M context · Billed as extra usage · $3/$15 per Mtok                                                                        
    4. Haiku                  Haiku 4.5 · Fastest for quick answers
                                                                                                                                                                          
  ● High effort ← → to adjust

  Use /fast to turn on Fast mode (Opus 4.6 only).

  Enter to confirm · Esc to exit

kessenma avatar May 03 '26 12:05 kessenma

you can see the existing models via running claude, then /model

ke@Kyles-MacBook-Pro-2 ws % claude
           Claude Code v2.1.114                                                                          
▗ ▗   ▖ ▖  Sonnet 4.6 with high effort · Claude Max                                                      
           ~/ws                                                                                          
  ▘▘ ▝▝    Welcome to Opus 4.7 xhigh! · /effort to tune speed vs. intelligence                           
                                                                                                         
❯ /model                                                                                                                                                                  
                                                                                                         
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Select model                                                                                                                                                          
  Switch between Claude models. Applies to this session and future Claude Code sessions. For other/previous model names, specify with --model.                            
                                                                                                                                                                          
    1. Default (recommended)  Opus 4.7 with 1M context · Most capable for complex work                                                                                    
  ❯ 2. Sonnet ✔               Sonnet 4.6 · Best for everyday tasks                                                                                                        
    3. Sonnet (1M context)    Sonnet 4.6 with 1M context · Billed as extra usage · $3/$15 per Mtok                                                                        
    4. Haiku                  Haiku 4.5 · Fastest for quick answers
                                                                                                                                                                          
  ● High effort ← → to adjust

  Use /fast to turn on Fast mode (Opus 4.6 only).

  Enter to confirm · Esc to exit

The idea of the ticket is to not use then interactive one and have a programmatic way of doing it.

MartinGonzalez avatar May 04 '26 01:05 MartinGonzalez