Skip to content

integrations: fix four things that make openzoo fail out of the box - #37

Merged
AnOversizedMooseWithSocks merged 1 commit into
AnOversizedMooseWithSocks:integrationsfrom
staccDOTsol:fix/integrations-openzoo
Aug 19, 2026
Merged

integrations: fix four things that make openzoo fail out of the box#37
AnOversizedMooseWithSocks merged 1 commit into
AnOversizedMooseWithSocks:integrationsfrom
staccDOTsol:fix/integrations-openzoo

Conversation

@staccDOTsol

Copy link
Copy Markdown

Audited integrations/ against the live gateway and the shipped npx openzoo CLI. 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_receipt read billedUsd / savesVsDirect out of usage. They're in a top-level x402 block. Live response:

usage keys: completion_tokens, cost, cost_details, is_byok, prompt_tokens, total_tokens
  billedUsd in usage?     False
  savesVsDirect in usage? False
x402: {"billedUsd":0.00700472, "savesVsDirect":0.333…, "cogsUsd":…, "directUsd":…,
       "subscription":{"tier":"pro","wouldHaveBilled":0.02101416,"invoiced":"stripe"}}

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. savesVsDirect is the ratio paid, not the fraction saved:

0.00700472 / 0.02101416 = 0.3333  ==  savesVsDirect

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 models doesn't exist

$ npx openzoo models
unknown command: models

Documented 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/v1 404s

It resolves to the Vercel website (216.150.1.193), not the gateway, and is presented as "the hosted endpoint" in 5 READMEs. Real upstream is https://x402-tokens.fly.dev/v1 → 200 — which is also what the CLI's own OPENZOO_API_BASE default 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 models480+ (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:8402 default stays as you had it. Added a note that a Docker install of open-webui needs host.docker.internal:8402 instead, since inside a container localhost is the container and the proxy is on the host. That bit me during setup.

What's good and I left alone

_strip_owui_prefix is genuinely careful — zoo ids contain dots, so naive split-on-first-dot turns nvidia/nemotron-3.5-lightning into 5-lightning, and there's already a regression test recording exactly that. The _OPENAI_CHAT_FIELDS whitelist 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

integrations/{LibreChat,Continue,Hermes}/*.yaml   parse OK
integrations/GrokCLI/models.openzoo.json          parse OK
python3 integrations/OpenWebUI/openzoo_pipe.py    selftest OK

Live, through open-webui:

openzoo pipe works

---
*openzoo: billed $0.021348 · credit · 3364 tokens read*

🤖 Generated with Claude Code

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
AnOversizedMooseWithSocks merged commit bda6f70 into AnOversizedMooseWithSocks:integrations Aug 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants