@openadapter/koda 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4448 -0
- package/README.md +665 -0
- package/dist/bun/cli.d.ts +2 -0
- package/dist/bun/cli.js +2 -0
- package/dist/bun/register-bedrock.d.ts +1 -0
- package/dist/bun/register-bedrock.js +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +12 -0
- package/dist/bun/restore-sandbox-env.js +1 -0
- package/dist/cli/args.d.ts +55 -0
- package/dist/cli/args.js +167 -0
- package/dist/cli/config-selector.d.ts +13 -0
- package/dist/cli/config-selector.js +1 -0
- package/dist/cli/file-processor.d.ts +14 -0
- package/dist/cli/file-processor.js +7 -0
- package/dist/cli/import-sessions.d.ts +34 -0
- package/dist/cli/import-sessions.js +6 -0
- package/dist/cli/initial-message.d.ts +17 -0
- package/dist/cli/initial-message.js +1 -0
- package/dist/cli/list-models.d.ts +8 -0
- package/dist/cli/list-models.js +2 -0
- package/dist/cli/openadapter-setup.d.ts +29 -0
- package/dist/cli/openadapter-setup.js +3 -0
- package/dist/cli/session-picker.d.ts +8 -0
- package/dist/cli/session-picker.js +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +2 -0
- package/dist/config.d.ts +92 -0
- package/dist/config.js +1 -0
- package/dist/core/agent-session-runtime.d.ts +116 -0
- package/dist/core/agent-session-runtime.js +1 -0
- package/dist/core/agent-session-services.d.ts +86 -0
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session.d.ts +747 -0
- package/dist/core/agent-session.js +32 -0
- package/dist/core/auth-guidance.d.ts +4 -0
- package/dist/core/auth-guidance.js +8 -0
- package/dist/core/auth-storage.d.ts +140 -0
- package/dist/core/auth-storage.js +1 -0
- package/dist/core/bash-executor.d.ts +31 -0
- package/dist/core/bash-executor.js +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +89 -0
- package/dist/core/compaction/branch-summarization.js +38 -0
- package/dist/core/compaction/compaction.d.ts +120 -0
- package/dist/core/compaction/compaction.js +104 -0
- package/dist/core/compaction/index.d.ts +6 -0
- package/dist/core/compaction/index.js +1 -0
- package/dist/core/compaction/utils.d.ts +37 -0
- package/dist/core/compaction/utils.js +19 -0
- package/dist/core/defaults.d.ts +2 -0
- package/dist/core/defaults.js +1 -0
- package/dist/core/diagnostics.d.ts +14 -0
- package/dist/core/diagnostics.js +0 -0
- package/dist/core/event-bus.d.ts +8 -0
- package/dist/core/event-bus.js +1 -0
- package/dist/core/exec.d.ts +28 -0
- package/dist/core/exec.js +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +21 -0
- package/dist/core/export-html/ansi-to-html.js +1 -0
- package/dist/core/export-html/index.d.ts +36 -0
- package/dist/core/export-html/index.js +2 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +72 -0
- package/dist/core/export-html/tool-renderer.d.ts +33 -0
- package/dist/core/export-html/tool-renderer.js +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +8 -0
- package/dist/core/export-html/vendor/marked.min.js +56 -0
- package/dist/core/extensions/index.d.ts +11 -0
- package/dist/core/extensions/index.js +1 -0
- package/dist/core/extensions/loader.d.ts +23 -0
- package/dist/core/extensions/loader.js +1 -0
- package/dist/core/extensions/runner.d.ts +160 -0
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/types.d.ts +1180 -0
- package/dist/core/extensions/types.js +1 -0
- package/dist/core/extensions/wrapper.d.ts +19 -0
- package/dist/core/extensions/wrapper.js +1 -0
- package/dist/core/footer-data-provider.d.ts +53 -0
- package/dist/core/footer-data-provider.js +1 -0
- package/dist/core/http-dispatcher.d.ts +20 -0
- package/dist/core/http-dispatcher.js +1 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/index.js +1 -0
- package/dist/core/keybindings.d.ts +352 -0
- package/dist/core/keybindings.js +1 -0
- package/dist/core/messages.d.ts +76 -0
- package/dist/core/messages.js +17 -0
- package/dist/core/model-registry.d.ts +149 -0
- package/dist/core/model-registry.js +9 -0
- package/dist/core/model-resolver.d.ts +109 -0
- package/dist/core/model-resolver.js +1 -0
- package/dist/core/output-guard.d.ts +6 -0
- package/dist/core/output-guard.js +1 -0
- package/dist/core/package-manager.d.ts +203 -0
- package/dist/core/package-manager.js +3 -0
- package/dist/core/prompt-templates.d.ts +51 -0
- package/dist/core/prompt-templates.js +2 -0
- package/dist/core/provider-attribution.d.ts +3 -0
- package/dist/core/provider-attribution.js +1 -0
- package/dist/core/provider-display-names.d.ts +1 -0
- package/dist/core/provider-display-names.js +1 -0
- package/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/core/resolve-config-value.js +1 -0
- package/dist/core/resource-loader.d.ts +193 -0
- package/dist/core/resource-loader.js +1 -0
- package/dist/core/sdk.d.ts +108 -0
- package/dist/core/sdk.js +1 -0
- package/dist/core/session-cwd.d.ts +18 -0
- package/dist/core/session-cwd.js +7 -0
- package/dist/core/session-manager.d.ts +331 -0
- package/dist/core/session-manager.js +11 -0
- package/dist/core/settings-manager.d.ts +265 -0
- package/dist/core/settings-manager.js +1 -0
- package/dist/core/skills.d.ts +59 -0
- package/dist/core/skills.js +4 -0
- package/dist/core/slash-commands.d.ts +13 -0
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/source-info.d.ts +17 -0
- package/dist/core/source-info.js +1 -0
- package/dist/core/system-prompt.d.ts +27 -0
- package/dist/core/system-prompt.js +52 -0
- package/dist/core/telemetry.d.ts +2 -0
- package/dist/core/telemetry.js +1 -0
- package/dist/core/timings.d.ts +7 -0
- package/dist/core/timings.js +3 -0
- package/dist/core/tools/bash.d.ts +67 -0
- package/dist/core/tools/bash.js +18 -0
- package/dist/core/tools/edit-diff.d.ts +86 -0
- package/dist/core/tools/edit-diff.js +16 -0
- package/dist/core/tools/edit.d.ts +50 -0
- package/dist/core/tools/edit.js +2 -0
- package/dist/core/tools/file-mutation-queue.d.ts +5 -0
- package/dist/core/tools/file-mutation-queue.js +1 -0
- package/dist/core/tools/find.d.ts +34 -0
- package/dist/core/tools/find.js +13 -0
- package/dist/core/tools/grep.d.ts +36 -0
- package/dist/core/tools/grep.js +13 -0
- package/dist/core/tools/index.d.ts +39 -0
- package/dist/core/tools/index.js +1 -0
- package/dist/core/tools/ls.d.ts +36 -0
- package/dist/core/tools/ls.js +9 -0
- package/dist/core/tools/output-accumulator.d.ts +51 -0
- package/dist/core/tools/output-accumulator.js +4 -0
- package/dist/core/tools/path-utils.d.ts +9 -0
- package/dist/core/tools/path-utils.js +1 -0
- package/dist/core/tools/read.d.ts +34 -0
- package/dist/core/tools/read.js +22 -0
- package/dist/core/tools/render-utils.d.ts +23 -0
- package/dist/core/tools/render-utils.js +4 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +13 -0
- package/dist/core/tools/tool-definition-wrapper.js +1 -0
- package/dist/core/tools/truncate.d.ts +69 -0
- package/dist/core/tools/truncate.js +5 -0
- package/dist/core/tools/write.d.ts +25 -0
- package/dist/core/tools/write.js +13 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +1 -0
- package/dist/main.d.ts +11 -0
- package/dist/main.js +1 -0
- package/dist/migrations.d.ts +32 -0
- package/dist/migrations.js +8 -0
- package/dist/modes/index.d.ts +8 -0
- package/dist/modes/index.js +1 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/armin.d.ts +33 -0
- package/dist/modes/interactive/components/armin.js +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +19 -0
- package/dist/modes/interactive/components/assistant-message.js +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +33 -0
- package/dist/modes/interactive/components/bash-execution.js +13 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +15 -0
- package/dist/modes/interactive/components/bordered-loader.js +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/branch-summary-message.js +3 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +3 -0
- package/dist/modes/interactive/components/config-selector.d.ts +70 -0
- package/dist/modes/interactive/components/config-selector.js +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +13 -0
- package/dist/modes/interactive/components/countdown-timer.js +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +20 -0
- package/dist/modes/interactive/components/custom-editor.js +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +19 -0
- package/dist/modes/interactive/components/custom-message.js +2 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +22 -0
- package/dist/modes/interactive/components/daxnuts.js +1 -0
- package/dist/modes/interactive/components/diff.d.ts +11 -0
- package/dist/modes/interactive/components/diff.js +3 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +14 -0
- package/dist/modes/interactive/components/dynamic-border.js +1 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +4 -0
- package/dist/modes/interactive/components/earendil-announcement.js +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +19 -0
- package/dist/modes/interactive/components/extension-editor.js +3 -0
- package/dist/modes/interactive/components/extension-input.d.ts +22 -0
- package/dist/modes/interactive/components/extension-input.js +2 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +25 -0
- package/dist/modes/interactive/components/extension-selector.js +2 -0
- package/dist/modes/interactive/components/footer.d.ts +27 -0
- package/dist/modes/interactive/components/footer.js +1 -0
- package/dist/modes/interactive/components/index.d.ts +31 -0
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +12 -0
- package/dist/modes/interactive/components/keybinding-hints.js +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +51 -0
- package/dist/modes/interactive/components/login-dialog.js +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +46 -0
- package/dist/modes/interactive/components/model-selector.js +2 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +30 -0
- package/dist/modes/interactive/components/oauth-selector.js +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +41 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +22 -0
- package/dist/modes/interactive/components/session-selector-search.js +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/modes/interactive/components/session-selector.js +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +68 -0
- package/dist/modes/interactive/components/settings-selector.js +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +9 -0
- package/dist/modes/interactive/components/show-images-selector.js +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +16 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +3 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +10 -0
- package/dist/modes/interactive/components/theme-selector.js +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +10 -0
- package/dist/modes/interactive/components/thinking-selector.js +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +62 -0
- package/dist/modes/interactive/components/tool-execution.js +4 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +88 -0
- package/dist/modes/interactive/components/tree-selector.js +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +29 -0
- package/dist/modes/interactive/components/user-message-selector.js +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/dist/modes/interactive/components/user-message.js +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +23 -0
- package/dist/modes/interactive/components/visual-truncate.js +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +417 -0
- package/dist/modes/interactive/interactive-mode.js +116 -0
- package/dist/modes/interactive/theme/dark.json +86 -0
- package/dist/modes/interactive/theme/light.json +85 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +101 -0
- package/dist/modes/interactive/theme/theme.js +18 -0
- package/dist/modes/print-mode.d.ts +27 -0
- package/dist/modes/print-mode.js +4 -0
- package/dist/modes/rpc/jsonl.d.ts +16 -0
- package/dist/modes/rpc/jsonl.js +3 -0
- package/dist/modes/rpc/rpc-client.d.ts +226 -0
- package/dist/modes/rpc/rpc-client.js +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +19 -0
- package/dist/modes/rpc/rpc-mode.js +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +419 -0
- package/dist/modes/rpc/rpc-types.js +0 -0
- package/dist/package-manager-cli.d.ts +3 -0
- package/dist/package-manager-cli.js +49 -0
- package/dist/utils/ansi.d.ts +1 -0
- package/dist/utils/ansi.js +1 -0
- package/dist/utils/auto-update.d.ts +13 -0
- package/dist/utils/auto-update.js +1 -0
- package/dist/utils/changelog.d.ts +20 -0
- package/dist/utils/changelog.js +4 -0
- package/dist/utils/child-process.d.ts +14 -0
- package/dist/utils/child-process.js +1 -0
- package/dist/utils/clipboard-image.d.ts +10 -0
- package/dist/utils/clipboard-image.js +1 -0
- package/dist/utils/clipboard-native.d.ts +9 -0
- package/dist/utils/clipboard-native.js +1 -0
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.js +1 -0
- package/dist/utils/deprecation.d.ts +3 -0
- package/dist/utils/deprecation.js +1 -0
- package/dist/utils/exif-orientation.d.ts +4 -0
- package/dist/utils/exif-orientation.js +1 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/frontmatter.js +4 -0
- package/dist/utils/fs-watch.d.ts +4 -0
- package/dist/utils/fs-watch.js +1 -0
- package/dist/utils/git.d.ts +25 -0
- package/dist/utils/git.js +1 -0
- package/dist/utils/html.d.ts +6 -0
- package/dist/utils/html.js +1 -0
- package/dist/utils/image-convert.d.ts +8 -0
- package/dist/utils/image-convert.js +1 -0
- package/dist/utils/image-resize-core.d.ts +29 -0
- package/dist/utils/image-resize-core.js +1 -0
- package/dist/utils/image-resize-worker.d.ts +1 -0
- package/dist/utils/image-resize-worker.js +1 -0
- package/dist/utils/image-resize.d.ts +15 -0
- package/dist/utils/image-resize.js +1 -0
- package/dist/utils/json.d.ts +2 -0
- package/dist/utils/json.js +1 -0
- package/dist/utils/koda-user-agent.d.ts +1 -0
- package/dist/utils/koda-user-agent.js +1 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/mime.js +1 -0
- package/dist/utils/paths.d.ts +30 -0
- package/dist/utils/paths.js +1 -0
- package/dist/utils/photon.d.ts +20 -0
- package/dist/utils/photon.js +1 -0
- package/dist/utils/shell.d.ts +29 -0
- package/dist/utils/shell.js +8 -0
- package/dist/utils/sleep.d.ts +4 -0
- package/dist/utils/sleep.js +1 -0
- package/dist/utils/syntax-highlight.d.ts +11 -0
- package/dist/utils/syntax-highlight.js +2 -0
- package/dist/utils/tools-manager.d.ts +2 -0
- package/dist/utils/tools-manager.js +1 -0
- package/dist/utils/version-check.d.ts +14 -0
- package/dist/utils/version-check.js +1 -0
- package/dist/utils/windows-self-update.d.ts +2 -0
- package/dist/utils/windows-self-update.js +1 -0
- package/docs/compaction.md +394 -0
- package/docs/custom-provider.md +736 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +148 -0
- package/docs/extensions.md +2626 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +80 -0
- package/docs/json.md +82 -0
- package/docs/keybindings.md +197 -0
- package/docs/models.md +493 -0
- package/docs/packages.md +226 -0
- package/docs/prompt-templates.md +88 -0
- package/docs/providers.md +253 -0
- package/docs/quickstart.md +165 -0
- package/docs/rpc.md +1408 -0
- package/docs/sdk.md +1137 -0
- package/docs/session-format.md +412 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +281 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +231 -0
- package/docs/terminal-setup.md +114 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +295 -0
- package/docs/tmux.md +61 -0
- package/docs/tui.md +927 -0
- package/docs/usage.md +288 -0
- package/docs/windows.md +17 -0
- package/npm-shrinkwrap.json +1792 -0
- package/openadapter/extensions/koda-ask.js +12 -0
- package/openadapter/extensions/koda-bg.js +14 -0
- package/openadapter/extensions/koda-commands.mjs +15 -0
- package/openadapter/extensions/koda-help.js +8 -0
- package/openadapter/extensions/koda-memory.js +16 -0
- package/openadapter/extensions/koda-status.js +1 -0
- package/openadapter/extensions/koda-todo.js +4 -0
- package/openadapter/extensions/koda-vision.js +4 -0
- package/openadapter/extensions/koda-web.js +7 -0
- package/openadapter/setup.mjs +173 -0
- package/openadapter/skills/code-review/SKILL.md +22 -0
- package/openadapter/skills/debugging/SKILL.md +28 -0
- package/openadapter/skills/frontend/SKILL.md +38 -0
- package/package.json +108 -0
package/docs/models.md
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
# Custom Models
|
|
2
|
+
|
|
3
|
+
Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.pi/agent/models.json`.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Minimal Example](#minimal-example)
|
|
8
|
+
- [Full Example](#full-example)
|
|
9
|
+
- [Supported APIs](#supported-apis)
|
|
10
|
+
- [Provider Configuration](#provider-configuration)
|
|
11
|
+
- [Model Configuration](#model-configuration)
|
|
12
|
+
- [Overriding Built-in Providers](#overriding-built-in-providers)
|
|
13
|
+
- [Per-model Overrides](#per-model-overrides)
|
|
14
|
+
- [Anthropic Messages Compatibility](#anthropic-messages-compatibility)
|
|
15
|
+
- [OpenAI Compatibility](#openai-compatibility)
|
|
16
|
+
|
|
17
|
+
## Minimal Example
|
|
18
|
+
|
|
19
|
+
For local models (Ollama, LM Studio, vLLM), only `id` is required per model:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"providers": {
|
|
24
|
+
"ollama": {
|
|
25
|
+
"baseUrl": "http://localhost:11434/v1",
|
|
26
|
+
"api": "openai-completions",
|
|
27
|
+
"apiKey": "ollama",
|
|
28
|
+
"models": [
|
|
29
|
+
{ "id": "llama3.1:8b" },
|
|
30
|
+
{ "id": "qwen2.5-coder:7b" }
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The `apiKey` is required but Ollama ignores it, so any value works.
|
|
38
|
+
|
|
39
|
+
Some OpenAI-compatible servers do not understand the `developer` role used for reasoning-capable models. For those providers, set `compat.supportsDeveloperRole` to `false` so pi sends the system prompt as a `system` message instead. If the server also does not support `reasoning_effort`, set `compat.supportsReasoningEffort` to `false` too.
|
|
40
|
+
|
|
41
|
+
You can set `compat` at the provider level to apply to all models, or at the model level to override a specific model. This commonly applies to Ollama, vLLM, SGLang, and similar OpenAI-compatible servers.
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"providers": {
|
|
46
|
+
"ollama": {
|
|
47
|
+
"baseUrl": "http://localhost:11434/v1",
|
|
48
|
+
"api": "openai-completions",
|
|
49
|
+
"apiKey": "ollama",
|
|
50
|
+
"compat": {
|
|
51
|
+
"supportsDeveloperRole": false,
|
|
52
|
+
"supportsReasoningEffort": false
|
|
53
|
+
},
|
|
54
|
+
"models": [
|
|
55
|
+
{
|
|
56
|
+
"id": "gpt-oss:20b",
|
|
57
|
+
"reasoning": true
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Full Example
|
|
66
|
+
|
|
67
|
+
Override defaults when you need specific values:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"providers": {
|
|
72
|
+
"ollama": {
|
|
73
|
+
"baseUrl": "http://localhost:11434/v1",
|
|
74
|
+
"api": "openai-completions",
|
|
75
|
+
"apiKey": "ollama",
|
|
76
|
+
"models": [
|
|
77
|
+
{
|
|
78
|
+
"id": "llama3.1:8b",
|
|
79
|
+
"name": "Llama 3.1 8B (Local)",
|
|
80
|
+
"reasoning": false,
|
|
81
|
+
"input": ["text"],
|
|
82
|
+
"contextWindow": 128000,
|
|
83
|
+
"maxTokens": 32000,
|
|
84
|
+
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The file reloads each time you open `/model`. Edit during session; no restart needed.
|
|
93
|
+
|
|
94
|
+
## Google AI Studio Example
|
|
95
|
+
|
|
96
|
+
Use `google-generative-ai` with a `baseUrl` to add models from Google AI Studio, including custom Gemma 4 entries:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"providers": {
|
|
101
|
+
"my-google": {
|
|
102
|
+
"baseUrl": "https://generativelanguage.googleapis.com/v1beta",
|
|
103
|
+
"api": "google-generative-ai",
|
|
104
|
+
"apiKey": "$GEMINI_API_KEY",
|
|
105
|
+
"models": [
|
|
106
|
+
{
|
|
107
|
+
"id": "gemma-4-31b-it",
|
|
108
|
+
"name": "Gemma 4 31B",
|
|
109
|
+
"input": ["text", "image"],
|
|
110
|
+
"contextWindow": 262144,
|
|
111
|
+
"reasoning": true
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The `baseUrl` is required when adding custom models to the `google-generative-ai` API type.
|
|
120
|
+
|
|
121
|
+
## Supported APIs
|
|
122
|
+
|
|
123
|
+
| API | Description |
|
|
124
|
+
|-----|-------------|
|
|
125
|
+
| `openai-completions` | OpenAI Chat Completions (most compatible) |
|
|
126
|
+
| `openai-responses` | OpenAI Responses API |
|
|
127
|
+
| `anthropic-messages` | Anthropic Messages API |
|
|
128
|
+
| `google-generative-ai` | Google Generative AI |
|
|
129
|
+
|
|
130
|
+
Set `api` at provider level (default for all models) or model level (override per model).
|
|
131
|
+
|
|
132
|
+
## Provider Configuration
|
|
133
|
+
|
|
134
|
+
| Field | Description |
|
|
135
|
+
|-------|-------------|
|
|
136
|
+
| `baseUrl` | API endpoint URL |
|
|
137
|
+
| `api` | API type (see above) |
|
|
138
|
+
| `apiKey` | API key (see value resolution below) |
|
|
139
|
+
| `headers` | Custom headers (see value resolution below) |
|
|
140
|
+
| `authHeader` | Set `true` to add `Authorization: Bearer <apiKey>` automatically |
|
|
141
|
+
| `models` | Array of model configurations |
|
|
142
|
+
| `modelOverrides` | Per-model overrides for built-in models on this provider |
|
|
143
|
+
|
|
144
|
+
### Value Resolution
|
|
145
|
+
|
|
146
|
+
The `apiKey` and `headers` fields support command execution, environment interpolation, and literals:
|
|
147
|
+
|
|
148
|
+
- **Shell command:** `"!command"` at the start executes the whole value as a command and uses stdout
|
|
149
|
+
```json
|
|
150
|
+
"apiKey": "!security find-generic-password -ws 'anthropic'"
|
|
151
|
+
"apiKey": "!op read 'op://vault/item/credential'"
|
|
152
|
+
```
|
|
153
|
+
- **Environment interpolation:** `"$ENV_VAR"` or `"${ENV_VAR}"` uses the value of the named variable. Interpolation works inside larger literals.
|
|
154
|
+
```json
|
|
155
|
+
"apiKey": "$MY_API_KEY"
|
|
156
|
+
"apiKey": "${KEY_PREFIX}_${KEY_SUFFIX}"
|
|
157
|
+
```
|
|
158
|
+
`$FOO_BAR` is the variable `FOO_BAR`; use `${FOO}_BAR` when `BAR` is literal text. Missing environment variables make the value unresolved.
|
|
159
|
+
- **Escapes:** `"$$"` emits a literal `"$"`; `"$!"` emits a literal `"!"` without triggering command execution.
|
|
160
|
+
```json
|
|
161
|
+
"apiKey": "$$literal-dollar-prefix"
|
|
162
|
+
"apiKey": "$!literal-bang-prefix"
|
|
163
|
+
```
|
|
164
|
+
- **Literal value:** Used directly
|
|
165
|
+
```json
|
|
166
|
+
"apiKey": "sk-..."
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Legacy uppercase env-var-like values such as `MY_API_KEY` are migrated to `$MY_API_KEY` on startup.
|
|
170
|
+
|
|
171
|
+
For `models.json`, shell commands are resolved at request time. pi intentionally does not apply built-in TTL, stale reuse, or recovery logic for arbitrary commands. Different commands need different caching and failure strategies, and pi cannot infer the right one.
|
|
172
|
+
|
|
173
|
+
If your command is slow, expensive, rate-limited, or should keep using a previous value on transient failures, wrap it in your own script or command that implements the caching or TTL behavior you want.
|
|
174
|
+
|
|
175
|
+
`/model` availability checks use configured auth presence and do not execute shell commands.
|
|
176
|
+
|
|
177
|
+
### Custom Headers
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"providers": {
|
|
182
|
+
"custom-proxy": {
|
|
183
|
+
"baseUrl": "https://proxy.example.com/v1",
|
|
184
|
+
"apiKey": "$MY_API_KEY",
|
|
185
|
+
"api": "anthropic-messages",
|
|
186
|
+
"headers": {
|
|
187
|
+
"x-portkey-api-key": "$PORTKEY_API_KEY",
|
|
188
|
+
"x-secret": "!op read 'op://vault/item/secret'"
|
|
189
|
+
},
|
|
190
|
+
"models": [...]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Model Configuration
|
|
197
|
+
|
|
198
|
+
| Field | Required | Default | Description |
|
|
199
|
+
|-------|----------|---------|-------------|
|
|
200
|
+
| `id` | Yes | — | Model identifier (passed to the API) |
|
|
201
|
+
| `name` | No | `id` | Human-readable model label. Used for matching (`--model` patterns) and shown in model details/status text. |
|
|
202
|
+
| `api` | No | provider's `api` | Override provider's API for this model |
|
|
203
|
+
| `reasoning` | No | `false` | Supports extended thinking |
|
|
204
|
+
| `thinkingLevelMap` | No | omitted | Maps pi thinking levels to provider values and marks unsupported levels (see below) |
|
|
205
|
+
| `input` | No | `["text"]` | Input types: `["text"]` or `["text", "image"]` |
|
|
206
|
+
| `contextWindow` | No | `128000` | Context window size in tokens |
|
|
207
|
+
| `maxTokens` | No | `16384` | Maximum output tokens |
|
|
208
|
+
| `cost` | No | all zeros | `{"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}` (per million tokens) |
|
|
209
|
+
| `compat` | No | provider `compat` | Provider compatibility overrides. Merged with provider-level `compat` when both are set. |
|
|
210
|
+
|
|
211
|
+
Current behavior:
|
|
212
|
+
- `/model` and `--list-models` list entries by model `id`.
|
|
213
|
+
- The configured `name` is used for model matching and detail/status text.
|
|
214
|
+
|
|
215
|
+
### Thinking Level Map
|
|
216
|
+
|
|
217
|
+
Use `thinkingLevelMap` on a model to describe model-specific thinking controls. Keys are pi thinking levels: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`.
|
|
218
|
+
|
|
219
|
+
Values are tristate:
|
|
220
|
+
|
|
221
|
+
| Value | Meaning |
|
|
222
|
+
|-------|---------|
|
|
223
|
+
| omitted | Level is supported and uses the provider's default mapping |
|
|
224
|
+
| string | Level is supported and this value is sent to the provider |
|
|
225
|
+
| `null` | Level is unsupported and hidden/skipped/clamped away |
|
|
226
|
+
|
|
227
|
+
Example for a model that only supports off, high, and max reasoning:
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"id": "deepseek-v4-pro",
|
|
232
|
+
"reasoning": true,
|
|
233
|
+
"thinkingLevelMap": {
|
|
234
|
+
"minimal": null,
|
|
235
|
+
"low": null,
|
|
236
|
+
"medium": null,
|
|
237
|
+
"high": "high",
|
|
238
|
+
"xhigh": "max"
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Example for a model where thinking cannot be disabled:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"id": "always-thinking-model",
|
|
248
|
+
"reasoning": true,
|
|
249
|
+
"thinkingLevelMap": {
|
|
250
|
+
"off": null
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Migration: older configs that used `compat.reasoningEffortMap` should move that mapping to model-level `thinkingLevelMap`. Use `null` for levels that should not appear in the UI.
|
|
256
|
+
|
|
257
|
+
## Overriding Built-in Providers
|
|
258
|
+
|
|
259
|
+
Route a built-in provider through a proxy without redefining models:
|
|
260
|
+
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"providers": {
|
|
264
|
+
"anthropic": {
|
|
265
|
+
"baseUrl": "https://my-proxy.example.com/v1"
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
All built-in Anthropic models remain available. Existing OAuth or API key auth continues to work.
|
|
272
|
+
|
|
273
|
+
To merge custom models into a built-in provider, include the `models` array:
|
|
274
|
+
|
|
275
|
+
```json
|
|
276
|
+
{
|
|
277
|
+
"providers": {
|
|
278
|
+
"anthropic": {
|
|
279
|
+
"baseUrl": "https://my-proxy.example.com/v1",
|
|
280
|
+
"apiKey": "$ANTHROPIC_API_KEY",
|
|
281
|
+
"api": "anthropic-messages",
|
|
282
|
+
"models": [...]
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Merge semantics:
|
|
289
|
+
- Built-in models are kept.
|
|
290
|
+
- Custom models are upserted by `id` within the provider.
|
|
291
|
+
- If a custom model `id` matches a built-in model `id`, the custom model replaces that built-in model.
|
|
292
|
+
- If a custom model `id` is new, it is added alongside built-in models.
|
|
293
|
+
|
|
294
|
+
## Per-model Overrides
|
|
295
|
+
|
|
296
|
+
Use `modelOverrides` to customize specific built-in models without replacing the provider's full model list.
|
|
297
|
+
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"providers": {
|
|
301
|
+
"openrouter": {
|
|
302
|
+
"modelOverrides": {
|
|
303
|
+
"anthropic/claude-sonnet-4": {
|
|
304
|
+
"name": "Claude Sonnet 4 (Bedrock Route)",
|
|
305
|
+
"compat": {
|
|
306
|
+
"openRouterRouting": {
|
|
307
|
+
"only": ["amazon-bedrock"]
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
`modelOverrides` supports these fields per model: `name`, `reasoning`, `input`, `cost` (partial), `contextWindow`, `maxTokens`, `headers`, `compat`.
|
|
318
|
+
|
|
319
|
+
Behavior notes:
|
|
320
|
+
- `modelOverrides` are applied to built-in provider models.
|
|
321
|
+
- Unknown model IDs are ignored.
|
|
322
|
+
- You can combine provider-level `baseUrl`/`headers` with `modelOverrides`.
|
|
323
|
+
- If `models` is also defined for a provider, custom models are merged after built-in overrides. A custom model with the same `id` replaces the overridden built-in model entry.
|
|
324
|
+
|
|
325
|
+
## Anthropic Messages Compatibility
|
|
326
|
+
|
|
327
|
+
For providers or proxies using `api: "anthropic-messages"`, use `compat` to control Anthropic-specific request compatibility.
|
|
328
|
+
|
|
329
|
+
By default pi sends per-tool `eager_input_streaming: true`. If a proxy or Anthropic-compatible backend rejects that field, set `supportsEagerToolInputStreaming` to `false`. Pi will omit `tools[].eager_input_streaming` and send the legacy `fine-grained-tool-streaming-2025-05-14` beta header for tool-enabled requests instead.
|
|
330
|
+
|
|
331
|
+
Some Anthropic models require adaptive thinking (`thinking.type: "adaptive"` plus `output_config.effort`) instead of the legacy budget-based thinking payload. Built-in models set this automatically. For custom providers or aliases that route to those models, set `forceAdaptiveThinking` to `true`.
|
|
332
|
+
|
|
333
|
+
Some Anthropic-compatible providers emit thinking blocks with empty signatures and still expect them on replay. Set `allowEmptySignature` to `true` only for those providers; real Anthropic rejects empty thinking signatures.
|
|
334
|
+
|
|
335
|
+
```json
|
|
336
|
+
{
|
|
337
|
+
"providers": {
|
|
338
|
+
"anthropic-proxy": {
|
|
339
|
+
"baseUrl": "https://proxy.example.com",
|
|
340
|
+
"api": "anthropic-messages",
|
|
341
|
+
"apiKey": "$ANTHROPIC_PROXY_KEY",
|
|
342
|
+
"compat": {
|
|
343
|
+
"supportsEagerToolInputStreaming": false,
|
|
344
|
+
"supportsLongCacheRetention": true,
|
|
345
|
+
"forceAdaptiveThinking": true,
|
|
346
|
+
"allowEmptySignature": true
|
|
347
|
+
},
|
|
348
|
+
"models": [
|
|
349
|
+
{
|
|
350
|
+
"id": "claude-opus-4-7",
|
|
351
|
+
"reasoning": true,
|
|
352
|
+
"input": ["text", "image"]
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
| Field | Description |
|
|
361
|
+
|-------|-------------|
|
|
362
|
+
| `supportsEagerToolInputStreaming` | Whether the provider accepts per-tool `eager_input_streaming`. Default: `true`. Set to `false` to omit that field and use the legacy fine-grained tool streaming beta header on tool-enabled requests. |
|
|
363
|
+
| `supportsLongCacheRetention` | Whether the provider accepts Anthropic long cache retention (`cache_control.ttl: "1h"`) when cache retention is `long`. Default: `true`. |
|
|
364
|
+
| `sendSessionAffinityHeaders` | Whether to send `x-session-affinity` from the session id when caching is enabled. Default: auto-detected for known providers. |
|
|
365
|
+
| `supportsCacheControlOnTools` | Whether the provider accepts Anthropic-style `cache_control` markers on tool definitions. Default: `true`. |
|
|
366
|
+
| `forceAdaptiveThinking` | Whether to send adaptive thinking (`thinking.type: "adaptive"` plus `output_config.effort`) for this model. Built-in adaptive models set this automatically. Default: `false`. |
|
|
367
|
+
| `allowEmptySignature` | Whether to replay empty thinking signatures as `signature: ""` instead of converting thinking to text. Default: `false`. |
|
|
368
|
+
|
|
369
|
+
## OpenAI Compatibility
|
|
370
|
+
|
|
371
|
+
For providers with partial OpenAI compatibility, use the `compat` field.
|
|
372
|
+
|
|
373
|
+
- Provider-level `compat` applies defaults to all models under that provider.
|
|
374
|
+
- Model-level `compat` overrides provider-level values for that model.
|
|
375
|
+
|
|
376
|
+
```json
|
|
377
|
+
{
|
|
378
|
+
"providers": {
|
|
379
|
+
"local-llm": {
|
|
380
|
+
"baseUrl": "http://localhost:8080/v1",
|
|
381
|
+
"api": "openai-completions",
|
|
382
|
+
"compat": {
|
|
383
|
+
"supportsUsageInStreaming": false,
|
|
384
|
+
"maxTokensField": "max_tokens"
|
|
385
|
+
},
|
|
386
|
+
"models": [...]
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
| Field | Description |
|
|
393
|
+
|-------|-------------|
|
|
394
|
+
| `supportsStore` | Provider supports `store` field |
|
|
395
|
+
| `supportsDeveloperRole` | Use `developer` vs `system` role |
|
|
396
|
+
| `supportsReasoningEffort` | Support for `reasoning_effort` parameter |
|
|
397
|
+
| `supportsUsageInStreaming` | Supports `stream_options: { include_usage: true }` (default: `true`) |
|
|
398
|
+
| `maxTokensField` | Use `max_completion_tokens` or `max_tokens` |
|
|
399
|
+
| `requiresToolResultName` | Include `name` on tool result messages |
|
|
400
|
+
| `requiresAssistantAfterToolResult` | Insert an assistant message before a user message after tool results |
|
|
401
|
+
| `requiresThinkingAsText` | Convert thinking blocks to plain text |
|
|
402
|
+
| `requiresReasoningContentOnAssistantMessages` | Include empty `reasoning_content` on all replayed assistant messages when reasoning is enabled |
|
|
403
|
+
| `thinkingFormat` | Use `reasoning_effort`, `openrouter`, `deepseek`, `together`, `zai`, `qwen`, or `qwen-chat-template` thinking parameters |
|
|
404
|
+
| `cacheControlFormat` | Use Anthropic-style `cache_control` markers on the system prompt, last tool definition, and last user/assistant text content. Currently only `anthropic` is supported. |
|
|
405
|
+
| `supportsStrictMode` | Include the `strict` field in tool definitions |
|
|
406
|
+
| `supportsLongCacheRetention` | Whether the provider accepts long cache retention when cache retention is `long`: `prompt_cache_retention: "24h"` for OpenAI prompt caching, or `cache_control.ttl: "1h"` when `cacheControlFormat` is `anthropic`. Default: `true`. |
|
|
407
|
+
| `openRouterRouting` | OpenRouter provider routing preferences. This object is sent as-is in the `provider` field of the [OpenRouter API request](https://openrouter.ai/docs/guides/routing/provider-selection). |
|
|
408
|
+
| `vercelGatewayRouting` | Vercel AI Gateway routing config for provider selection (`only`, `order`) |
|
|
409
|
+
|
|
410
|
+
`openrouter` uses `reasoning: { effort }`. `together` uses `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` uses top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that require `chat_template_kwargs.enable_thinking`.
|
|
411
|
+
|
|
412
|
+
`cacheControlFormat: "anthropic"` is for OpenAI-compatible providers that expose Anthropic-style prompt caching through `cache_control` markers on text content and tool definitions.
|
|
413
|
+
|
|
414
|
+
Example:
|
|
415
|
+
|
|
416
|
+
```json
|
|
417
|
+
{
|
|
418
|
+
"providers": {
|
|
419
|
+
"openrouter": {
|
|
420
|
+
"baseUrl": "https://openrouter.ai/api/v1",
|
|
421
|
+
"apiKey": "$OPENROUTER_API_KEY",
|
|
422
|
+
"api": "openai-completions",
|
|
423
|
+
"models": [
|
|
424
|
+
{
|
|
425
|
+
"id": "openrouter/anthropic/claude-3.5-sonnet",
|
|
426
|
+
"name": "OpenRouter Claude 3.5 Sonnet",
|
|
427
|
+
"compat": {
|
|
428
|
+
"openRouterRouting": {
|
|
429
|
+
"allow_fallbacks": true,
|
|
430
|
+
"require_parameters": false,
|
|
431
|
+
"data_collection": "deny",
|
|
432
|
+
"zdr": true,
|
|
433
|
+
"enforce_distillable_text": false,
|
|
434
|
+
"order": ["anthropic", "amazon-bedrock", "google-vertex"],
|
|
435
|
+
"only": ["anthropic", "amazon-bedrock"],
|
|
436
|
+
"ignore": ["gmicloud", "friendli"],
|
|
437
|
+
"quantizations": ["fp16", "bf16"],
|
|
438
|
+
"sort": {
|
|
439
|
+
"by": "price",
|
|
440
|
+
"partition": "model"
|
|
441
|
+
},
|
|
442
|
+
"max_price": {
|
|
443
|
+
"prompt": 10,
|
|
444
|
+
"completion": 20
|
|
445
|
+
},
|
|
446
|
+
"preferred_min_throughput": {
|
|
447
|
+
"p50": 100,
|
|
448
|
+
"p90": 50
|
|
449
|
+
},
|
|
450
|
+
"preferred_max_latency": {
|
|
451
|
+
"p50": 1,
|
|
452
|
+
"p90": 3,
|
|
453
|
+
"p99": 5
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Vercel AI Gateway example:
|
|
465
|
+
|
|
466
|
+
```json
|
|
467
|
+
{
|
|
468
|
+
"providers": {
|
|
469
|
+
"vercel-ai-gateway": {
|
|
470
|
+
"baseUrl": "https://ai-gateway.vercel.sh/v1",
|
|
471
|
+
"apiKey": "$AI_GATEWAY_API_KEY",
|
|
472
|
+
"api": "openai-completions",
|
|
473
|
+
"models": [
|
|
474
|
+
{
|
|
475
|
+
"id": "moonshotai/kimi-k2.5",
|
|
476
|
+
"name": "Kimi K2.5 (Fireworks via Vercel)",
|
|
477
|
+
"reasoning": true,
|
|
478
|
+
"input": ["text", "image"],
|
|
479
|
+
"cost": { "input": 0.6, "output": 3, "cacheRead": 0, "cacheWrite": 0 },
|
|
480
|
+
"contextWindow": 262144,
|
|
481
|
+
"maxTokens": 262144,
|
|
482
|
+
"compat": {
|
|
483
|
+
"vercelGatewayRouting": {
|
|
484
|
+
"only": ["fireworks", "novita"],
|
|
485
|
+
"order": ["fireworks", "novita"]
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
```
|