Skip to content

Commit 1190c68

Browse files
stainluclaude
andcommitted
fix: inject missing models from provider-prices.json into catalog
Models released after the pinned OpenClaw version (e.g. kimi-k2.6) exist in provider-prices.json but not in the bundled catalog. The price-override pass only patched existing entries, so new models reported $0 cost. Now injects missing models as minimal catalog entries with the correct cost block, so cost accounting works for any model listed in provider-prices.json regardless of catalog age. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent abf45a4 commit 1190c68

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

docker/apply-provider-config.mjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,29 @@ if (overrides && overrides[providerId] && Array.isArray(providerConfig.models))
153153
`[apply-provider-config] applied price overrides to ${patched} ${providerId} model(s) from provider-prices.json\n`,
154154
);
155155
}
156+
// Inject models that exist in the price table but not yet in the
157+
// bundled catalog (e.g. kimi-k2.6 released after the pinned openclaw
158+
// version). Without this, new models work at runtime but report $0.
159+
const knownIds = new Set(providerConfig.models.map((m) => m.id));
160+
let injected = 0;
161+
for (const [modelId, row] of Object.entries(table)) {
162+
if (knownIds.has(modelId)) continue;
163+
providerConfig.models.push({
164+
id: modelId,
165+
cost: {
166+
input: row.input ?? 0,
167+
output: row.output ?? 0,
168+
cacheRead: row.cacheRead ?? 0,
169+
cacheWrite: row.cacheWrite ?? 0,
170+
},
171+
});
172+
injected++;
173+
}
174+
if (injected > 0) {
175+
process.stdout.write(
176+
`[apply-provider-config] injected ${injected} missing ${providerId} model(s) from provider-prices.json\n`,
177+
);
178+
}
156179
}
157180

158181
writeFileSync(configPath, JSON.stringify(cfg, null, 2), "utf8");

0 commit comments

Comments
 (0)