Skip to content

Commit 05a2844

Browse files
committed
feat: dynamic model registry + plan-aware grouping, release 1.3.0
Feat: dynamic models - Fetch live /provider/v1/models on refresh and merge with bundled list - Serve dynamic /v1/models endpoint (new models appear without a release) - Expanded registry 44 -> 52 models (Kimi-K3, Qwen 3.7 Flash, Gemini 3.6 Flash/3.5 Flash Lite, Inkling, Inkling Small, Laguna, Ling) Feat: plan-aware UI - Page 5 groups by plan access first, then Free/Billing, then provider - PlanAccess mirrors CLI evaluateModelAccess (go = open source + Luna/Grok, pro blocks Fable/Opus + Fugu, credits override) - Page 7 groups by plan (Available on Go vs Requires Pro/Max) - Cost sync result shows as status-bar notification Fix: keymap - o always copies OpenAI endpoint; clear-old moved to Shift+O Chore: release - Bump to 1.3.0 (package.json, pubspec.yaml, version.dart) - Sync CHANGELOG + docs
1 parent d22ac34 commit 05a2844

15 files changed

Lines changed: 746 additions & 127 deletions

AGENTS.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ commandcode-bridge/
3131
│ ├── main.dart # CLI wiring (run, run --server, cost-sync, help)
3232
│ ├── models/
3333
│ │ ├── account.dart # Account + config store (port persist)
34-
│ │ ├── models_db.dart # 44 models with goAccessible field
34+
│ │ ├── models_db.dart # 52 bundled models + PlanAccess rules
3535
│ │ └── version.dart # Bridge version constant
3636
│ ├── services/
37-
│ │ ├── api_client.dart # HTTP client for api.commandcode.ai
37+
│ │ ├── api_client.dart # HTTP client for api.commandcode.ai (incl. /provider/v1/models)
3838
│ │ ├── cost_sync.dart # Cost sync: detect agents, update configs
3939
│ │ ├── log_store.dart # JSONL activity log (2000 entries)
40-
│ │ ├── pricing_db.dart # Hardcoded pricing table (44 models)
40+
│ │ ├── pricing_db.dart # Hardcoded pricing table (52 models)
4141
│ │ └── updater.dart # Self-update: API cache + download .tgz + npm install -g
4242
│ ├── server/
4343
│ │ ├── server_controller.dart # HTTP server + routing
@@ -167,7 +167,7 @@ npm v11 has a bug installing global git deps: the install appears to succeed (`a
167167
| `/v1/chat/completions` | POST | OpenAI-compatible chat completions |
168168
| `/v1/messages` | POST | Anthropic-compatible Messages API |
169169
| `/messages` | POST | Anthropic-compatible Messages API (alt path) |
170-
| `/v1/models` | GET | List 44 available models |
170+
| `/v1/models` | GET | List available models (live API merged with bundled, 52+) |
171171
| `/v1/health` | GET | Health check |
172172
| `/v1/token` | GET | Get access token |
173173
| `/v1/info` | GET | Bridge info + config |
@@ -217,18 +217,34 @@ npm v11 has a bug installing global git deps: the install appears to succeed (`a
217217

218218
## Plan Access
219219

220-
Plan model access rules (from cli.mjs):
220+
Plan model access rules mirror the official Command Code CLI
221+
(`evaluateModelAccess` in `cli.mjs`). The bridge implements them in
222+
`PlanAccess` in `models_db.dart`:
221223

222-
| Plan | Allowed Categories | Blocked Premium Models |
223-
|------|-------------------|----------------------|
224-
| `individual-go` | opensource only | (all premium blocked) |
225-
| `individual-pro` | premium + opensource | claude-fable-5, claude-opus-5/4.8/4.7/4.6, sakana/fugu-ultra |
224+
| Plan | Allowed | Blocked |
225+
|------|---------|---------|
226+
| `individual-go` | open source + GPT-5.6 Luna, Grok 4.5, Qwen Max & Plus | all other premium |
227+
| `individual-pro` | premium + opensource | anthropic:claude-fable-5, claude-opus-5/4.8/4.7/4.6, vercel-ai-gateway:sakana/fugu-ultra |
226228
| `individual-provider` | premium + opensource | (none) |
227229
| `individual-max` | premium + opensource | (none) |
228230
| `individual-ultra` | premium + opensource | (none) |
229231
| `teams-pro` | premium + opensource | (none) |
230232

231-
Model list in TUI page 5 uses `_orderedModels` (sorted by plan). Go shows opensource first (green), premium dimmed (grey). Pro+ shows premium first.
233+
**Credits override:** `purchasedCredits > 0` or `freeCredits > 0` grants access
234+
to every model regardless of plan (matches the CLI).
235+
236+
Model list in TUI page 5 is rendered from the **live model list** (fetched from
237+
`/provider/v1/models` on refresh, merged with the 52 bundled `ModelsDb` models).
238+
All "available on your plan" models are grouped together at the top, then
239+
sub-grouped by usage (Free vs Billing) and by provider. Blocked premium models
240+
are listed below. Go shows accessible models first (green), blocked premium
241+
dimmed (grey). Pro+ shows all accessible first. `PlanAccess.isAccessible`
242+
drives the grouping and honors the credits override. `Enter` copies the
243+
highlighted model (same `_orderedModels` index used for rendering).
244+
245+
The bridge's own `/v1/models` endpoint also merges the live list so newly
246+
released models (e.g. `inclusionai/ling-3.0-flash-free`) are served without a
247+
bridge release.
232248

233249
## Port
234250

@@ -265,7 +281,7 @@ Copy triggers:
265281
| `2` | Plan & Billing | `/alpha/billing/subscriptions` + `/alpha/billing/credits` | Progress bars for period elapsed, credit usage, individual credit types |
266282
| `3` | Usage | `/alpha/usage/summary` | Success rate bar, input/output token bars, credit breakdown bars, cost |
267283
| `4` | Rate Limits | `/alpha/billing/credits` (windowLimits) | 5-hour and weekly usage bars with exceed warnings, remaining, reset times |
268-
| `5` | Models | `_orderedModels` (sorted by plan, 44 total) | Text list with copy-on-Enter |
284+
| `5` | Models | Live `/provider/v1/models` merged with 52 bundled models | Text list with copy-on-Enter |
269285
| `6` | Proxy Config | Bridge state + endpoints | Text info |
270286
| `7` | Cost Sync | Local config files | Detected agents, model list with pricing, sync status |
271287

@@ -292,7 +308,7 @@ Visualization uses `ProgressBar` from nocterm with color-coded fill:
292308
| `Ctrl+L` | Always | Toggle log sidebar |
293309
| `f` | Log open | Toggle log fullscreen / sidebar |
294310
| `Shift+C` | Log open | Clear all logs (with Y/N confirmation) |
295-
| `O` | Log open | Clear logs before today (with Y/N confirmation) |
311+
| `Shift+O` | Log open | Clear logs before today (with Y/N confirmation) |
296312
| `l` | Not auth'd | Open login instructions panel |
297313
| `Esc` | Sub-panels | Back to main |
298314

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## v1.3.0 (2026-08-02)
6+
7+
### Features
8+
9+
- Dynamic model list: bridge now fetches the live Command Code model catalog from `/provider/v1/models` on refresh and merges it with the bundled list, so newly released models (e.g. `inclusionai/ling-3.0-flash-free`, `poolside/laguna-s-2.1-free`) appear in `/v1/models` and the TUI without a bridge release
10+
- Served `/v1/models` endpoint is now dynamic too: it merges the live API list with the bundled registry, so OpenAI/Anthropic clients see newly released Command Code models immediately
11+
- TUI page 5 (Models): renders the live model list with correct per-plan access grouping (Go/Pro/Max + credits override), showing which models are actually usable on the user's plan
12+
- TUI page 5 (Models): all "available on your plan" models grouped together at the top, then sub-grouped by usage (Free usage vs Billing) and by provider (DeepSeek, Moonshot, ZAI, MiniMax, Xiaomi, Qwen, StepFun, Tencent, Nvidia, Thinking Machines, OpenAI, xAI, ...); Enter-to-copy stays in sync with the highlighted row
13+
- TUI page 7 (Cost): pricing grouped by plan access first (Available on Go vs Requires Pro/Max), not by opensource/premium; live-known models without local pricing are shown as "no pricing data" (yellow) instead of being hidden
14+
- TUI page 7 (Cost): sync result now appears as a status-bar notification (green on success, red on failure) instead of being rendered at the bottom of the page where it could go unnoticed
15+
- Plan access model mirrors the official CLI (`evaluateModelAccess`): Go = open source + `gpt-5.6-luna`, `xai/grok-4.5`; Pro blocks Fable/Opus + Fugu Ultra; credits override grants everything
16+
- Expanded bundled model registry from 44 to 52 models (added Kimi-K3, Qwen 3.7 Flash, Gemini 3.6 Flash, Gemini 3.5 Flash Lite, Inkling, Inkling Small, Laguna S 2.1, Ling 3.0 Flash)
17+
18+
### Fixes
19+
20+
- Keymap: `o` now always copies the OpenAI endpoint URL; "Clear entries before today" moved to `Shift+O` (previously `o` in the log panel cleared old logs instead of copying the endpoint)
21+
522
## v1.2.0 (2026-07-31)
623

724
### Features

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ APIs for use with OpenCode, Zed, Cursor, or any compatible client.
1414
- **OpenAI Compatible**`/v1/chat/completions` endpoint, streaming + non-streaming
1515
- **Anthropic Compatible**`/v1/messages` endpoint with full SSE streaming
1616
- **TUI Dashboard** — 7 info pages with progress bars and real-time log
17-
- **Plan-Aware** — Models sorted by plan access level
17+
- **Dynamic Models** — Fetches the live Command Code model catalog from `/provider/v1/models` on refresh, so newly released models appear automatically
18+
- **Plan-Aware** — Models grouped by what your plan can actually use (Go/Pro/Max + credits override)
1819
- **Cost Sync** — Sync Command Code model pricing to CLI agent configs (OpenCode, Aider, Goose)
1920
- **Port Config** — Change port via TUI with availability scan, persisted across restarts
2021
- **Cross-platform** — Linux (primary), macOS/Windows (experimental)
2122

2223
## Quick Install
2324

2425
```
25-
npm install -g ./commandcode-bridge-v1.2.0.tgz
26+
npm install -g ./commandcode-bridge-v1.3.0.tgz
2627
commandcode-bridge run
2728
```
2829

docs/API-REFERENCE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Base URL: `http://127.0.0.1:17077/v1`
99
| Path | Method | Description |
1010
|------|--------|-------------|
1111
| `/v1/chat/completions` | POST | Chat completions (stream + non-stream) |
12-
| `/v1/models` | GET | List 44 available models |
12+
| `/v1/models` | GET | List available models (live API merged with bundled, 52+) |
1313
| `/v1/health` | GET | Health check |
1414
| `/v1/token` | GET | Get current access token |
1515
| `/v1/info` | GET | Bridge info and config |

docs/ARCHITECTURE.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ commandcode-bridge/
2222
│ ├── main.dart # CLI wiring (TUI / server / cost-sync modes)
2323
│ ├── models/
2424
│ │ ├── account.dart # Account + config store (port persist)
25-
│ │ ├── models_db.dart # 44 models with plan access metadata
25+
│ │ ├── models_db.dart # 52 bundled models + plan access metadata
2626
│ │ └── version.dart # Bridge version constant
2727
│ ├── services/
28-
│ │ ├── api_client.dart # HTTP client for api.commandcode.ai
28+
│ │ ├── api_client.dart # HTTP client for api.commandcode.ai (incl. /provider/v1/models)
2929
│ │ ├── cost_sync.dart # Cost sync: detect agents, update configs
3030
│ │ ├── log_store.dart # JSONL activity log (2000 entries max)
31-
│ │ ├── pricing_db.dart # Hardcoded pricing table (44 models)
31+
│ │ ├── pricing_db.dart # Hardcoded pricing table (52 models)
3232
│ │ └── updater.dart # Self-update: API cache + download .tgz + npm install -g
3333
│ ├── server/
3434
│ │ ├── server_controller.dart # HTTP server, routing, shared endpoints
@@ -68,7 +68,7 @@ Client -> POST /v1/messages -> Same flow, Anthropic format
6868
The `cost-sync` CLI command and TUI page 7 keep CLI agent cost tracking in
6969
sync with Command Code pricing.
7070

71-
- `pricing_db.dart` holds a hardcoded pricing table (44 models) matching the
71+
- `pricing_db.dart` holds a hardcoded pricing table (52 models) matching the
7272
live bridge `/v1/models` API
7373
- `cost_sync.dart` detects installed CLI agents (OpenCode, Aider, Goose),
7474
reads each agent's configured models, and writes per-model cost fields
@@ -78,6 +78,23 @@ sync with Command Code pricing.
7878
- Pricing is validated against the live `/v1/models` endpoint before syncing
7979
- OpenCode configs (JSONC) are parsed with comment and trailing-comma support
8080

81+
## Dynamic Model List
82+
83+
The bridge does not rely solely on its bundled registry. On every TUI refresh
84+
(`[r]` or auto-refresh) it calls the official Command Code endpoint
85+
`GET /provider/v1/models`, caches the result in memory, and merges it with the
86+
52 bundled `ModelsDb` models. This means newly released models (for example
87+
`inclusionai/ling-3.0-flash-free`, `poolside/laguna-s-2.1-free`) are served by
88+
`/v1/models` and shown in the TUI without needing a bridge release.
89+
90+
- `api_client.fetchModels()` returns the live model list from the API
91+
- `ServerController.setLiveModelIds()` updates the in-memory cache used by `/v1/models`
92+
- Unknown live models are still proxyable and appear with `owned_by: command-code`
93+
- TUI page 5 groups models by plan access (Go/Pro/Max) using `PlanAccess`, which
94+
mirrors the official CLI's `evaluateModelAccess`: Go = open source + GPT-5.6
95+
Luna / Grok 4.5, Pro blocks Fable/Opus + Fugu Ultra, and a credits override
96+
(purchased or free credits) grants access to everything
97+
8198
## Protocol Translation
8299

83100
### OpenAI Compatible

docs/TUI.md

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
| `2` | Plan & Billing | `/alpha/billing/subscriptions` + credits | Progress bars for billing period, credit usage |
99
| `3` | Usage | `/alpha/usage/summary` | Success rate bar, token bars, cost breakdown |
1010
| `4` | Rate Limits | `/alpha/billing/credits` | 5-hour and weekly usage bars with exceed warnings |
11-
| `5` | Models | 44 models sorted by plan access | Scrollable list, Enter to copy codename |
11+
| `5` | Models | Live API + 52 bundled models, sorted by plan access | Scrollable list, Enter to copy codename |
1212
| `6` | Proxy Config | Bridge state | Port, API URL, endpoints, uptime |
1313
| `7` | Cost Sync | Local CLI agent configs | Detected agents, provider list, model pricing, sync status |
1414

@@ -31,7 +31,7 @@
3131
| `Ctrl+L` | Always | Toggle log sidebar |
3232
| `f` | Log open | Toggle log fullscreen / sidebar |
3333
| `Shift+C` | Log open | Clear all logs (with Y/N confirmation) |
34-
| `O` | Log open | Clear old entries (with Y/N confirmation) |
34+
| `Shift+O` | Log open | Clear old entries (with Y/N confirmation) |
3535
| `l` | Not authenticated | Open login instructions |
3636

3737
## Status Notifications
@@ -56,28 +56,52 @@ The switch is logged and the running port is shown in the header.
5656

5757
## Plan Access
5858

59-
Models in page 5 are prioritized by your plan:
59+
Page 5 renders the **live model list** (fetched from `/provider/v1/models` on
60+
refresh, merged with 52 bundled models) and groups models by what your plan can
61+
actually use. Rules mirror the official Command Code CLI:
6062

61-
| Plan | Sort Order | Accessible |
62-
|------|-----------|------------|
63-
| individual-go | Opensource first (green), Premium dimmed | Opensource only |
64-
| individual-pro | Premium first | Premium + opensource (blocked: top Claude + Fugu) |
65-
| individual-max | Premium first | All models |
66-
| individual-ultra | Premium first | All models |
67-
| teams-pro | Premium first | All models |
63+
| Plan | Accessible |
64+
|------|-----------|
65+
| individual-go | Open source models + GPT-5.6 Luna, Grok 4.5, Qwen Max & Plus |
66+
| individual-pro | Premium + opensource, blocked: Claude Fable 5, Opus 5/4.8/4.7/4.6, Fugu Ultra |
67+
| individual-provider / max / ultra / teams-pro | All models |
68+
69+
**Credits override:** if you have purchased or free credits
70+
(`purchasedCredits > 0` or `freeCredits > 0`), every model becomes accessible
71+
regardless of plan.
72+
73+
### Page 5 Layout
74+
75+
Models are grouped top-level by plan access first (all "available on your
76+
plan" models together at the top), then:
77+
78+
1. **Usage:** free models (`Free usage`) before billed models (`Billing`)
79+
2. **Provider:** within Billing, sub-grouped by provider (DeepSeek, Moonshot,
80+
ZAI, MiniMax, Xiaomi, Qwen, StepFun, Tencent, Nvidia, Thinking Machines,
81+
OpenAI, xAI, ...)
82+
83+
Blocked premium models are listed below under their own header. Use `up/down`
84+
to select a model and `Enter` to copy its ID; the copy always matches the
85+
highlighted row.
6886

6987
### Go Plan Accessible Models
7088

89+
Open source models plus the premium exceptions included on Go:
90+
GPT-5.6 Luna, Grok 4.5, and Qwen Max & Plus. The rest of the premium lineup
91+
(Claude, other GPT, Gemini, Muse Spark) is blocked on Go.
92+
7193
- DeepSeek V4 Pro, DeepSeek V4 Flash
94+
- Kimi K3, K2.7 Code, K2.7 Code HighSpeed, K2.6, K2.5
7295
- MiniMax M3 Free, M3, M2.7, M2.5
73-
- Kimi K2.7 Code, K2.6, K2.5
74-
- Qwen 3.7 Max/Plus, 3.6 Max Preview/Plus
96+
- Qwen 3.7 Max/Plus/Flash, 3.6 Max Preview/Plus
7597
- GLM 5.2, 5.2 Fast, 5.1, 5
7698
- MiMo V2.5 Pro, V2.5
7799
- Step 3.7 Flash, 3.5 Flash
78100
- Tencent HY3 Paid, HY3
79-
- Meta Muse Spark 1.1
101+
- Thinking Machines Inkling, Inkling Small
102+
- Poolside Laguna S 2.1 Free (Free usage), InclusionAI Ling 3.0 Flash Free (Free usage)
80103
- Nvidia Nemotron 3 Ultra
104+
- GPT-5.6 Luna, Grok 4.5
81105

82106
## Cost Sync (Page 7)
83107

@@ -86,11 +110,17 @@ agent-side cost tracking shows real per-token rates.
86110

87111
- `[7]` opens the Cost Sync page
88112
- `[c]` syncs pricing for the selected agent (hint shown on the page)
113+
- Sync progress and result appear as a status-bar notification: green on success
114+
(e.g. "Cost sync OpenCode: 5 updated, 2 already configured"), red if any
115+
models failed, so the result is always visible without scrolling the page
89116
- `[up/down]` selects the agent (OpenCode, Aider, Goose)
90117
- Detected agents are listed with their config paths
91118
- Bridge providers are listed by name and endpoint, for example
92119
`Khip01 - Command Code (Go Plan) [127.0.0.1:17077]`
93-
- All Command Code models with pricing are shown, grouped by Open Source and Premium
120+
- All Command Code models with pricing are shown, grouped by plan access first
121+
("Available on Go" / "Requires Pro / Max", or "Available on your plan" /
122+
"Blocked on your plan" for other plans)
123+
- Live-known models without local pricing data appear as "no pricing data" (yellow)
94124
- Models in your config appear bright white with "(will be implemented)"
95125
- Models not in your config are greyed out
96126
- Pricing is validated against the live bridge `/v1/models` before syncing

0 commit comments

Comments
 (0)