pi-deepinfra

DeepInfra provider for pi: dynamic model catalog, reasoning-effort thinking levels, vision, session usage + monthly billing footer

Packages

Package details

extension

Install pi-deepinfra from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-deepinfra
Package
pi-deepinfra
Version
0.1.3
Published
Aug 3, 2026
Downloads
392/mo · 48/wk
Author
puetsua
License
MIT
Types
extension
Size
21.7 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

pi-deepinfra

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 session token usage + cost and DeepInfra monthly usage.

Install

Requires pi.

  • npm (recommended):

    pi install npm:pi-deepinfra
    
  • git (latest source):

    pi install git:github.com/puetsua/pi-deepinfra
    
  1. Authenticate — either:

    • Interactive: inside pi, run /login deepinfra and paste your API key (from https://deepinfra.com/dash/api_keys). The key is stored in ~/.pi/agent/auth.json.
    • Environment: set DEEPINFRA_API_KEY in your shell.

    If a deepinfra api_key entry already exists in ~/.pi/agent/auth.json, it is picked up automatically.

  2. 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 and swapped in over the fallback — 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 reasoning_effort maps 1:1 to pi thinking levels (minimalmax); offnone. E.g. Ctrl+P or /model + thinking level cycling works as usual.
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.
Footer statusline While a DeepInfra model is active: ↑12.3k ↓4.5k · $0.042 for session tokens+cost, plus M: $12.34 / $50.00 for DeepInfra monthly usage when a spending limit is configured (via /payment/config), or M: $12.34 otherwise. The session figures count only assistant usage attributed to the DeepInfra provider, so switching to another model/provider mid-session never mixes their tokens/cost into these totals. Refresh with /deepinfra-billing.

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.

  • Per-model overrides (prices, context, max tokens): standard pi ~/.pi/agent/models.json mechanism, e.g.:

    {
      "deepinfra": {
        "models": [
          {
            "id": "deepseek-ai/DeepSeek-V4-Flash-0731",
            "cost": { "input": 0.09, "output": 0.18, "cacheRead": 0.018, "cacheWrite": 0 }
          }
        ]
      }
    }
    

    Note: models.json deepinfra entries replace the extension's models for that provider — set a full models list there if you use it.