integrations: fix four things that make openzoo fail out of the box - #37
Merged
AnOversizedMooseWithSocks merged 1 commit intoAug 19, 2026
Conversation
All four verified against the live gateway and the shipped CLI, not inferred.
1. OpenWebUI receipt was dead code. `_format_receipt` read `billedUsd` and
`savesVsDirect` out of `usage`; they are in a TOP-LEVEL `x402` block.
`usage` carries only OpenAI/OpenRouter fields (prompt_tokens, cost,
cost_details, is_byok). So the receipt -- the plugin's headline feature --
only ever rendered a token count. Now reads the whole body.
Measured on a live call:
usage keys: completion_tokens, cost, cost_details, is_byok,
prompt_tokens, total_tokens <- no billedUsd
x402: {billedUsd, cogsUsd, directUsd, savesVsDirect,
subscription:{tier, wouldHaveBilled, invoiced}}
Second, subtler bug in the same function: `savesVsDirect` is the RATIO
PAID, not the fraction saved -- 0.00700472/0.02101416 = 0.3333 exactly.
Printing "saved 0.33" claims a third when the real saving is two thirds,
i.e. it halves the product's own pitch. Now shows both absolute figures
(billed $X vs $Y direct (3.0x)), which cannot be misread.
Added regression tests using the exact live response shapes.
2. `npx openzoo models` does not exist -- the CLI answers
"unknown command: models". It was documented 9 times, and it is the first
command a new user runs. Replaced with the proxy's own free /v1/models.
3. https://api.openzoo.fun/v1 404s. It resolves to the Vercel website
(216.150.1.193), not the gateway, and was presented as "the hosted
endpoint" in 5 READMEs. Real upstream is https://x402-tokens.fly.dev/v1
(200) -- also what the CLI's own OPENZOO_API_BASE default points at.
The pipe's comment already hedged "once it exists"; the READMEs did not.
4. Stale/understated numbers: ~435 models -> 480+ (live catalog), and
zoo_ask "~1M tokens" -> ~9.8M per call / ~128M bound ceiling. The old
figure undersold the flagship capability by ~10x.
Not changed: the localhost:8402 default stays. Added a note that a Docker
install of open-webui needs host.docker.internal instead, since inside a
container "localhost" is the container and the proxy is on the host.
Verified end to end: open-webui + this pipe + `npx openzoo` surfaces 982 zoo
models and completes a paid call, receipt rendering as
*openzoo: billed $0.021348 · credit · 3364 tokens read*
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
AnOversizedMooseWithSocks
merged commit Aug 19, 2026
bda6f70
into
AnOversizedMooseWithSocks:integrations
7 checks passed
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.
Audited
integrations/against the live gateway and the shippednpx openzooCLI. Four things are broken; all four are verified with commands, not inferred.Ran the whole thing end to end first: open-webui + this pipe +
npx openzoo→ 982 zoo models in the dropdown, paid completion succeeds, receipt renders. Screenshot of the receipt line at the bottom.1. The OpenWebUI receipt is dead code — and it's the plugin's headline feature
_format_receiptreadbilledUsd/savesVsDirectout ofusage. They're in a top-levelx402block. Live response:So "users see the per-call cost and the savings from the leCore spill" never fired — it could only print
N tokens read.Second, subtler bug in the same function.
savesVsDirectis the ratio paid, not the fraction saved:f"saved {savesVsDirect} vs direct"renders "saved 0.33" when the real saving is two thirds — it halves your own pitch. I deliberately did not convert it to a percentage (the semantics are easy to flip again); it now shows both absolute figures,billed $X vs $Y direct (3.0x), which can't be misread. Added regression tests using the exact live shapes.2.
npx openzoo modelsdoesn't existDocumented 9 times, and it's the first command a new user runs. Replaced with the proxy's own free
/v1/models.3.
https://api.openzoo.fun/v1404sIt resolves to the Vercel website (
216.150.1.193), not the gateway, and is presented as "the hosted endpoint" in 5 READMEs. Real upstream ishttps://x402-tokens.fly.dev/v1→ 200 — which is also what the CLI's ownOPENZOO_API_BASEdefault points at.Credit where due: the pipe's own comment already hedged "once it exists." The READMEs then stated it flat.
4. Stale / understated numbers
~435 models→ 480+ (live catalog)zoo_ask~1M tokens→ ~9.8M per call / ~128M bound ceiling — the old figure undersold the flagship capability by ~10×Not changed
The
localhost:8402default stays as you had it. Added a note that a Docker install of open-webui needshost.docker.internal:8402instead, since inside a containerlocalhostis the container and the proxy is on the host. That bit me during setup.What's good and I left alone
_strip_owui_prefixis genuinely careful — zoo ids contain dots, so naive split-on-first-dot turnsnvidia/nemotron-3.5-lightninginto5-lightning, and there's already a regression test recording exactly that. The_OPENAI_CHAT_FIELDSwhitelist prevents a real class of 400s. The "kept negative" note on client-side spill is the right call. All four configs parse clean and every active line already pointed at a working local default.Verification
Live, through open-webui:
🤖 Generated with Claude Code