Skip to content

feat: price catalog-less provider rows via first-party vendor fallback - #56

Merged
MayankBansal12 merged 7 commits into
MayankBansal12:mainfrom
hxy91819:feature/proxy-provider-pricing
Sep 11, 2026
Merged

MayankBansal12 merged 7 commits into
MayankBansal12:mainfrom
hxy91819:feature/proxy-provider-pricing

Conversation

@hxy91819

Copy link
Copy Markdown
Contributor

Summary

Rows recorded under a provider that isn't in the models.dev catalog at all (e.g. cliproxy, a local API proxy serving Pi/DSH traffic) returned unknown even when the model name is canonical and priced under its first-party vendor. On a real machine this left ~1B tokens — the largest share — unpriced.

  • When the recorded provider misses the catalog and builtinPrices, resolvePricing now tries first-party vendors (openai, anthropic, google(-vertex), deepseek, xai, zai/zhipuai, alibaba, meta, kimi-for-coding, moonshotai, mistral, minimax) with the existing model-id variants, then falls back to a unique exact match across the whole catalog.
  • Model candidates gain reasoning-effort (-low/-medium/-high/-xhigh/-max) and promo (-expires-on-*) suffix variants via BFS stripping; the full name is always tried first so real names like qwen3.8-max still win.
  • Fallback hits report models-dev-alias and reattribute the model provider to the pricing vendor — consistent with the existing unknown-provider path.
  • The cross-vendor guard is preserved: catalog-listed providers never inherit another vendor's rates (openai + grok-4.6 stays unknown), and genuinely unpriced models (swe-*, codex-auto-review) remain unknown.

Test plan

  • Unit: cliproxy rows resolve to deepseek/google/xai/etc.; unique-match fallback; ambiguous matches stay unknown; openai + foreign model still unknown; swe-2-max unknown; effort-suffix resolution
  • Real data: on a machine with cliproxy Pi/DSH traffic, 844.8M tokens moved from unknown to models-dev-alias (+$132 estimated); remaining unknown rows are all genuinely unpriced models

Evidence

Dashboard after this branch: Pi rows previously "cost unknown" now price via canonical vendors (deepseek-flash $2.11, gemini-3.8-flash $39.00, grok-4.6 $88.27); swe-2-max correctly stays Unknown.

Usage dashboard with proxy-provider models priced via canonical vendors

Fixes #55

Generated with Devin

hxy91819 and others added 7 commits September 12, 2026 01:37
Proxy gateways like cliproxy report bare model names under a provider id
the catalog does not list, leaving all their usage unpriced. Resolve those
rows against a first-party vendor priority list over decorated-name
variants (reasoning effort and promo suffixes, full name tried first),
then a catalog-wide unique exact match, reporting models-dev-alias with
the pricing vendor's id. Providers present in the catalog or pinned rates
keep the no-substitution guardrail and still return unknown on a miss.

Refs MayankBansal12#55

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Extra Codex accounts exposed as ACP providers keep CODEX_HOME under
~/.codex-profiles/<name>. The host scan now walks each profile's
sessions/ tree, tags aggregate rows with the account name, and
deduplicates files by inode so a profile aliased to ~/.codex is never
counted twice. Server-side, tagged rows become per-account agents
(codex-<name>, "Codex (<name>)") so grouping, filters, and breakdowns
keep accounts distinct; the dashboard agents list merges discovered
agent ids, and codex-* ids reuse the Codex brand mark.

Refs MayankBansal12#44

Generated with [Devin](https://devin.ai)

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…Bansal12#50)

* feat: collect Devin usage from the Devin CLI session database

Devin runs in BB through the acp-devin provider and writes no JSONL
session logs; usage lives in ~/.local/share/devin/cli/sessions.db. A new
serialized host collector opens the WAL database read-only via
node:sqlite, extracts only usage metadata fields, deduplicates message
nodes by request_id, and emits the shared aggregate-row wire format.
Hosts without the database report no-data; an unreadable database or a
Node.js too old for node:sqlite surfaces as a Devin-only sync error.
Devin records ACU totals rather than per-request USD, so rows carry
token counts with unknown pricing.

Refs MayankBansal12#45

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat: add the Devin brand mark to provider logos

Refs MayankBansal12#45

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: preserve Devin usage on database access errors

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: mayank <mayankbansal125@gmail.com>
…nsal12#51)

* feat: collect DeepSeek Harness usage from zstd session logs

DeepSeek Harness (the acp-dsh provider) stores sessions at
~/.dsh/sessions/*/*/session.v3.jsonl.zstd: pi-style JSONL appended as
concatenated Zstandard frames. Node's zlib decoder stops at the first
frame, so the host collector scans frame boundaries structurally and
decompresses each frame on its own, with a finish-flush prefix decode
for a torn final frame.

The dsh parse branch reads assistant/message and assistant/attempt
settlements (camelCase usage fields, provider/model from the committed
message source or the surrounding request/context), derives the project
from the session header cwd, and skips inherited fork history behind
the last tagged session/end-seed marker. Discovery is restricted to the
canonical v3 generation so retained historical generations are not
counted twice. Hosts without Node 22.15+ degrade to the existing
per-file failure state; hosts without session logs stay no-data.

Refs MayankBansal12#46

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: count DeepSeek attempts once and reject incomplete forks

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: mayank <mayankbansal125@gmail.com>
…2#52)

* fix: stage oversized host commands through files.write

terminals.create rejects start.command over 10,000 characters, so the
serialized JSONL collector commands fail on the host boundary and every
JSONL agent reports unavailable. runHostCommand now stages commands that
exceed the contract limit into a content-addressed file under
~/.cache/bb-plugin-usage via files.write (whose content is unbounded) and
runs it with sh, keeping the held wrapper's DONE marker, exit-code, and
__BB_USAGE_ERROR__ semantics identical. Staging failures surface as the
real error instead of a doomed inline submission, and every caller of
runHostCommand (including the devin collector's devinCommand path) is
covered by the same fix.

Refs MayankBansal12#47

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: guard staged command reuse and cancelled launches

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: mayank <mayankbansal125@gmail.com>
@MayankBansal12
MayankBansal12 merged commit 0895869 into MayankBansal12:main Sep 11, 2026
2 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.

Price models served through proxy providers (cliproxy etc.) via canonical vendor rates

2 participants