Skip to content

Commit 6774ca2

Browse files
authored
fix(venice): preserve authoritative model pricing (#129694)
* fix(venice): preserve authoritative model pricing * test(venice): verify pricing through setup and explicit overrides Preserve the canonical manifest model definition without redundant input copying, use a neutral unknown-model fixture, and cover fresh onboarding prices plus existing zero/custom overrides. Document pricing ownership and remove the API-key-printing troubleshooting example. The full candidate has three failing-before pricing regressions and 90 passing focused tests. Full build, changed-file gates, and fresh isolated P0-scoped Codex review pass. Real catalog/discovery and usage-estimator probes preserve all 19 known base prices and 92 unknown zero estimates; synthetic token totals render $3.31 instead of $0.0000. No inference or provider-billing claim is made.
1 parent 6f3ac10 commit 6774ca2

4 files changed

Lines changed: 71 additions & 12 deletions

File tree

‎docs/providers/venice.md‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@ Venice uses a credit-based system. Anonymized models cost roughly the same as
164164
direct API pricing plus a small Venice fee. See
165165
[venice.ai/pricing](https://venice.ai/pricing) for current rates.
166166

167+
OpenClaw uses the Venice plugin manifest's prices for bundled models, including
168+
when those models appear in live discovery. Newly discovered models outside the
169+
manifest keep zero estimates until pricing is configured; zero does not mean the
170+
model is free.
171+
172+
Existing explicit model prices take precedence, including zero. Onboarding
173+
preserves existing model entries rather than replacing their prices. If an older
174+
configuration contains obsolete zero rates, back up your configuration and update
175+
only the affected `models.providers.venice.models[].cost` fields to current rates.
176+
Keep intentional custom prices. See [Token use and costs](/reference/token-use)
177+
for pricing units and usage reporting.
178+
167179
## Usage examples
168180

169181
```bash
@@ -188,11 +200,11 @@ openclaw agent --model venice/qwen3-coder-480b-a35b-instruct-turbo --message "Re
188200
<AccordionGroup>
189201
<Accordion title="API key not recognized">
190202
```bash
191-
echo $VENICE_API_KEY
192-
openclaw models list | grep venice
203+
openclaw models list --provider venice
193204
```
194205

195-
Confirm the key starts with `vapi_`.
206+
Confirm the API key is configured and starts with `vapi_`; do not print or
207+
share its value.
196208

197209
</Accordion>
198210

‎extensions/venice/models.test.ts‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,44 @@ describe("venice-models", () => {
184184
}
185185
});
186186

187+
it("preserves authoritative manifest pricing in every bundled Venice model", () => {
188+
expect(
189+
VENICE_MODEL_CATALOG.map(({ id, cost, compat }) => ({
190+
id,
191+
cost,
192+
supportsUsageInStreaming: compat?.supportsUsageInStreaming,
193+
})),
194+
).toEqual(
195+
manifest.modelCatalog.providers.venice.models.map(({ id, cost }) => ({
196+
id,
197+
cost,
198+
supportsUsageInStreaming: false,
199+
})),
200+
);
201+
});
202+
203+
it("retains bundled prices for known live models without pricing unknown models", async () => {
204+
stubVeniceModelsFetch([
205+
{ id: "zai-org-glm-4.7" },
206+
{ id: "claude-opus-5" },
207+
{ id: "unknown-model-without-pricing" },
208+
]);
209+
const manifestCosts = new Map(
210+
manifest.modelCatalog.providers.venice.models.map(({ id, cost }) => [id, cost]),
211+
);
212+
213+
const models = await runWithDiscoveryEnabled(() => discoverVeniceModels());
214+
215+
expect(models.map(({ id, cost }) => ({ id, cost }))).toEqual([
216+
{ id: "zai-org-glm-4.7", cost: manifestCosts.get("zai-org-glm-4.7") },
217+
{ id: "claude-opus-5", cost: manifestCosts.get("claude-opus-5") },
218+
{
219+
id: "unknown-model-without-pricing",
220+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
221+
},
222+
]);
223+
});
224+
187225
it("uses the shared fallback after a transient fetch failure", async () => {
188226
let attempts = 0;
189227
const fetchMock = vi.fn(async () => {

‎extensions/venice/models.ts‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,7 @@ const VENICE_DISCOVERY_CACHE_TTL_MS = 60_000;
2929

3030
function decorateVeniceModelDefinition(entry: ModelDefinitionConfig): ModelDefinitionConfig {
3131
return {
32-
id: entry.id,
33-
name: entry.name,
34-
reasoning: entry.reasoning,
35-
input: [...entry.input],
36-
cost: VENICE_DEFAULT_COST,
37-
contextWindow: entry.contextWindow,
38-
maxTokens: entry.maxTokens,
32+
...entry,
3933
compat: {
4034
supportsUsageInStreaming: false,
4135
...entry.compat,

‎extensions/venice/onboard.test.ts‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ describe("Venice onboarding", () => {
88
it("applies the manifest catalog, default, and alias", () => {
99
const config = applyVeniceConfig({});
1010

11-
expect(config.models?.providers?.venice?.models.map((model) => model.id)).toEqual(
12-
manifest.modelCatalog.providers.venice.models.map((model) => model.id),
11+
expect(config.models?.providers?.venice?.models.map(({ id, cost }) => ({ id, cost }))).toEqual(
12+
manifest.modelCatalog.providers.venice.models.map(({ id, cost }) => ({ id, cost })),
1313
);
1414
expect(resolveAgentModelPrimaryValue(config.agents?.defaults?.model)).toBe(
1515
VENICE_DEFAULT_MODEL_REF,
@@ -19,4 +19,19 @@ describe("Venice onboarding", () => {
1919
[VENICE_DEFAULT_MODEL_REF]: { alias: "GLM 4.7" },
2020
});
2121
});
22+
23+
it.each([
24+
{ label: "zero", cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 } },
25+
{ label: "custom", cost: { input: 1, output: 2, cacheRead: 0.25, cacheWrite: 0.5 } },
26+
])("preserves existing $label pricing when onboarding again", ({ cost }) => {
27+
const config = applyVeniceConfig({});
28+
const model = config.models!.providers!.venice!.models[0]!;
29+
model.cost = { ...cost };
30+
31+
const reapplied = applyVeniceConfig(config);
32+
33+
expect(
34+
reapplied.models?.providers?.venice?.models.find(({ id }) => id === model.id)?.cost,
35+
).toEqual(cost);
36+
});
2237
});

0 commit comments

Comments
 (0)