pi-params
v0.1.0
Published
Per-provider-per-model parameter overrides (temperature, presence_penalty, repetition_penalty, frequency_penalty, top_k, top_p, max_token)
Readme
pi-params
A pi.dev extension that lets you set per-provider, per-model parameter overrides (temperature, top_p, top_k, frequency_penalty, etc.) by hooking into Pi's before_provider_request event.
How it works
- You define parameter overrides in
.pi/params.toml - pi-params tracks the current provider and model via the
model_selectevent - Before each provider API request, it injects your overrides into the request payload
- Overrides work with any provider — OpenAI, Anthropic, Google, OpenRouter, DeepSeek, etc.
Quick start
Copy the example config:
cp .pi/params.example.toml .pi/params.tomlEdit
.pi/params.tomlto your preferencesLoad the extension:
pi -e extensions/params.tsOr add to your project's
.pi/settings.jsonfor automatic loading:{ "extensions": ["extensions/params.ts"] }
Config format
# Global defaults — applies to ALL providers and models
["*"."*"]
temperature = 0.7
top_p = 0.9
max_tokens = 4096
# Provider-level defaults — applies to all models from this provider
["openai"."*"]
frequency_penalty = 0.0
presence_penalty = 0.0
# Per-model — applies only to this specific model on this provider
["openai"."gpt-4o"]
temperature = 0.5
max_tokens = 8192
# Cross-provider model wildcard — applies to this model on ANY provider
["*"."claude-sonnet-4-20250514"]
temperature = 0.25Merge behavior
Config entries are merged from least specific to most specific. Higher-specificity values override lower-specificity ones:
global (*/*)
↓
model wildcard (*/model)
↓
provider wildcard (provider/*)
↓
exact match (provider/model)So if you set temperature = 0.7 in */* and temperature = 0.3 in anthropic/*, all Anthropic models get temperature = 0.3.
Slash commands
Use /params commands at runtime to adjust parameters without editing the config file. These session overrides take highest priority and are applied on top of your TOML config.
| Command | Description |
|---------|-------------|
| /params | Show current provider/model and all active overrides |
| /params set <key> <value> | Set a parameter override for this session |
| /params unset <key> | Remove a specific session override |
| /params preset <name> | Apply a named preset |
| /params reset | Clear all session overrides |
Presets
| Preset | temperature | top_p | Other |
|--------|-------------|-------|-------|
| creative | 1.0 | 0.95 | — |
| precise | 0.1 | 0.1 | — |
| balanced | 0.5 | 0.8 | — |
| code | 0.2 | 0.5 | — |
| brainstorm | 1.2 | 0.95 | frequency_penalty 0.5 |
| long | — | — | max_tokens 16384 |
Priority chain (highest wins)
TOML global defaults (*/*)
↓
TOML model wildcard (*/model)
↓
TOML provider wildcard (provider/*)
↓
TOML exact match (provider/model)
↓
Session overrides (/params commands) ← highest prioritySupported parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| temperature | float (0.0–2.0) | Controls randomness. Lower = more deterministic. |
| top_p | float (0.0–1.0) | Nucleus sampling threshold. |
| top_k | integer | Top-k sampling (common with Anthropic, Google). |
| frequency_penalty | float (0.0–2.0) | Penalizes repeated tokens by frequency. |
| presence_penalty | float (0.0–2.0) | Penalizes tokens that have appeared. |
| repetition_penalty | float (0.0–2.0) | General repetition penalty. |
| max_tokens | integer | Maximum tokens in the response. |
| stop | string or string[] | Stop sequences. |
Files
| File | Purpose |
|------|---------|
| extensions/params.ts | The extension itself |
| .pi/params.toml | Your active config (create from example) |
| .pi/params.example.toml | Example config with all providers and params |
Requirements
- pi.dev CLI
- npm dependency:
smol-toml(installed vianpm installin this project)
License
MIT
