Detect provider models, deduplicate them, remove unusable ones, register missing models into OpenClaw, and safely keep provider-native model ids/names during...
--- name: model-registry-manager description: "Detect provider models, deduplicate them, remove unusable ones, register missing models into OpenClaw, and safely keep provider-native model ids/names during model catalog sync." version: 1.3.0 --- # Model Registry Manager Use this skill when managing OpenClaw model catalogs and provider model sync for any provider. ## What this skill covers - Fetch provider model lists from the upstream `/models` endpoint - Deduplicate returned models by provider-native model id - Probe models and remove unusable ones from the registered catalog - Register newly discovered usable models into OpenClaw config - Keep provider-native ids and names instead of inventing renamed keys - Validate the registry before enabling scheduled sync jobs ## Required workflow ### 1. Inspect config/schema first Before changing config, inspect relevant config paths and read current config. Usually inspect: - `agents.defaults.model` - `agents.defaults.models` - `models.providers` ### 2. Detect before writing Always fetch remote models first and compare with current config. Do not write first when the state is unknown. ### 3. Keep provider-native ids/names - Use the provider-returned model `id` as the canonical registry id suffix - Use the provider-returned model `name` when available - Do not normalize ids into a different slug format unless OpenClaw requires it ### 4. Validate before keeping A model is only eligible for registration if it passes a lightweight probe. If probing fails, treat it as unusable and exclude it from the registered catalog. ### 5. Do not auto-select primary/fallbacks This skill should not automatically choose or rebuild primary/fallback chains. During sync: - keep provider model discovery, deduplication, probing, and registration focused on the catalog itself - do not introduce heuristic primary selection here - do not introduce heuristic fallback selection here - if model routing policy is needed, manage it outside this skill ### 6. Do not bundle generic failover policy here This skill should not define generic failover classes, retry ladders, downgrade policy, or circuit-breaker defaults. Keep this skill focused on model registry sync and validation. ### 7. Schedule only after one clean run First complete: - one successful sync run - one successful validation run - one confirmation that primary/fallback settings are correct Then you may add scheduled refresh jobs. ### 8. Default closing step: maintain the learnings archive After finishing real work, check whether the run produced reusable operational knowledge. Default behavior: - if the user corrected you, add the correction to `.learnings/` - if you debugged a failure, add the cause/fix to `.learnings/` - if you found a better generic strategy, add it to `.learnings/` - if you needed multiple attempts and eventually found a reliable path, add that successful path to `.learnings/` - do not wait for the user to remind you This is part of the skill’s normal operating procedure, not an optional extra. ## Validation checklist - fetched remote model list successfully - deduplicated duplicate remote ids - excluded unusable models - registered usable models - gateway/service still healthy after config update ## How to make this skill truly general-purpose To keep this skill generic instead of overfitting to one provider/model family: ### Keep generic - provider-native ids and names - provider model discovery and probe validation - per-provider sync + global catalog merge ### Avoid hardcoding - exact vendor model ids as permanent rules - one provider’s naming quirks as universal truth - one-off emergency fixes in the main sync algorithm - model routing policy into registry sync ### Prefer this structure - `SKILL.md`: only workflow + decision rules - `scripts/`: deterministic sync/validate logic ## Scheduling policy for this workspace After installation is validated, schedule these triggers: - startup/heartbeat safety net - recurring sync every 6 hours Keep scheduled runs idempotent and safe to repeat. ## Setup In an OpenClaw agent session, prefer the built-in `cron` tool instead of shelling out to `openclaw cron ...`. After one clean validation run, ensure these recurring jobs exist (create missing ones, update same-name jobs if they already exist): - `model-registry-manager validation safety-net` - `model-registry-manager recurring sync` Recommended default schedules (Asia/Shanghai): - validation safety-net: `10 4 * * *` - recurring sync: `40 */6 * * *` Recommended job shape: - `sessionTarget: "isolated"` - `payload.kind: "agentTurn"` - `payload.toolsAllow: ["exec", "read"]` - `delivery.mode: "none"` - failure alert enabled after 1 failure Recommended task behavior: - validation job runs `node skills/model-registry-manager/scripts/validate-model-sync.js` - recurring sync runs `node skills/model-registry-manager/scripts/sync-models.js all 0 --restart` - each job should read the latest report under `reports/model-registry/` and produce a concise summary Do not enable recurring sync before a clean validation run.
don't have the plugin yet? install it then click "run inline in claude" again.
added explicit inputs (provider endpoints, auth, config paths, probe script), detailed 8-step procedure with inputs/outputs, edge cases for network timeouts and probe failures, decision points for empty results and health check failures, output contract with report schema and learnings archival, outcome signal checklist for verification.
Use this skill when syncing provider model catalogs into OpenClaw, validating model health, and keeping your registry in sync with upstream changes. The skill detects new models from provider /models endpoints, deduplicates by provider-native id, probes for usability, registers passing models into config, and maintains an audit trail of changes. Run this before enabling scheduled syncs, and re-run it whenever a provider adds/removes models or your config drifts.
Provider model endpoint
{provider_base_url}/models returning JSON array with id, name, capabilities, context_window, etc.OpenClaw config paths
agents.defaults.model (current primary model)agents.defaults.models (fallback chain, if present)models.providers (provider-native model registry)config/agents.yml or equivalent in your workspaceProvider credentials (if needed)
PROVIDER_API_KEY (bearer token format)/models endpointProbe validation script
scripts/probe-model.js or equivalent{provider, model_id, endpoint, auth_token}{status: "pass"|"fail", reason, latency_ms}Workspace learnings archive
.learnings/ directoryStep 1: Inspect current config state
config/agents.ymlagents.defaults.model, agents.defaults.models, and models.providers sectionsStep 2: Fetch remote model list
{provider_base_url, auth_token (optional)}{provider_base_url}/models; parse JSON response as array{id, name, ...}Step 3: Deduplicate by provider-native id
id field; if duplicates exist, keep first occurrence (stable sort by list order), discard restStep 4: Probe each remote model for usability
{provider, model_id: id, endpoint, auth_token}; collect probe response{usable_models: [...], unusable_models: [{model_id, reason, ...}, ...]}Step 5: Cross-reference usable models with current config
models.providers[provider][model.id] exists in config; split into new_models (not in config) and existing_models (already registered){new_models: [...], existing_models: [...], retired_models: [...]}Step 6: Register new usable models
new_models list from step 5, current configmodels.providers[provider][model.id] with keys id (provider-native), name (provider-native), capabilities, context_window, etc.; preserve all provider-returned fieldsid and name as-is; do not normalize, slug, or rename unless OpenClaw schema explicitly requires itStep 7: Validate gateway/service health
/health on gateway){healthy: true/false, response_code, latency_ms}Step 8: Commit config and archive learnings
config/agents.yml; create or append to .learnings/{date}-model-sync-{provider}.md with: models added, models probed, count of failures, any corrections or debugging notes discovered during this runIf remote model list is empty (step 2 output):
If all models fail probe (step 4 output):
If new models exist but gateway health fails (step 7):
If config file is missing (step 1):
If probe script is missing (step 4):
If model name conflicts with existing provider (step 6):
If user has corrected you or you debugged a multi-attempt fix (step 8):
.learnings/ file as mandatory next stepConfig file
config/agents.ymlmodels.providers[{provider}][{model_id}] entries{id, name, capabilities, context_window, ...} from providerSync report
reports/model-registry/{date}-{provider}-sync.jsontimestamp (ISO 8601)provider (string)remote_model_count (int, before dedup)deduplicated_count (int, after dedup)usable_count (int, passed probe)new_registered (int, added to config)retired_flagged (int, no longer in remote or failed probe)gateway_health (true/false)config_committed (true/false)errors (array of error strings, if any)Learnings archive
.learnings/{date}-model-sync-{provider}.mdThe skill worked if:
config_committed: true - config was safely written and validatedconfig/agents.yml and confirm new models.providers[{provider}][{id}] entries with provider-native names intacterrors or retired_flagged, not silently skippedRun the skill again if:
config_committed: falseerrors arrayBefore enabling scheduled syncs (cron jobs), you must complete one full run with config_committed: true and gateway_health: true, then manually verify that agents.defaults.model and agents.defaults.models are correctly set for your use case. Primary/fallback selection is out of scope for this skill; manage routing policy separately.