@midpath/gptmitra-pi
GPT Mitra provider for Pi with per-call supplier pricing and persisted session costs
Package details
Install @midpath/gptmitra-pi from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@midpath/gptmitra-pi- Package
@midpath/gptmitra-pi- Version
1.4.0- Published
- Nov 1, 2026
- Downloads
- 289/mo · 289/wk
- Author
- midpath
- License
- MIT
- Types
- extension
- Size
- 8 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
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.