Repository navigation
fix(pricing): map LiteLLM's opencode_go bucket to the opencode-go provider - #18644
diegosouzapw merged 6 commits into
Conversation
…vider LiteLLM files OpenCode Go prices under opencode_go, which had no LITELLM_PROVIDER_MAP entry, so the sync stored them under a key no cost lookup reads and every opencode-go request was booked as unpriced $0. Fixes cheaper-inference#18598
|
Thanks for working on this. I independently opened #18641 for the same report and am keeping it draft while we coordinate. This PR fixes the fresh LiteLLM transform path. One existing-install edge remains: the regression test transforms and then saves canonical data, but does not seed a historical Two scope notes before merge:
I am happy to leave #18641 draft and reconcile the unique historical-data coverage whichever way maintainers prefer. |
…ed as opencode_go A sync that ran before the opencode_go map entry left its bucket under the raw LiteLLM name, so existing installs stayed unpriced until the next sync. The provider map moves to its own module, and both synced-pricing readers re-apply it to such historical rows; rows under the mapped alias still win. Refs cheaper-inference#18598
|
@trespassmk thanks, good catch on the historical row. I reproduced it on this branch: with only a a8e778e normalizes on read instead of requiring a resync: the provider map moved to On scope:
This PR stays the minimal fix for the OpenCode Go lookup; #18641 has the wider surface coverage (header, catalog, source map, quota, override/reset). Happy for the maintainers to pick either one or combine them. |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
4b9528e
into
cheaper-inference:release/v3.8.53
Summary
LiteLLM files OpenCode Go prices under the
opencode_goprovider.LITELLM_PROVIDER_MAPinsrc/lib/pricingSync.tshad no entry for that name, sotransformToOmniRoutestored the 30 models underopencode_go, a key no cost lookup uses. The registry alias isopencode-go, so everyopencode-gorequest came back unpriced: $0 on thex-omniroute-response-costheader and in usage history, and an unpriced window for the USD quota gate.This adds
opencode_go: ["opencode-go"]to the map.Existing installs also have a
pricing_syncedrow stored underopencode_goby an earlier sync, which stays unpriced until the next successful sync replaces it (it heals at startup withPRICING_SYNC_ENABLED=true, but not on installs that sync by hand). The map now lives insrc/lib/litellmProviderMap.ts, and both synced-pricing readers (getSyncedPricingand the cost layers ingetPricingLayers) re-apply it to such historical rows, so they price requests right away. A row already stored underopencode-gowins, model by model. Thanks @trespassmk for spotting this.Related Issues
Refs #18598 (the OpenCode Go half; the Ollama Cloud and pricing-override parts stay open). Related: draft #18641 by @trespassmk covers the same report with wider surface coverage.
Out of scope:
ollamabucket holds 29 local models, all at $0. models.dev does price them, and its existing mapping (ollama-cloud) already works once models.dev sync is turned on (Settings > AI; off by default).PATCH /api/pricingoverride claim in the issue was not looked at here.Target Branch
release/v3.8.xbranch (release/v3.8.53), notmainValidation
Reproduced on
release/v3.8.53(b2a6410) against an isolatedDATA_DIR, loading today's real LiteLLM and models.dev price files throughtransformToOmniRoute→saveSyncedPricing→calculateCostDetailed(1M input + 1M output tokens):openrouter/openai/gpt-oss-120b(control)opencode-go/glm-5.2ollama-cloud/deepseek-v4.1-flash$5.80 matches LiteLLM's price for
glm-5.2($1.40 input / $4.40 output per million tokens).*pric*,*cost*,*usage-limit*and*catalog*unit suites pass; the remaining one (model-select-field-catalog-vision-10809) fails locally only because this worktree'snode_modulespredates@radix-ui/react-select.typecheck:coreclean; ESLint--max-warnings 0clean on the changed filesquality.ymlgates run locally against the merge-base: all pass exceptprovider-asset-provenance(the base'sconfig/quality/provider-assets-provenance.jsonlnames audited commitca7fc3f5ff, which is on no upstream branch),mutation-test-coverage(5 unrelated tests missing fromstryker.conf.json),dashboard-typecheck(errors in ui-kit,logs/page.tsx,ProxyRegistryManager.tsxand shared components, none touched here),agent-skills-sync(4 unrelated generated skills) andworkflows(actionlint/zizmor not installed locally; no workflow changes). All are inherited from the base.Tests Added Or Updated
tests/unit/pricing-sync-opencode-go-18598.test.ts: the transform storesopencode_goentries underopencode-go;calculateCostDetailed("opencode-go", "glm-5.2", …)prices a request from LiteLLM-synced pricing on a real DB; a DB holding only a historicalopencode_gorow still prices it; and an existingopencode-gorow wins over a historical one.Coverage Notes
Both the new map entry and
remapHistoricalLitellmRowsare covered by the four tests.