pi-chutes
Pi coding agent extension to integrate Chutes.ai as a provider.
Package details
Install pi-chutes from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-chutes- Package
pi-chutes- Version
1.1.2- Published
- Apr 28, 2026
- Downloads
- 389/mo · 378/wk
- Author
- mark182es
- License
- MIT
- Types
- extension
- Size
- 19.4 KB
- Dependencies
- 0 dependencies · 0 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
Pi Chutes Extension
A pi coding agent extension that provides access to models from Chutes.ai, a platform offering various open and proprietary LLM models via an OpenAI-compatible API.
Features
- Automatic Model Discovery: Fetches the latest models from Chutes.ai on every startup
- Offline Fallback: Uses cached models from previous fetch if API is unreachable
- Multiple Input Types: Supports both text-only and vision (text + image) models
- Reasoning Detection: Automatically identifies models with reasoning capabilities
- Cost Tracking: Preserves pricing information from the API
- Secure API Key Storage: Stores keys as
api_keytype with atomic writes and rollback
Installation
Option 1: npm (recommended)
pi install npm:pi-chutes
Then restart pi.
Option 2: Git
pi install git:github.com/mark182es/pi-chutes
Then restart pi.
Option 3: Manual
Create the directory:
mkdir -p ~/.pi/agent/extensions/pi-chutesCopy or create the
index.tsfile in that directory
Quick Start
After the extension is loaded:
# 1. Login with your API key (select Chutes.ai from the list)
/login
# 2. Select a model
/model chutes
That's it. Models are fetched automatically on every pi startup.
Usage
Login
Use the standard /login command to authenticate:
/login
Select Chutes.ai from the provider list and enter your API key when prompted (format: cpk_...). The key will be:
- Validated for correct format
- Verified against the Chutes API
- Saved securely to
~/.pi/agent/auth.json
To logout and clear credentials:
/logout chutes
Model Selection
Use the /model command to select a chutes model:
/model chutes
This will show all available chutes models in the model selector.
Automatic Model Updates
Models are fetched automatically from the Chutes API every time pi starts. No manual update command is needed. If the API is unreachable, cached models from the previous fetch are used instead.
The model cache is stored at ~/.pi/agent/extensions/pi-chutes/models.json.
Configuration
Option 1: Using /login (Recommended)
/login
Select Chutes.ai from the provider list and enter your API key. This integrates with pi's built-in authentication system.
Option 2: Environment Variable
| Variable | Description |
|---|---|
CHUTES_API_KEY |
Your API key for chutes.ai |
export CHUTES_API_KEY=cpk_...
Option 3: Auth File
Manually add your API key to ~/.pi/agent/auth.json:
{
"chutes": { "type": "api_key", "key": "cpk_..." }
}
Model Properties
The extension automatically converts these properties from the Chutes API:
| API Field | Model Property | Description |
|---|---|---|
id |
id |
Model identifier |
id |
name |
Display name |
supported_features includes "reasoning" |
reasoning |
Supports extended thinking |
input_modalities |
input |
["text"] or ["text", "image"] |
pricing.prompt |
cost.input |
Input cost per 1M tokens |
pricing.completion |
cost.output |
Output cost per 1M tokens |
pricing.input_cache_read |
cost.cacheRead |
Cache read cost per 1M tokens |
context_length / max_model_len |
contextWindow |
Context window size |
max_output_length |
maxTokens |
Maximum output tokens |
Files
index.ts— Main extension code~/.pi/agent/extensions/pi-chutes/models.json— Cached models (auto-created)
Troubleshooting
"API key contains invalid characters" error
Make sure you're entering your full API key including dots (e.g., cpk_xxx.yyy.zzz). The key format uses dot-separated segments.
"API key is invalid or unauthorized" error
- Verify your API key is correct and active at chutes.ai
- Make sure the key hasn't been revoked
- Try logging in again with
/login
Models not appearing
- Models are fetched automatically on startup — just restart pi
- If offline, cached models from the last successful fetch are used
- Check your internet connection if models seem outdated
Startup is slow
The extension fetches models from the Chutes API on startup. If the API is slow to respond, pi will take a moment longer to start. The fetched models are cached, so offline startups use the cache instantly.
Migrating from a previous version
If you previously used an older version of this extension that stored credentials in OAuth format, they will be automatically migrated to the proper api_key format on startup. No action needed.
Security
API Key Validation
- API keys are validated for length (16-512 characters)
- Only alphanumeric characters, dots, hyphens, and underscores are allowed (matching Chutes.ai key format:
cpk_<hex>.<hex>.<base64>) - Invalid keys are rejected before saving
API Key Verification
- The
/loginflow verifies your API key against the Chutes API before accepting it - This prevents storing invalid keys that would fail at runtime
Secure Credential Storage
- API keys are stored as
type: "api_key"in auth.json (not as OAuth credentials) - Credentials are written to a temporary file first, then atomically renamed
- File permissions are set to
0600(owner read/write only) - Write failures include automatic rollback to prevent corrupted auth files
Automatic Migration
- Legacy OAuth-type credentials are automatically converted to
api_keyformat on startup
Model Data Validation
- All model data from the API is validated before registration
- Invalid or malformed models are filtered out
License
This extension is provided as-is for use with pi coding agent.