@fe-essential/pi-custom-provider-manager
v0.1.4
Published
Pi extension for managing OpenAI-compatible custom providers with /models discovery and models.dev enrichment.
Maintainers
Readme
Pi Custom Provider Manager
Pi extension for managing OpenAI-compatible custom providers from a slash command.
Features
/provider add/sync/list/show/set/delete- Discovers models from
<baseUrl>/models - Enriches model metadata from
https://models.dev/api.json - Stores provider config in an extension-owned file instead of Pi's native
models.json - Dynamically registers providers through
pi.registerProvider()
Storage
Provider config:
~/.pi/agent/extensions/custom-provider-manager/providers.jsonmodels.dev cache:
~/.pi/agent/extensions/custom-provider-manager/models-dev-cache.jsonUsage
Install/load the extension in Pi, then use:
/provider add my-gateway https://example.com/v1 MY_GATEWAY_API_KEY My Gateway
/provider sync my-gateway
/provider list
/provider show my-gateway
/provider set my-gateway baseUrl https://other.example.com/v1
/provider delete my-gatewayapiKey can be an environment variable name/reference such as:
MY_GATEWAY_API_KEY
$MY_GATEWAY_API_KEY
${MY_GATEWAY_API_KEY}For provider requests, the extension sends Authorization: Bearer <resolved key> when authHeader is enabled.
Metadata enrichment
The extension combines data from the provider /models endpoint and models.dev.
Priority:
/models fields > models.dev metadata > defaultsDetected fields include:
- Context window:
context_window,contextWindow,max_context_tokens,max_model_len,context_length,max_input_tokens,models.dev.limit.context - Output limit:
max_output_tokens,max_completion_tokens,maxTokens,models.dev.limit.output - Image input:
input,input_modalities,modalities,capabilities,models.dev.modalities.input - Reasoning:
models.dev.reasoning - Cost:
/modelsinput_cost/output_cost, plusmodels.dev.cost
Defaults:
{
"api": "openai-completions",
"contextWindow": 128000,
"maxTokens": 16384,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
}Development
pnpm install --ignore-scripts
pnpm test
pnpm run checkPublishing
This package is published to npm as:
@fe-essential/pi-custom-provider-managerPublishing is handled by GitHub Actions when a Git tag is pushed. Before publishing, make sure the repository has an npm publish token configured as a GitHub Actions secret:
NPM_TOKENTo publish a new version:
pnpm version patch # or minor / major
git push origin main --follow-tagsAlternatively, create and push a tag manually:
git tag v0.1.0
git push origin v0.1.0The workflow runs pnpm install --frozen-lockfile, pnpm run check, then publishes with:
pnpm publish --access public --provenance --no-git-checksLicense
MIT
