feat: dynamic model discovery from /v1/models endpoint #1

Closed
opened 2026-05-27 23:16:56 -04:00 by zgaetano · 0 comments
Owner

Problem

The model picker in cloudcli is hardcoded in shared/modelConstants.js. When using a proxy endpoint like 9Router (ANTHROPIC_BASE_URL), the UI only shows the 3 hardcoded Claude models (2 Sonnets, 1 Haiku) even though the endpoint exposes 90+ models across multiple providers.

Available models (as of 2026-05-27)

Our 9Router endpoint (https://ollama.wilddragon.net/v1) returns the following from GET /v1/models:

Prefix Provider Examples
cc/ Claude Code direct claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5
kr/ Kiro claude-sonnet-4.5-thinking, qwen3-coder-next, deepseek-3.2, glm-5
cl/ Cline claude-opus-4.7, gpt-5.4, gemini-3.1-pro-preview
cx/ Cursor gpt-5.5, gpt-5.4, gpt-5.3-codex
ds/ DeepSeek deepseek-v4-pro, deepseek-v4-flash, deepseek-reasoner
gemini/ Gemini gemini-3.1-pro-preview, gemini-3-flash-preview
ollama/ Local Ollama kimi-k2.5, qwen3.5, gpt-oss:120b
nvidia/ NVIDIA deepseek-v4-flash, kimi-k2.6
mistral/ Mistral mistral-large-latest, codestral-latest
jinx/ Kiro/Jinx kiro-auto, kiro-claude-sonnet-4-5-agentic
ag/ Agere gemini-3.1-pro-high, claude-opus-4-6-thinking

Proposed solution

When ANTHROPIC_BASE_URL is set, fetch available models dynamically at startup (or on-demand) from ${ANTHROPIC_BASE_URL}/models and populate the model picker from the response instead of (or in addition to) the hardcoded list.

Files to touch:

  • shared/modelConstants.js — make constants a fallback, not the only source
  • server/routes/ — add a GET /api/models endpoint that proxies /v1/models from the configured base URL
  • Frontend model picker component — fetch from /api/models when available, fall back to hardcoded list

Workaround

Until this is implemented, model can be overridden via env var:

ANTHROPIC_MODEL=cc/claude-opus-4-7 claude ...
## Problem The model picker in cloudcli is hardcoded in `shared/modelConstants.js`. When using a proxy endpoint like 9Router (`ANTHROPIC_BASE_URL`), the UI only shows the 3 hardcoded Claude models (2 Sonnets, 1 Haiku) even though the endpoint exposes 90+ models across multiple providers. ## Available models (as of 2026-05-27) Our 9Router endpoint (`https://ollama.wilddragon.net/v1`) returns the following from `GET /v1/models`: | Prefix | Provider | Examples | |--------|----------|---------| | `cc/` | Claude Code direct | `claude-opus-4-7`, `claude-sonnet-4-6`, `claude-haiku-4-5` | | `kr/` | Kiro | `claude-sonnet-4.5-thinking`, `qwen3-coder-next`, `deepseek-3.2`, `glm-5` | | `cl/` | Cline | `claude-opus-4.7`, `gpt-5.4`, `gemini-3.1-pro-preview` | | `cx/` | Cursor | `gpt-5.5`, `gpt-5.4`, `gpt-5.3-codex` | | `ds/` | DeepSeek | `deepseek-v4-pro`, `deepseek-v4-flash`, `deepseek-reasoner` | | `gemini/` | Gemini | `gemini-3.1-pro-preview`, `gemini-3-flash-preview` | | `ollama/` | Local Ollama | `kimi-k2.5`, `qwen3.5`, `gpt-oss:120b` | | `nvidia/` | NVIDIA | `deepseek-v4-flash`, `kimi-k2.6` | | `mistral/` | Mistral | `mistral-large-latest`, `codestral-latest` | | `jinx/` | Kiro/Jinx | `kiro-auto`, `kiro-claude-sonnet-4-5-agentic` | | `ag/` | Agere | `gemini-3.1-pro-high`, `claude-opus-4-6-thinking` | ## Proposed solution When `ANTHROPIC_BASE_URL` is set, fetch available models dynamically at startup (or on-demand) from `${ANTHROPIC_BASE_URL}/models` and populate the model picker from the response instead of (or in addition to) the hardcoded list. **Files to touch:** - `shared/modelConstants.js` — make constants a fallback, not the only source - `server/routes/` — add a `GET /api/models` endpoint that proxies `/v1/models` from the configured base URL - Frontend model picker component — fetch from `/api/models` when available, fall back to hardcoded list ## Workaround Until this is implemented, model can be overridden via env var: ```bash ANTHROPIC_MODEL=cc/claude-opus-4-7 claude ... ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: WildDragonLLC/claudecodeui#1
No description provided.