|
|
1 ماه پیش | |
|---|---|---|
| model_selector | 1 ماه پیش | |
| tests | 1 ماه پیش | |
| .codex | 1 ماه پیش | |
| .env.example | 1 ماه پیش | |
| .gitignore | 1 ماه پیش | |
| AGENTS.md | 1 ماه پیش | |
| README.md | 1 ماه پیش | |
| killserver.sh | 2 ماه پیش | |
| requirements.txt | 1 ماه پیش | |
| restart.sh | 2 ماه پیش | |
| run.sh | 2 ماه پیش | |
| tests.sh | 1 ماه پیش |
FastAPI dashboard for browsing and editing the model/provider config in ~/.openclaw/openclaw.json.
It is intentionally small:
/home/lucky/.openclaw/openclaw.jsondata/model-cache/agents.defaults.models.<provider/model>.alias3300—, rather than guessingmodel_selector/main.py - FastAPI app and API routesmodel_selector/config.py - canonical config read/write logicmodel_selector/providers.py - provider adapters and config serializationmodel_selector/service.py - dashboard state assemblymodel_selector/cache.py - local JSON snapshot cacherun.sh - start the appkillserver.sh - clear stale listeners on port 3300restart.sh - kill then starttests.sh - run the test suite# Create a local virtualenv and install dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Configure API keys if you want live provider catalogs
cp .env.example .env
# Start the dashboard
./run.sh
Open http://localhost:3300.
The app reads these environment variables:
| Variable | Default | Purpose |
|---|---|---|
OPENCLAW_CONFIG_PATH |
/home/lucky/.openclaw/openclaw.json |
Canonical config file |
MODEL_SELECTOR_PORT |
3300 |
Web server port |
MODEL_SELECTOR_HOST |
0.0.0.0 |
Bind host |
MODEL_SELECTOR_REFRESH_INTERVAL |
1800 |
Live provider refresh interval, in seconds |
MODEL_SELECTOR_CACHE_DIR |
data/model-cache |
Local JSON snapshot directory |
OPENAI_API_KEY |
unset | OpenAI live catalog access |
GROQ_API_KEY |
unset | Groq live catalog access |
OPENROUTER_API_KEY |
unset | OpenRouter live catalog access |
The config schema is intentionally narrow:
{
"models": {
"providers": {
"openai": {
"models": [
{
"id": "gpt-4o",
"name": "GPT-4o",
"reasoning": false,
"input": ["text"],
"contextWindow": 128000,
"maxTokens": 16000
}
]
}
}
},
"agents": {
"defaults": {
"models": {
"openai/gpt-4o": {
"alias": "my-favorite"
}
}
}
}
}
GET / - dashboard UIGET /api/state - full dashboard stateGET /api/config - config path and configured modelsPOST /api/alias - update alias for a configured modelPOST /api/config/models/add - add a provider model to configPOST /api/config/models/delete - remove a configured modelPOST /api/refresh - force a live provider refreshUse the repo-local test runner:
bash tests.sh
That script uses .venv when present and falls back to python3 -m pytest -q if not.
The tests use temporary config fixtures and do not touch the live ~/.openclaw/openclaw.json.
data/model-cache/ are local-only and ignored by git.