Repository navigation
fix(models): price cliproxy-gateway routed ids as the models they wrap - #1364
Closed
ozymandiashh wants to merge 1 commit into
Closed
ozymandiashh wants to merge 1 commit into
ozymandiashh wants to merge 1 commit into
Conversation
ozymandiashh
force-pushed
the
fix/cliproxy-gateway-model-prefixes
branch
from
September 14, 2026 09:32
cf5961a to
b4a6a12
Compare
This was referenced Sep 14, 2026
codex-cliproxy-gateway forwards only cliproxy/* ids to a local CLIProxyAPI, so routed Codex sessions record cliproxy/<id> model names, sometimes with a CLIProxyAPI provider path behind the wrapper (cliproxy/zcode/glm-5.3-flash). None of those match a pricing row, so the tokens were counted but the dollars were not, and the models table hides zero-cost rows — routed spend looked absent rather than unpriced. Peel the cliproxy/ wrapper like the other routing wrappers and treat zcode as a known vendor namespace so the provider path strips to its priced glm-* leaf. An unknown vendor behind the wrapper still fails closed.
ozymandiashh
force-pushed
the
fix/cliproxy-gateway-model-prefixes
branch
from
September 15, 2026 17:32
b4a6a12 to
26600a7
Compare
Member
|
Landed as #1439 with your commit kept. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
codex-cliproxy-gateway keeps Codex's own OpenAI OAuth routing native and forwards only
cliproxy/*model ids to a local CLIProxyAPI. Every routed Codex session therefore records acliproxy/<id>model name in its rollout — sometimes with a CLIProxyAPI provider path behind the wrapper, e.g.cliproxy/zcode/glm-5.3-flash.None of those names match a pricing row, so routed sessions were counted in the token totals but priced at $0 — and since the models table hides zero-cost rows, routed spend looked absent rather than unpriced. On a real machine routed Claude usage was the single largest line of the day and contributed nothing to the daily cost figure.
Fix
cliproxy/wrapper inROUTER_PREFIXES, same class asorcarouter/,cmd/, etc.zcodetoEXTRA_NAMESPACES(CLIProxyAPI's provider spelling for the Z.ai coding plans) socliproxy/zcode/glm-5.3-flashstrips to its pricedglm-*leaf.cliproxy/nosuchvendor/<id>stays unpriced), per the existing rule.Tests
zzz-*-probe) withcliproxy,zcode, the nestedcliproxy/zcode/spelling, and the fail-closed unknown-vendor case.resolveCanonicalModelIdcases:cliproxy/claude-fable-5-1→claude-fable-5-1,cliproxy/zcode/glm-5.3-flash→glm-5.3-flash.tests/models.test.tsplus the five adjacent pricing suites: 271/271 pass.End-to-end on real data (before → after): the routed
Fable 5.1row went from hidden/$0 to $218.46 over Sep 8–14, weekly total $2123.95 → $2358.67, andcodeburn models --unpricedreports a clean period.