@cad0p/pi-deepinfra-provider
DeepInfra provider for pi: dynamic model catalog, full reasoning-effort thinking levels (max included), vision, monthly billing footer (fork of pi-deepinfra)
Package details
Install @cad0p/pi-deepinfra-provider from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@cad0p/pi-deepinfra-provider- Package
@cad0p/pi-deepinfra-provider- Version
0.1.5- Published
- Oct 20, 2026
- Downloads
- 411/mo · 224/wk
- Author
- cad0p
- License
- MIT
- Types
- extension
- Size
- 31.6 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@cad0p/pi-deepinfra-provider
A pi extension that adds the DeepInfra provider: 90+ hosted chat models (DeepSeek, Qwen, Llama, Gemma, Mistral, plus hosted frontier models like Claude and Gemini), with dynamic model discovery, reasoning-effort control, vision, and a footer statusline showing DeepInfra monthly usage.
Fork of puetsua/pi-deepinfra — see Differences from upstream.
Install
Requires pi.
pi install npm:@cad0p/pi-deepinfra-provider@next
or from source:
pi install git:github.com/cad0p/pi-deepinfra
Authenticate — either:
- Interactive: inside pi, run
/login deepinfraand paste your API key (from https://deepinfra.com/dash/api_keys). The key is stored in~/.pi/agent/auth.json. - Environment: set
DEEPINFRA_API_KEYin your shell.
If a
deepinfraapi_keyentry already exists in~/.pi/agent/auth.json, it is picked up automatically.- Interactive: inside pi, run
Restart pi (or
/reload), then select a model:/model deepinfra/deepseek-ai/DeepSeek-V4-Flash-0731
What you get
| Feature | Notes |
|---|---|
| Model catalog | Registered instantly with a curated fallback list — startup never blocks on the network. The live catalog from https://api.deepinfra.com/v1/openai/models is fetched lazily at session start, swapped in over the fallback, and cached in ~/.pi/agent/cache/deepinfra-models.json so later startups register the full catalog instantly (needed by clients that select a model right after launching pi, e.g. RPC mode) — no API key required (the catalog is public), so models are ready the moment a key is added. All chat-tagged models are registered (embeddings/image/TTS/STT excluded). |
| Streaming | openai-completions API; SSE streaming with reasoning_content thinking deltas on reasoning models. |
| Thinking levels | The full reasoning_effort vocabulary: off → none, and minimal/low/medium/high/xhigh/max pass through by name. DeepInfra validates one global enum for every chat model (an invalid value returns HTTP 422 listing none, minimal, low, medium, high, xhigh, max), so Ctrl+P / /model cycling offers every level including max. |
| Vision | vision-tagged models accept image input. |
| Tool calling | Standard OpenAI tools/tool_choice. |
| Cost tracking | Input/output/cache prices from the catalog ($ per 1M tokens, cache_read_tokens when DeepInfra publishes it). Override per model in ~/.pi/agent/models.json if needed. Session tokens + cost are rendered by pi's own footer. |
| Footer statusline | While a DeepInfra model is active: M: $12.34 / $50.00 — the DeepInfra monthly spend and the configured spending limit (via /payment/config), or M: $12.34 when no limit is set. Nothing else: pi's footer already shows session tokens and cost, so this extension does not repeat them. Refresh with /deepinfra-billing; disable with PI_DEEPINFRA_FOOTER=off. |
Commands
/deepinfra-billing— refresh the monthly-usage figure in the footer (also refreshed on session start / model select; no background polling).
Configuration
API key:
/login deepinfra,DEEPINFRA_API_KEY, or the auth.json credential.Footer:
PI_DEEPINFRA_FOOTER=offhides the statusline entirely.Per-model overrides (prices, context, max tokens, thinking levels): standard pi
~/.pi/agent/models.jsonmechanism, e.g.:{ "providers": { "deepinfra": { "modelOverrides": { "deepseek-ai/DeepSeek-V4.1-Flash-1017": { "contextWindow": 400000 } } } } }Note:
models.jsonmodelsentries replace the extension's models for that provider — set a fullmodelslist there if you use it.
Differences from upstream
- Thinking levels cover the whole enum. Upstream maps only
off → none, so pi'sgetSupportedThinkingLevels()stops athigh(pi only offersxhigh/maxwhenthinkingLevelMapnames them explicitly) and amaxrequest is silently clamped tohigh. Verified against the live API: the validator acceptsnone/minimal/low/medium/high/xhigh/maxfor every chat model, so the map is complete. - The footer no longer duplicates pi's. Upstream renders
↑in ↓out · $cost · M: $spent; pi's own footer already renders↑in ↓out $cost, so the fork keeps only the monthly figure and drops the per-message recomputation. PI_DEEPINFRA_FOOTER=offto hide the statusline (upstream has no switch).
Everything else — catalog discovery, caching, auth, compat flags — is upstream's.
Development
pnpm install --frozen-lockfile
pnpm check # tsc --noEmit (thinking.ts + its test; pi-importing files are excluded)
pnpm test # node --test (offline)
See docs/verification.md for the CI gates and live-proof checklists.
License
MIT — see LICENSE. Original work © 2026 puetsua.