Skip to content

Feature Request: API endpoint for provider and model metadata #733

@RickeyRen

Description

@RickeyRen

Problem

Third-party clients (mobile apps, CLI wrappers, etc.) that connect to CloudCLI need to display provider and model selection UI. Currently, the only way to get model data is:

  1. The /model command via /api/commands/execute — but it only returns model values (no labels), is missing Gemini, and doesn't return default models.
  2. Hardcoding the same data from shared/modelConstants.js — which goes out of sync on every CloudCLI update.

The WebUI doesn't have this problem because it bundles shared/modelConstants.js at build time. External clients don't have that luxury.

Proposed Solution

Add a GET /api/providers/models endpoint that returns the PROVIDERS registry already defined in shared/modelConstants.js:

// In server/modules/providers/provider.routes.ts (or server/routes/)
import { PROVIDERS } from '../../shared/modelConstants.js';

router.get('/models', authenticateToken, (req, res) => {
  res.json({ success: true, data: PROVIDERS });
});

Expected Response

{
  "success": true,
  "data": [
    {
      "id": "claude",
      "name": "Anthropic",
      "models": {
        "OPTIONS": [
          { "value": "opus", "label": "Opus" },
          { "value": "sonnet", "label": "Sonnet" },
          { "value": "haiku", "label": "Haiku" }
        ],
        "DEFAULT": "opus"
      }
    },
    {
      "id": "codex",
      "name": "OpenAI",
      "models": {
        "OPTIONS": [...],
        "DEFAULT": "gpt-5.4"
      }
    },
    {
      "id": "gemini",
      "name": "Google",
      "models": {
        "OPTIONS": [...],
        "DEFAULT": "gemini-3.1-pro-preview"
      }
    },
    {
      "id": "cursor",
      "name": "Cursor",
      "models": {
        "OPTIONS": [...],
        "DEFAULT": "gpt-5.3-codex"
      }
    }
  ]
}

Why This Matters

Without this endpoint, every external client must duplicate and manually maintain the model list from shared/modelConstants.js. When CloudCLI adds or removes models, all clients break silently — for example, a client might assume the default Claude model is "sonnet" while the backend defaults to "opus", causing model selection to be silently ignored.

Implementation Notes

  • The data already exists in shared/modelConstants.js as the PROVIDERS export — this is just exposing it via HTTP.
  • Should be ~5 lines of code.
  • Consistent with the existing /api/providers/:provider/auth/status pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions