Files
kit/configuration/index.html
T

225 lines
7.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Configuration | Kit</title>
<meta name="description" content="Configure Kit using config files, environment variables, and CLI flags.">
<link rel="canonical" href="/configuration">
<link rel="stylesheet" href="/assets/index-Di_r5hA0.css">
<script type="module" src="/assets/index-8qR0kq1Z.js"></script>
<script type="application/ld+json">{"@context":"https://schema.org","@type":"TechArticle","headline":"Configuration","description":"Configure Kit using config files, environment variables, and CLI flags.","url":"https://go-kit.dev/configuration","isPartOf":{"@type":"WebSite","name":"Kit","url":"https://go-kit.dev"}}</script>
</head>
<body>
<div id="tome-root"></div>
<div data-pagefind-body style="display:none"><h1>Configuration</h1>
# Configuration
Kit looks for configuration in the following locations, in order of priority:
1. CLI flags
2. Environment variables (with `KIT_` prefix)
3. `./.kit.yml` / `./.kit.yaml` / `./.kit.json` (project-local)
4. `~/.kit.yml` / `~/.kit.yaml` / `~/.kit.json` (global)
## Basic configuration
Create `~/.kit.yml`:
```yaml
model: anthropic/claude-sonnet-latest
max-tokens: 4096
temperature: 0.7
stream: true
```
## All configuration keys
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| `model` | string | `anthropic/claude-sonnet-latest` | Model to use (provider/model format) |
| `max-tokens` | int | `4096` | Maximum tokens in response |
| `temperature` | float | `0.7` | Randomness 0.01.0 |
| `top-p` | float | `0.95` | Nucleus sampling 0.01.0 |
| `top-k` | int | `40` | Limit top K tokens |
| `stream` | bool | `true` | Enable streaming output |
| `debug` | bool | `false` | Enable debug logging |
| `compact` | bool | `false` | Enable compact output mode |
| `system-prompt` | string | — | System prompt text or file path |
| `max-steps` | int | `0` | Maximum agent steps (0 = unlimited) |
| `thinking-level` | string | `off` | Extended thinking: off, minimal, low, medium, high |
| `provider-api-key` | string | — | API key for the provider |
| `provider-url` | string | — | Base URL for provider API |
| `tls-skip-verify` | bool | `false` | Skip TLS certificate verification |
| `frequency-penalty` | float | `0.0` | Penalize frequent tokens (0.02.0) |
| `presence-penalty` | float | `0.0` | Penalize present tokens (0.02.0) |
| `stop-sequences` | list | — | Custom stop sequences |
| `theme` | object or string | — | UI theme ([inline overrides or file path](/themes)) |
| `prompt-templates` | bool | `true` | Enable prompt template loading |
| `prompt-template` | string | — | Specific template to load by name |
## Environment variables
Any configuration key can be set via environment variable with the `KIT_` prefix. Hyphens become underscores:
```bash
export KIT_MODEL="openai/gpt-4o"
export KIT_MAX_TOKENS="8192"
export KIT_TEMPERATURE="0.5"
```
Provider API keys use their own environment variables:
```bash
export ANTHROPIC_API_KEY="sk-..."
export OPENAI_API_KEY="sk-..."
export GOOGLE_API_KEY="..."
```
## MCP server configuration
Add external MCP servers to your `.kit.yml`:
```yaml
mcpServers:
filesystem:
type: local
command: ["npx", "-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed"]
environment:
LOG_LEVEL: "info"
allowedTools: ["read_file", "write_file"]
excludedTools: ["delete_file"]
search:
type: remote
url: "https://mcp.example.com/search"
```
### MCP server fields
| Field | Type | Description |
|-------|------|-------------|
| `type` | string | `local` (stdio) or `remote` (streamable HTTP) |
| `command` | list | Command and args for local servers |
| `environment` | map | Environment variables for the server process |
| `url` | string | URL for remote servers |
| `allowedTools` | list | Whitelist of tool names to expose |
| `excludedTools` | list | Blacklist of tool names to hide |
A legacy format with `transport`, `args`, `env`, and `headers` fields is also supported.
## Custom models
Define custom models in your `.kit.yml` for use with the `custom` provider. This is useful for self-hosted models or API endpoints not in the built-in database:
```yaml
customModels:
my-model:
name: "My Custom Model"
baseUrl: "http://localhost:8080/v1"
apiKey: "my-secret-key"
reasoning: true
temperature: true
cost:
input: 0.002
output: 0.004
limit:
context: 128000
output: 32000
```
### Custom model fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | Yes | Display name for the model |
| `baseUrl` | string | No | Per-model base URL override; when set, `--provider-url` is not required |
| `apiKey` | string | No | Per-model API key override |
| `reasoning` | bool | No | Whether the model supports reasoning/thinking |
| `temperature` | bool | No | Whether the model supports temperature adjustment |
| `cost.input` | float | No | Cost per 1K input tokens |
| `cost.output` | float | No | Cost per 1K output tokens |
| `limit.context` | int | Yes | Maximum context window in tokens |
| `limit.output` | int | No | Maximum output tokens |
Use with a per-model `baseUrl` (no `--provider-url` needed):
```bash
kit --model custom/my-model "Hello"
```
Or override the base URL at runtime:
```bash
kit --provider-url "http://localhost:8080/v1" --model custom/my-model "Hello"
```
When `--provider-url` is specified without `--model`, Kit defaults to `custom/custom` which has zero cost tracking and a 262K context window.
## Per-model settings
Override generation parameters and system prompt on a per-model basis using `modelSettings`:
```yaml
modelSettings:
anthropic/claude-sonnet-4-5-20250929:
temperature: 0.3
maxTokens: 8192
systemPrompt: "You are a concise coding assistant."
openai/gpt-4o:
temperature: 0.7
frequencyPenalty: 0.5
```
### Per-model fields
| Field | Type | Description |
|-------|------|-------------|
| `temperature` | float | Temperature override for this model |
| `maxTokens` | int | Max output tokens override |
| `topP` | float | Top-p override |
| `topK` | int | Top-k override |
| `frequencyPenalty` | float | Frequency penalty override |
| `presencePenalty` | float | Presence penalty override |
| `stopSequences` | list | Stop sequences override |
| `thinkingLevel` | string | Thinking level override |
| `systemPrompt` | string | Per-model system prompt (used when no explicit prompt is set) |
Settings from `modelSettings` and `customModels.params` act as model-level defaults — explicit CLI flags and global config values always take precedence.
When switching models via `/model` or `SetModel()`, if the new model has a per-model system prompt and no custom global prompt was set, the per-model prompt automatically replaces the previous one.
## Theme configuration
```yaml
# Inline partial overrides (unspecified fields inherit from default)
theme:
primary:
light: "#8839ef"
dark: "#cba6f7"
error:
dark: "#FF0000"
```
```yaml
# Reference external theme file
theme: "./themes/my-custom-theme.yml"
```
See [Themes](/themes) for the full theme file format, built-in themes, and the extension theme API.
## Preferences persistence
Kit automatically saves your UI preferences across sessions to `~/.config/kit/preferences.yml`:
- **Theme** — Set via `/theme <name>` or `ctx.SetTheme()`
- **Model** — Set via `/model <name>` or the model selector
- **Thinking level** — Set via `/thinking <level>` or Shift+Tab cycling
These preferences are restored on next launch. Precedence (highest to lowest):
1. CLI flags (`--model`, `--thinking-level`)
2. Config file (`model:`, `thinking-level:`)
3. Saved preferences (`~/.config/kit/preferences.yml`)
4. Default values</div>
</body>
</html>