ccr preset
Manage presets - configuration templates that can be shared and reused.
Overview
Presets allow you to:
- Save your current configuration as a reusable template
- Share configurations with others
- Install pre-configured setups from the community
- Switch between different configurations easily
Commands
export
Export your current configuration as a preset.
ccr preset export <name> [options]
Options:
--output <path>- Custom output directory path--description <text>- Preset description--author <name>- Preset author--tags <tags>- Comma-separated keywords--include-sensitive- Include API keys and sensitive data (not recommended)
Example:
ccr preset export my-config --description "My production setup" --author "Your Name"
What happens:
- Reads current configuration from
~/.claude-code-router/config.json - Prompts for description, author, and keywords (if not provided)
- Sanitizes sensitive fields (API keys become placeholders)
- Creates preset directory at
~/.claude-code-router/presets/<name>/ - Generates
manifest.jsonwith configuration and metadata
install
Install a preset from a local directory.
ccr preset install <source>
Sources:
- Local directory path:
/path/to/preset-directory - Preset name (for reconfiguring an already installed preset):
preset-name
Example:
# Install from directory
ccr preset install ./my-preset
# Reconfigure an installed preset
ccr preset install my-preset
What happens:
- Reads
manifest.jsonfrom the preset directory - Validates the preset structure
- If the preset has a
schema, prompts for required values (API keys, etc.) - Copies preset to
~/.claude-code-router/presets/<name>/ - Saves user inputs in
manifest.json
Note: URL installation is not currently supported. Download the preset directory first.
list
List all installed presets.
ccr preset list
Example output:
Available presets:
• my-config (v1.0.0)
My production setup
by Your Name
• openai-setup
Basic OpenAI configuration
info
Show detailed information about a preset.
ccr preset info <name>
Shows:
- Version, description, author, keywords
- Configuration summary (Providers, Router rules)
- Required inputs (if any)
Example:
ccr preset info my-config
delete / rm / remove
Delete an installed preset.
ccr preset delete <name>
ccr preset rm <name>
ccr preset remove <name>
Example:
ccr preset delete my-config
Preset Structure
A preset is a directory containing a manifest.json file:
{
"name": "my-preset",
"version": "1.0.0",
"description": "My configuration",
"author": "Author Name",
"keywords": ["openai", "production"],
"Providers": [
{
"name": "openai",
"api_base_url": "https://api.openai.com/v1/chat/completions",
"api_key": "{{apiKey}}",
"models": ["gpt-4", "gpt-3.5-turbo"]
}
],
"Router": {
"default": "openai,gpt-4"
},
"schema": [
{
"id": "apiKey",
"type": "password",
"label": "OpenAI API Key",
"prompt": "Enter your OpenAI API key"
}
]
}
Schema System
The schema field defines inputs that users must provide during installation:
Field types:
password- Hidden input (for API keys)input- Text inputselect- Single selection from optionsmultiselect- Multiple selectionconfirm- Yes/No confirmationeditor- Multi-line textnumber- Numeric input
Dynamic options:
{
"id": "provider",
"type": "select",
"label": "Select Provider",
"options": {
"type": "providers"
}
}
Conditional fields:
{
"id": "model",
"type": "select",
"label": "Select Model",
"when": {
"field": "provider",
"operator": "exists"
},
"options": {
"type": "models",
"providerField": "#{selectedProvider}"
}
}
Sharing Presets
To share a preset:
-
Export your configuration:
ccr preset export my-preset -
Share the directory:
~/.claude-code-router/presets/my-preset/ -
Distribution methods:
- Upload to GitHub repository
- Create a GitHub Gist
- Share as a zip file
- Publish on npm (future feature)
-
Users install with:
ccr preset install /path/to/my-preset
Security
Automatic Sanitization
By default, export sanitizes sensitive fields:
- Fields named
api_key,apikey,password,secretare replaced with{{fieldName}}placeholders - These placeholders become required inputs in the schema
- Users are prompted to provide their own values during installation
Include Sensitive Data
To include actual values (not recommended):
ccr preset export my-preset --include-sensitive
Warning: Never share presets containing sensitive data!
Related Documentation
- Configuration Guide - Basic configuration
- Project-Level Configuration - Project-specific settings
- Presets - Advanced preset topics