← Catalog

@midpath/gptmitra-pi

GPT Mitra provider for Pi with per-call supplier pricing and persisted session costs

Package

Install

Install with PiG

pig install npm:@midpath/gptmitra-pi

Install with Pi

pi install npm:@midpath/gptmitra-pi
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 1.4.0 (README.md). PiG does not review it.

GPT Mitra for Pi

Use GPT Mitra's OpenAI-compatible API in Pi with per-call supplier pricing and persisted session costs.

Install

pi install npm:@midpath/gptmitra-pi
export GPTMITRA_API_KEY='your-consumer-key'

Restart Pi or run /reload. Add your model to ~/.pi/agent/models.json:

{
  "providers": {
    "gptmitra": {
      "api": "gptmitra",
      "baseUrl": "https://app.gptmitra.in/v1",
      "models": [{
        "id": "your-model-id",
        "name": "Your model",
        "input": ["text"],
        "reasoning": false,
        "contextWindow": 32768,
        "maxTokens": 4096
      }]
    }
  }
}

Select the model under the gptmitra provider. Replace the example ID and capabilities with those supported by your supplier. A consumer key needs an enabled owned or shared supplier serving that model. See GPT Mitra setup.

Keep api: gptmitra; using openai-completions bypasses cost handling. For another deployment, change baseUrl, retaining /v1.

Costs

Uses the server's final cost, or complete token usage with the response's supplier rates. Missing usage is marked unavailable, not treated as free; Pi's numeric total excludes unavailable costs and the extension warns that the total is incomplete. Costs persist in Pi sessions. No local prices or additional requests are needed.

Targets Pi's @earendil-works provider API; tested with Pi 1.4.0. This is not a budget or payment system.

Publish

From the repository, after npm login:

./pi-extension/scripts/publish.sh

Runs tests and publishes publicly. The npm prepack hook syncs the version from root VERSION.txt; no Go build is required. Bump that file before subsequent releases. To preview without publishing, pass --dry-run.