pi-deepinfra

extensionmaintained

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

by · v0.1.3 · published 6d ago

$ pi install npm:pi-deepinfra
downloads/mo
624
stars
0
last push
6d ago
open issues
0

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

624 downloads · last 12 weeks (weekly)

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

FeatureNotes
Model catalogRegistered 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).
Streamingopenai-completions API; SSE streaming with reasoning_content thinking deltas on reasoning models.
Thinking levelsreasoning_effort maps 1:1 to pi thinking levels (minimalmax); offnone. E.g. Ctrl+P or /model + thinking level cycling works as usual.
Visionvision-tagged models accept image input.
Tool callingStandard OpenAI tools/tool_choice.
Cost trackingInput/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 statuslineWhile 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.