Repository navigation
Agents widget: add a DeepInfra collector for pay-as-you-go usage/balance #20464
HeneryH
started this conversation in
Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Request
Add a
deepinfracollector to the agents widget, for people running open-source models through DeepInfra's pay-as-you-go inference API.Right now the agents panel supports
claude,codex,grok,kimi,cursor,grokbot,copilot,muse,agy,kimchi,hermes,devin,vibe,qwen,opencode,zai,ollama,minimax,openrouter,deepseek,fireworks,synthetic, andlocal— no DeepInfra. It's easy to confuse withdeepseekby name, but they're unrelated services (DeepSeek is a model lab with its own API; DeepInfra is a pure inference-hosting marketplace for open models, billed like Fireworks/OpenRouter/Synthetic).DeepInfra has no CLI coding agent of its own, so this would be for the
local-adjacent case: someone calling DeepInfra's OpenAI-compatible endpoint directly, or through opencode/pi with a DeepInfra provider configured, who wants their spend/balance visible in the same panel as everything else.What DeepInfra's API actually offers
Confirmed against DeepInfra's published docs/OpenAPI schema (bearer auth,
billing:readscope):GET /payment/checklist— live balance.stripe_balanceis negative when funds are ready to spend, positive when money is owed. Also carriesrecent(usage since the last invoice),limit,suspend_reason, andscoped_credits(per-model capped discounts).GET /payment/usage?from=<YYYY.MM|current(-N)|unix_ts>&to=...— per-model billing rows for a period:model.model_name,units(tokens forpricing_type: "token"rows, seconds for GPU-rental rows),cost(cents),interval(start/end in ms).Both map cleanly onto the shape
fireworks,openrouter, andsyntheticalready use: a live balance (no "estimated" fallback needed —/payment/checklistalways gives a real number, simpler than Fireworks's permission-gatedgetBalance) plus per-model token totals for the trailing window.Draft collector
Below is a draft
omarchy-agent-usage-deepinfra, modeled closely on thefireworkscollector (same sharedcollectors.pyplumbing:base_record,Stats,emit,open_json/HttpError,trusted_endpoint,number). It's not yet run against a live account — the field names come from DeepInfra's documented OpenAPI schema, not a captured example response — and it skipsfireworks.py's on-diskLimitsCachereuse/staleness handling for brevity. Posting it as a concrete starting point, not a finished implementation:What's missing before this could be a real PR
LimitsCache-based reuse/staleness handling (see howfireworks/openrouterdo this) — right now it re-fetches both endpoints on every scan.DEEPINFRA_API_KEY/ a local config file.assets/deepinfra.svgmark, per the README's contract.Happy to open a PR with a cleaned-up version if there's interest in adding this.
All reactions