feat(models): tech preview – openclaw models sync openrouter

Adds opt-in CLI command to fetch OpenRouter /models catalog and write
matching model definitions into models.json. Shared parsing extracted
into openrouter-catalog.ts to avoid duplication with model-scan.

Draft POC – do not merge.
This commit is contained in:
Josh Palmer
2026-02-03 00:26:46 +01:00
parent c83bdb73a4
commit 35b6ae3984
7 changed files with 618 additions and 189 deletions

View File

@@ -22,6 +22,7 @@ openclaw models status
openclaw models list
openclaw models set <model-or-alias>
openclaw models scan
openclaw models sync openrouter
```
`openclaw models status` shows the resolved default/fallbacks plus an auth overview.
@@ -54,6 +55,18 @@ Options:
- `--probe-max-tokens <n>`
- `--agent <id>` (configured agent id; overrides `OPENCLAW_AGENT_DIR`/`PI_CODING_AGENT_DIR`)
### `models sync openrouter`
Fetches the OpenRouter `/models` catalog and writes it to the agent `models.json`
file (under `OPENCLAW_AGENT_DIR`/`PI_CODING_AGENT_DIR`, or the default agent path).
Restart the gateway after syncing so `/model` and the picker reload the catalog.
Options:
- `--free-only` (only include free models)
- `--provider <name>` (filter by provider prefix)
- `--json` (machine-readable output)
## Aliases + fallbacks
```bash