Configuration Reference
This page documents all configuration options available in kicode.
Configuration File
kicode stores configuration at:
~/.config/kicode/config.tomlDirectory~/.config/
Directorykicode/
- config.toml Your configuration file
Complete Configuration Example
# OpenRouter API key (required)# Get one at https://openrouter.ai/keysapi_key = "sk-or-v1-your-api-key-here"
# Default model to use (optional)# Defaults to: x-ai/grok-code-fast-1model = "anthropic/claude-3.5-sonnet"
# Safety configuration[safety]
# Additional regex patterns to flag as dangerous# These are added to the built-in patternsadditional_patterns = [ "\\bmy-risky-script\\b", "\\bdeploy-prod\\b"]
# Commands that skip confirmation prompts# Use with extreme cautionskip_confirmation = []Configuration Options
api_key
| Property | Value |
|---|---|
| Type | string |
| Required | Yes (or via OPENROUTER_API_KEY env var) |
| Default | None |
Your OpenRouter API key for authentication.
api_key = "sk-or-v1-abcd1234..."model
| Property | Value |
|---|---|
| Type | string |
| Required | No |
| Default | x-ai/grok-code-fast-1 |
The AI model to use. Must be a valid OpenRouter model ID.
model = "anthropic/claude-3.5-sonnet"See Models Reference for available options.
[safety] Section
Configuration for command safety analysis.
additional_patterns
| Property | Value |
|---|---|
| Type | array of strings |
| Required | No |
| Default | [] |
Regex patterns for commands that should be flagged as dangerous in addition to the built-in patterns.
[safety]additional_patterns = [ "\\bmy-deploy-script\\b", "\\brm.*production\\b"]skip_confirmation
| Property | Value |
|---|---|
| Type | array of strings |
| Required | No |
| Default | [] |
Commands that should skip the safety confirmation prompt. Use with extreme caution.
[safety]skip_confirmation = []Environment Variables
Environment variables override config file settings.
| Variable | Overrides | Example |
|---|---|---|
OPENROUTER_API_KEY | api_key | sk-or-v1-... |
KICODE_MODEL | model | openai/gpt-4 |
KICODE_DEBUG | (debug mode) | 1 |
Setting Environment Variables
Temporary (current session):
export OPENROUTER_API_KEY="sk-or-v1-..."kicodePermanent (add to shell profile):
# ~/.bashrc or ~/.zshrcexport OPENROUTER_API_KEY="sk-or-v1-..."Configuration Priority
Settings are resolved in this order (later wins):
- Built-in defaults
- Config file (
~/.config/kicode/config.toml) - Environment variables (
OPENROUTER_API_KEY,KICODE_MODEL) - CLI arguments (
--model)
Example:
# Config file has: model = "gpt-4"# Environment has: KICODE_MODEL="claude-3"# CLI has: --model opus
# Result: Uses "opus" (CLI wins)kicode --model opusCreating the Config File
Automatic (Setup Wizard)
Run kicode without configuration to launch the setup wizard:
kicode# Follow the interactive promptsManual
# Create config directorymkdir -p ~/.config/kicode
# Create config filecat > ~/.config/kicode/config.toml << 'EOF'api_key = "sk-or-v1-your-key-here"model = "anthropic/claude-3.5-sonnet"EOFValidating Configuration
kicode validates your configuration on startup:
kicode# If config is valid, you'll see the welcome message# If invalid, you'll see an error with detailsCommon validation errors:
| Error | Cause | Fix |
|---|---|---|
API key not found | No key in config or env | Add api_key or set OPENROUTER_API_KEY |
Invalid config file | Syntax error in TOML | Check TOML syntax |
Config File Locations by Platform
| Platform | Location |
|---|---|
| macOS | ~/.config/kicode/config.toml |
| Linux | ~/.config/kicode/config.toml |
| Windows | %APPDATA%\kicode\config.toml |
Related
- Environment Variables - All environment variables
- Models Reference - Available AI models
- Safety Reference - Safety patterns