Skip to content

[BUG] models provider filter ignored when provider is placed before list command #1687

@DanielDerefaka

Description

@DanielDerefaka

Project

cortex

Description

The help text shows cortex models [PROVIDER] [COMMAND], implying cortex models openai list should filter to OpenAI models. Instead, it returns the full unfiltered list (starting with Anthropic). The provider filter only works when the provider is placed after list.

Error Message

N/A (command succeeds)

Debug Logs

N/A

System Information

- macOS 26.2 (25C56)
- cortex 0.1.1

Screenshots

No response

Steps to Reproduce

  1. Run the command in the order suggested by the usage string (provider first, command second), twice:
$ cortex models openai list --json | head -n 8; echo EXIT:$?
[
  {
    "id": "claude-sonnet-4-20250514",
    "name": "Claude Sonnet 4",
    "provider": "anthropic",
    "capabilities": {
      "vision": true,
      "tools": true,
EXIT:0

$ cortex models openai list --json | head -n 8; echo EXIT:$?
[
  {
    "id": "claude-sonnet-4-20250514",
    "name": "Claude Sonnet 4",
    "provider": "anthropic",
    "capabilities": {
      "vision": true,
      "tools": true,
EXIT:0
  1. Compare with provider after the list command:
$ cortex models list openai --json | head -n 6
[
  {
    "id": "gpt-4o",
    "name": "GPT-4o",
    "provider": "openai",
    "capabilities": {

Expected Behavior

cortex models openai list should filter to OpenAI models per the documented argument order.

Actual Behavior

The provider filter is ignored when the provider is placed before list, and the full model list is returned.

Additional Context

The current argument parsing only applies the provider filter when the provider appears after the list subcommand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingideIssues related to IDEinvalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions