Skip to content

Commit 8affd61

Browse files
authored
fix(models): refresh Chutes and Cerebras price estimates (#134311)
* fix(models): refresh Chutes and Cerebras native pricing Use owner-native advertised rates without pinning generated model costs during merge-mode setup. Preserve metadata when native prices disappear, reject malformed feeds, and keep explicit user rates intact. Fixes #134248. * chore: clean up pricing tests and isolated landing workflow Remove unused Chutes fake-timer plumbing. Select a complete, writable landing checkout before native review and preserve generated review identity stamps without weakening isolation or merge guards.
1 parent ca0bdb8 commit 8affd61

31 files changed

Lines changed: 1072 additions & 342 deletions

‎.agents/skills/openclaw-pr-maintainer/SKILL.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,41 @@ gh search issues --repo openclaw/openclaw --match title,body --limit 50 \
330330
--jq '.[] | "\(.number) | \(.state) | \(.title) | \(.url)"'
331331
```
332332

333+
## Choose a writable landing checkout
334+
335+
Before `review-init`, compare the editor's writable workspace with the Git
336+
common-directory parent. `scripts/pr` intentionally creates its worktree at
337+
`<canonical-repo>/.worktrees/pr-<PR>`; running it from a linked checkout does not
338+
put review artifacts under that caller. Shell access or a directory grant alone
339+
may not make those artifacts editable in an isolated session.
340+
341+
When the canonical PR worktree lies outside the permitted workspace, start from
342+
a fresh ordinary checkout **inside** that workspace. Use the verified repository
343+
URL and normal Git, not another linked worktree pointing at the same outside
344+
common directory. Keep full history and blobs: shallow history breaks provenance
345+
checks, and blob filters can turn journaled historical restores into serial
346+
network fetches.
347+
348+
```bash
349+
git clone --single-branch <verified-repository-url> <permitted-workspace>/landing-checkout
350+
```
351+
352+
Verify its origin and Git root, then use that checkout's trusted `main` wrapper
353+
for the unchanged review/prepare/merge sequence. Its native PR worktrees now stay
354+
inside the permitted tree. Initialize review templates and verify editor access
355+
before investing in proof. Preserve the original checkout and unique work; never
356+
use symlinks, shell-mediated writes to denied paths, or weaker isolation flags.
357+
358+
This is fresh workspace selection, not recovery: if another checkout has an
359+
active operation, uncertain merge capture/outcome, or pending auto/queue request
360+
for this PR, reconcile that original state first. Never clone away retained evidence or retry
361+
an uncertain dispatch from a new repository's independent lock/ref namespace.
362+
363+
Keep the generated first line of `review.md` byte-for-byte, and keep `review.json`
364+
`pr.number`/`pr.headSha` aligned with the initialized metadata. Put descriptive
365+
prose below that line. Run native artifact validation before calling the review
366+
ready; regenerated templates, not hand-edited stamps, own head changes.
367+
333368
## Follow PR review and landing hygiene
334369

335370
- `scripts/pr` requires `git`, `gh`, `jq`, `rg` (ripgrep), `pnpm`, and `node`

‎docs/concepts/models.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,12 @@ Its scheduled workflow checks OpenClaw's default-branch plugin manifests and
292292
public pricing sources every four hours; every catalog content change is
293293
preserved as a public commit. Provider-owned policies select complete price
294294
schedules, including context tiers, without mixing rates from different sources.
295-
Declared native sources read OpenCode's official catalog or Venice's public model
296-
API, so connected installations can receive advertised price changes without a
297-
new OpenClaw release.
295+
Declared native sources read the public Cerebras, Chutes, OpenCode, and Venice
296+
catalogs, so connected installations can receive advertised price changes without
297+
a new OpenClaw release. When a valid native feed no longer supplies a model's
298+
price, publication preserves the model metadata without an estimate; it does not
299+
infer retirement or substitute another source's rate. Explicit user costs still
300+
win.
298301

299302
Run `openclaw models refresh` for an immediate metadata and pricing check, or
300303
disable every hosted catalog request with `models.catalogRefresh.enabled:

‎docs/plugins/manifest.md‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,8 @@ Provider fields:
12971297

12981298
| Field | Type | What it means |
12991299
| ------------ | ----------------- | ----------------------------------------------------------------------------------------------- |
1300+
| `cerebras` | `false \| object` | Explicit mapping to the public Cerebras `/public/v1/models` catalog. Never enabled implicitly. |
1301+
| `chutes` | `false \| object` | Explicit mapping to the public Chutes `/v1/models` catalog. Never enabled implicitly. |
13001302
| `external` | `boolean` | Set `false` for local/self-hosted providers that should never use published external pricing. |
13011303
| `openCode` | `false \| object` | Explicit mapping to the public `models.opencode.ai/api.json` catalog. Never enabled implicitly. |
13021304
| `openRouter` | `false \| object` | OpenRouter publication-key mapping. `false` disables OpenRouter matching for this provider. |
@@ -1331,15 +1333,21 @@ For authoritative native source mappings, use:
13311333
}
13321334
```
13331335

1334-
The publisher fetches the fixed OpenCode or Venice public endpoint without
1335-
credentials only when its source is declared, and publishes native prices only
1336-
in explicitly mapped owner namespaces. Venice's lightweight public
1337-
`pricing-api.ts` keeps its payload parsing in the plugin and shares the complete
1338-
schedule parser with runtime discovery. Fetch failure, malformed response
1339-
bodies, or missing or invalid pricing for a paid bundled model stops
1340-
publication, leaving the previous hosted catalog intact rather than publishing
1341-
stale seed rates with a new timestamp. This authoring metadata does not add an
1342-
operator setting or change the Gateway's existing refresh and restart lifecycle.
1336+
The publisher fetches a fixed public endpoint without credentials only when its
1337+
source is declared, and publishes native prices only in explicitly mapped owner
1338+
namespaces. Cerebras and Chutes use the same shape with their respective source
1339+
and provider IDs. Lightweight plugin-owned `pricing-api.ts` artifacts share
1340+
payload parsing with runtime discovery without importing provider runtimes.
1341+
1342+
An opted-in native source owns the complete provider schedule, including missing
1343+
prices: generic sources cannot fill its gaps. A successful feed with no price for
1344+
a bundled model preserves that model's metadata, omits its cost, and emits a
1345+
publication warning. Missing pricing is not evidence of model retirement or free
1346+
usage. Explicit native zero prices remain known-free estimates. Fetch failure,
1347+
malformed response bodies or declared prices, and feeds with no usable prices
1348+
stop publication, leaving the previous hosted catalog intact. Explicit operator
1349+
rates remain unchanged. This authoring metadata adds no operator setting and does
1350+
not change the Gateway's existing refresh and restart lifecycle.
13431351

13441352
### OpenClaw Provider Index
13451353

‎docs/plugins/sdk-provider-plugins.md‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,17 @@ catalog, API-key auth, and dynamic model resolution.
409409
Public metadata never establishes account entitlement or expands the
410410
credential scope of discovery.
411411

412-
The same subpath exposes `normalizeOpenRouterModelPricing(pricing)` for
412+
Official plugins use the private, pure
413+
`openclaw/plugin-sdk/model-catalog-pricing` runtime subpath. It exposes
414+
`normalizeModelPricingCatalog(rows, normalizePricing, readPricing?)` for
415+
provider-owned pricing feeds. It returns a map of complete costs: absent
416+
prices are omitted, while malformed declared prices, invalid or duplicate
417+
model IDs, and a feed with no usable prices return `undefined`. Supply the
418+
provider's unit conversion and optional price-field selector; the default
419+
selector reads `model.pricing`. No auth, discovery, or runtime loader is
420+
imported.
421+
422+
This subpath also exposes `normalizeOpenRouterModelPricing(pricing)` for
413423
native OpenRouter pricing objects. It converts per-token rates and static
414424
prompt-length overrides into a complete per-million cost schedule, without
415425
network access or prices from another source. Overrides apply strictly above

‎docs/providers/cerebras.md‎

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ read_when:
66
- You need the Cerebras API key env var or CLI auth choice
77
---
88

9-
[Cerebras](https://www.cerebras.ai) provides high-speed OpenAI-compatible inference on custom inference hardware. The plugin ships a static three-model catalog (no live discovery).
9+
[Cerebras](https://www.cerebras.ai) provides high-speed OpenAI-compatible inference on custom inference hardware. The plugin discovers native model metadata and pricing, with a bundled catalog for offline fallback.
1010

1111
| Property | Value |
1212
| --------------- | --------------------------------------------------------- |
@@ -57,7 +57,7 @@ export CEREBRAS_API_KEY=csk-...
5757
openclaw models list --provider cerebras
5858
```
5959

60-
Lists all three static models. If `CEREBRAS_API_KEY` is unresolved, `openclaw models status --json` reports the missing credential under `auth.unusableProfiles`.
60+
Lists the configured Cerebras models. If `CEREBRAS_API_KEY` is unresolved, `openclaw models status --json` reports the missing credential under `auth.unusableProfiles`.
6161

6262
</Step>
6363
</Steps>
@@ -71,21 +71,54 @@ openclaw onboard --non-interactive --accept-risk --skip-health \
7171
--cerebras-api-key "$CEREBRAS_API_KEY"
7272
```
7373

74+
## Discovery and pricing
75+
76+
When Cerebras auth is configured and the inference base URL is the canonical
77+
`https://api.cerebras.ai/v1`, OpenClaw reads
78+
[`GET /public/v1/models`](https://inference-docs.cerebras.ai/api-reference/models/public-models).
79+
This request uses public headers only: inference API keys and discovery
80+
credentials are never sent to the metadata endpoint. A custom base URL skips
81+
this public discovery rather than mixing a proxy's catalog with Cerebras metadata.
82+
Without a Cerebras credential, the runtime provider stays inactive. Public
83+
metadata listing does not establish account entitlement.
84+
85+
Live rows supply the native context and completion limits, reasoning and vision
86+
capabilities, and prompt/completion prices. Cerebras returns those prices as USD
87+
per-token strings; OpenClaw converts them to USD per million tokens. The public
88+
feed does not provide cache tariffs. Zero cache fields in OpenClaw's runtime
89+
estimate are not a claim about enterprise caching or billing.
90+
91+
Successful catalogs are cached for 60 seconds. If discovery fails, returns an
92+
empty catalog, or has no usable model rows, OpenClaw uses the bundled offline
93+
seed. In the default `models.mode: "merge"`, fresh onboarding does not copy
94+
generated model rows or prices into your config, allowing prices to refresh.
95+
Explicitly authored model rows and costs remain intact. In
96+
`models.mode: "replace"`, discovery is disabled and onboarding keeps the offline
97+
seed as explicit config instead.
98+
7499
## Built-in catalog
75100

76-
All three models have a 131,072-token context window and a 40,960-token max output.
101+
The three offline fallback models have a 131,072-token context window and a
102+
40,960-token max output. Prices for models still present in the native
103+
[public feed](https://api.cerebras.ai/public/v1/models) were refreshed from its
104+
August 31, 2026 response; absent legacy references retain their seed snapshots.
105+
106+
| Model ref | Name | Reasoning | Notes |
107+
| ----------------------- | ------------ | --------- | --------------------------------------------------------- |
108+
| `cerebras/zai-glm-4.7` | Z.ai GLM 4.7 | yes | Deprecated August 17, 2026; retained for explicit configs |
109+
| `cerebras/gpt-oss-120b` | GPT OSS 120B | yes | Production reasoning model |
110+
| `cerebras/gemma-4-31b` | Gemma 4 31B | yes | Default; preview; text-and-image input |
77111

78-
| Model ref | Name | Reasoning | Notes |
79-
| ----------------------- | ------------ | --------- | ----------------------------------------- |
80-
| `cerebras/zai-glm-4.7` | Z.ai GLM 4.7 | yes | Scheduled for deprecation August 17, 2026 |
81-
| `cerebras/gpt-oss-120b` | GPT OSS 120B | yes | Production reasoning model |
82-
| `cerebras/gemma-4-31b` | Gemma 4 31B | yes | Default; preview; text-and-image input |
112+
Cerebras's [deprecation notice](https://inference-docs.cerebras.ai/support/deprecation)
113+
marks `zai-glm-4.7` deprecated without naming a replacement. OpenClaw keeps the
114+
shipped reference rather than deleting it or rewriting existing selections;
115+
retention does not guarantee upstream availability.
83116

84117
Fresh onboarding follows Cerebras's current [Gemma 4 recommendation](https://www.cerebras.ai/blog/gemma-4-on-cerebras-the-fastest-inference-is-now-multimodal). Cerebras describes Gemma 4 31B as its reference medium-size model for equal-or-higher intelligence than GPT OSS, with multimodal agentic support. It is a public-preview model and may change or be discontinued on shorter notice than the production GPT OSS endpoint; existing OpenClaw configurations keep their selected model.
85118

86119
## Manual config
87120

88-
Most setups only need the API key. Use explicit `models.providers.cerebras` config to override model metadata or run in `mode: "merge"` against the static catalog:
121+
Most setups only need the API key. Use explicit `models.providers.cerebras` config to override model metadata in `mode: "merge"`; leave `models` empty to use discovered rows without pinning generated prices:
89122

90123
```json5
91124
{
@@ -102,11 +135,7 @@ Most setups only need the API key. Use explicit `models.providers.cerebras` conf
102135
baseUrl: "https://api.cerebras.ai/v1",
103136
apiKey: "${CEREBRAS_API_KEY}",
104137
api: "openai-completions",
105-
models: [
106-
{ id: "zai-glm-4.7", name: "Z.ai GLM 4.7" },
107-
{ id: "gpt-oss-120b", name: "GPT OSS 120B" },
108-
{ id: "gemma-4-31b", name: "Gemma 4 31B" },
109-
],
138+
models: [],
110139
},
111140
},
112141
},

‎docs/providers/chutes.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ other non-2xx status, it falls back to the bundled static catalog (both API-key
7272
and OAuth discovery use this same path). If discovery fails at startup, the
7373
static catalog is used automatically.
7474

75+
Token prices come from the native [Chutes model catalog](https://llm.chutes.ai/v1/models).
76+
Its numeric prompt, completion, and cached-input rates are already in USD per
77+
million tokens; they are not per-token OpenRouter rates. Unavailable or invalid
78+
price metadata does not establish that a model is free.
79+
80+
In the default `models.mode: "merge"`, fresh onboarding records the provider and
81+
aliases without copying generated model rows or prices into your config. Live
82+
prices can then refresh without overwriting explicitly authored model costs.
83+
`models.mode: "replace"` disables discovery, so onboarding retains the bundled
84+
catalog as an explicit offline seed in that mode. Existing configured model rows
85+
and their prices are preserved when applying provider setup again.
86+
7587
## Default aliases
7688

7789
OpenClaw registers two convenience aliases for the Chutes catalog:
@@ -99,6 +111,12 @@ pickers:
99111

100112
Run `openclaw models list --all --provider chutes` for the full list.
101113

114+
Fallback prices for starter models still listed by the native endpoint were
115+
refreshed from its August 31, 2026 response. An absent model keeps its previous
116+
seed snapshot: feed absence alone does not retire a shipped reference or change
117+
its picker status. Listing metadata is not proof that your account can invoke a
118+
model.
119+
102120
## Config example
103121

104122
```json5

‎extensions/cerebras/index.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
55
import { applyCerebrasConfig } from "./onboard.js";
66
import manifest from "./openclaw.plugin.json" with { type: "json" };
7+
import { CEREBRAS_MODEL_DISCOVERY } from "./provider-catalog.js";
78

89
const PROVIDER_ID = "cerebras";
910

@@ -24,6 +25,9 @@ export default defineSingleProviderPluginEntry({
2425
].join("\n"),
2526
noteTitle: "Cerebras",
2627
},
27-
catalog: {},
28+
catalog: {
29+
allowExplicitBaseUrl: true,
30+
liveModelDiscovery: CEREBRAS_MODEL_DISCOVERY,
31+
},
2832
},
2933
});

0 commit comments

Comments
 (0)