Install
Install with PiG
pig install npm:@adix7/pi-vllm-model-fetcherInstall with Pi
pi install npm:@adix7/pi-vllm-model-fetcherPackages 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": [
"./src/index.ts"
]
}README
Written by the package's publisher, shown as published in version 1.1.0 (README.md). PiG does not review it.
Remote vLLM Provider Plugin
A pi agent plugin that connects to multiple vLLM instances, queries available models from each, and dynamically registers them as providers using the OpenAI-compatible streaming API.
Install
Requires Pi 0.73.1 or later:
pi install npm:@adix7/pi-vllm-model-fetcher
Configuration
Add the following to your ~/.pi/agent/settings.json:
{
"remote-providers": {
"providers": {
"local": {
"url": "http://localhost:8000",
"apiKey": "your-api-key"
},
"remote-cluster": {
"url": "https://vllm.company.com",
"apiKey": "another-key"
}
}
}
}
Fields
remote-providers(required): Object containingprovidersmap and optionalmodelOptionsproviders(required): Object with server names as keys- Each server config contains:
url(required): vLLM server URL;/v1is appended unless already present (trailing slashes are accepted)apiKey(optional): Literal API key or environment-variable name, resolved for both model discovery and inferenceoptional(optional): If true, server errors won't block registration. Useful for non-critical providers.disabled(optional): If true, the provider is completely skipped. Useful for temporarily disabling a provider without removing its configuration.modelOptions(optional): Pattern-matched model options for this providerfetchTimeout.timeoutMs(optional): Positive model-discovery timeout in milliseconds (default: 1000 required, 500 optional)
- Each server config contains:
modelOptions(optional): Global pattern-matched model options
- Server names become provider prefixes (e.g.,
local/model-name,remote-cluster/model-name)
Model Options
Model options define model behavior. Available options:
maxTokens(optional): Maximum tokens per generation (default: 16384)contextWindow(optional): Context window size in tokens (default: 128000)reasoning(optional): Whether model has reasoning capabilities (default: false)input(optional): Input modalities (default:["text"])
Options use pattern matching under remote-providers.modelOptions (global) or remote-providers.providers.[name].modelOptions (provider-specific):
- Exact match:
"meta-llama/Meta-Llama-3.1-8B-Instruct": { ... } - Wildcard pattern:
"Qwen/*": { ... }matches any model starting withQwen/ - Wildcard
*must be at the end only
Context Window Priority (lowest → highest):
- Hardcoded fallback (
128,000) max_model_lenfrom vLLM API response- Global
modelOptionspatterns - Provider
modelOptionspatterns
Other options (maxTokens, reasoning, input) use pattern priority:
- Hardcoded defaults
- Global
modelOptionspatterns - Provider
modelOptionspatterns
Patterns match against model IDs from vLLM API (no provider prefix).
Global modelOptions Example
{
"remote-providers": {
"modelOptions": {
"meta-llama/Meta-Llama-3.1-8B-Instruct": {
"reasoning": true,
"contextWindow": 131072
},
"Qwen/*": {
"maxTokens": 65536
}
}
}
}
Provider-Specific modelOptions Example
{
"remote-providers": {
"providers": {
"grace": {
"url": "http://192.168.0.100:8000/v1",
"modelOptions": {
"meta-llama/Meta-Llama-3.1-8B-Instruct": {
"reasoning": true,
"contextWindow": 131072
},
"Qwen/*": {
"reasoning": true,
"compat": {
"supportsDeveloperRole": false,
"thinkingFormat": "qwen"
}
}
}
}
}
}
}
Usage
- Start your vLLM instances
- Configure
settings.jsonwith all server endpoints - Restart pi agent or run
/reload-remote-providers - Use
/modelto select from available providers
The plugin will:
- Fetch available models from each server's
GET {normalized-url}/models(normally/v1/models) - Register each server as a distinct provider
- On Pi 1.5+, support on-demand model discovery through
ctx.modelRegistry.refresh({ providers: ["grace"], force: true, allowNetwork: true, signal }); useful when a vLLM server loads a new model while Pi is running - Skip servers with no models
- Report errors for unreachable required servers; optional servers fail silently
Example
# Start local vLLM
vllm serve meta-llama/Meta-Llama-3.1-8B-Instruct --port 8000
# In pi agent:
/model
# Select from: local/meta-llama/Meta-Llama-3.1-8B-Instruct
# remote-cluster/other-model
Optional Providers
Set optional: true for providers that shouldn't block startup if unavailable:
{
"remote-providers": {
"providers": {
"local": {
"url": "http://localhost:8000",
"apiKey": "your-api-key"
},
"backup": {
"url": "https://backup-vllm.example.com",
"apiKey": "backup-key",
"optional": true
}
}
}
}
With optional: true, the backup provider will be skipped silently if unreachable, without showing error notifications.
Disabled Providers
Set disabled: true to completely skip a provider without removing its configuration:
{
"remote-providers": {
"providers": {
"local": {
"url": "http://localhost:8000",
"apiKey": "your-api-key"
},
"maintenance": {
"url": "https://vllm.maintenance.example.com",
"apiKey": "temp-key",
"disabled": true
}
}
}
}
Disabled providers are completely ignored during startup and reload. They do not appear in the UI and never generate errors.
Reload Providers
You can reload remote providers without restarting the pi agent:
/reload-remote-providers
This command:
- Re-reads
settings.json - Re-fetches models from all configured servers
- Re-registers providers with updated models and removes deleted, disabled, empty, or failed providers
- Shows notifications for required-provider errors
Use this after:
- Adding/removing servers from
settings.json - Loading/unloading models on remote servers
- Updating API keys
- Changing modelOptions configurations
Troubleshooting
- Error: "No providers configured in settings.json.": Add
remote-providers.providersto~/.pi/agent/settings.json - Error: "Failed to register N server(s)": Check that unreachable servers are running and URLs are correct
- No models listed: Check that the server has loaded models and its URL is correct
- Reload not working: Ensure you're using Pi 0.73.1 or later
How It Works
- During extension loading, reads
~/.pi/agent/settings.json - Fetches required servers'
/v1/modelsbefore startup; optional servers load in the background - Registers each server as a provider using Pi's OpenAI-compatible streaming API
- Removes stale providers when reloading or when a server returns no models
- Shows startup notifications for required-provider failures
License
MIT