Skip to content

Gateway/config: add models.pricing.enabled to skip pricing bootstrap#68651

Open
palewire wants to merge 7 commits intoopenclaw:mainfrom
palewire:copilot/add-config-option-disable-model-pricing-bootstrap
Open

Gateway/config: add models.pricing.enabled to skip pricing bootstrap#68651
palewire wants to merge 7 commits intoopenclaw:mainfrom
palewire:copilot/add-config-option-disable-model-pricing-bootstrap

Conversation

@palewire
Copy link
Copy Markdown

Summary

  • Problem: The model-pricing bootstrap fetches live per-token costs from OpenRouter on every gateway startup, causing a ~30 second timeout on networks that cannot reach the pricing endpoint.
  • Why it matters: Users with limited network egress, offline setups, or restricted providers experience unnecessary startup delays with no way to disable the fetch.
  • What changed: Added models.pricing.enabled config boolean (default true) that, when false, skips the bootstrap entirely with a single log line.
  • What did NOT change: Default behavior is unchanged. The pricing data structure, provider cost blocks, model catalog shape, and refresh logic are untouched.

Closes #53639

Files changed

  • src/config/types.models.ts — Add ModelPricingConfig type and pricing field to ModelsConfig
  • src/config/zod-schema.core.ts — Add ModelPricingConfigSchema to the zod validation
  • src/config/schema.help.ts — Add help text for models.pricing and models.pricing.enabled
  • src/config/schema.labels.ts — Add labels for the new config keys
  • src/gateway/model-pricing-cache.ts — Check config.models?.pricing?.enabled and skip bootstrap when false
  • src/gateway/model-pricing-cache.test.ts — Add 3 tests for default, enabled, and disabled behavior
  • docs/gateway/configuration-reference.md — Document the new field
  • CHANGELOG.md — Add entry
  • src/config/schema.base.generated.ts — Regenerated
  • docs/.generated/config-baseline.sha256 — Updated hash

@openclaw-barnacle openclaw-barnacle bot added docs Improvements or additions to documentation gateway Gateway runtime size: S labels Apr 18, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 18, 2026

Greptile Summary

Adds models.pricing.enabled (default true) to let users skip the OpenRouter pricing bootstrap fetch on gateway startup. The implementation touches config types, Zod schema, generated baseline, help/label metadata, the gateway bootstrap function, and documentation — all consistent with each other. Default behavior is unchanged.

Confidence Score: 5/5

Safe to merge; the only finding is a P2 changelog placement style issue.

All changed surfaces (type, schema, generated baseline, gateway logic, tests) are consistent and correct. The === false gate is intentionally strict so absent/true config falls through to the existing bootstrap path. The single finding is a changelog ordering convention violation, which is non-blocking.

CHANGELOG.md — new entry placed at the top of ### Changes instead of appended at the end per project convention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: CHANGELOG.md
Line: 9

Comment:
**Changelog entry inserted at top of section**

Per the project's changelog placement rule, new entries should be appended to the **end** of the target section (`### Changes` or `### Fixes`), not inserted at the top. This entry appears before the three pre-existing lines in the `### Changes` block.

```suggestion
- Anthropic/models: add Claude Opus 4.7 `xhigh` reasoning effort support and keep it separate from adaptive thinking.
- Control UI/settings: overhaul the settings and slash-command experience with faster presets, quick-create flows, and refreshed command discovery. (#67819) Thanks @BunsDev.
- macOS/gateway: add `screen.snapshot` support for macOS app nodes, including runtime plumbing, default macOS allowlisting, and docs for monitor preview flows. (#67954) Thanks @BunsDev.
- Gateway/config: add `models.pricing.enabled` config option to disable the model-pricing bootstrap fetch, avoiding a ~30 s timeout on networks that cannot reach the pricing endpoint. Fixes #53639.
```

**Context Used:** CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Update config baseline hash for models.p..." | Re-trigger Greptile

Comment thread CHANGELOG.md Outdated
@palewire
Copy link
Copy Markdown
Author

I believe I've resolved the conflicts with the main branch and this is again ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] model-pricing-cache: TimeoutError on OpenRouter models

2 participants