mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 05:57:28 +00:00
chore: Run pnpm format:fix.
This commit is contained in:
@@ -5,6 +5,7 @@ read_when:
|
||||
- You are running Claude Code CLI or other local AI CLIs and want to reuse them
|
||||
- You need a text-only, tool-free path that still supports sessions and images
|
||||
---
|
||||
|
||||
# CLI backends (fallback runtime)
|
||||
|
||||
OpenClaw can run **local AI CLIs** as a **text-only fallback** when API providers are down,
|
||||
@@ -41,11 +42,11 @@ command path:
|
||||
defaults: {
|
||||
cliBackends: {
|
||||
"claude-cli": {
|
||||
command: "/opt/homebrew/bin/claude"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
command: "/opt/homebrew/bin/claude",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -61,20 +62,19 @@ Add a CLI backend to your fallback list so it only runs when primary models fail
|
||||
defaults: {
|
||||
model: {
|
||||
primary: "anthropic/claude-opus-4-5",
|
||||
fallbacks: [
|
||||
"claude-cli/opus-4.5"
|
||||
]
|
||||
fallbacks: ["claude-cli/opus-4.5"],
|
||||
},
|
||||
models: {
|
||||
"anthropic/claude-opus-4-5": { alias: "Opus" },
|
||||
"claude-cli/opus-4.5": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
"claude-cli/opus-4.5": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- If you use `agents.defaults.models` (allowlist), you must include `claude-cli/...`.
|
||||
- If the primary provider fails (auth, rate limits, timeouts), OpenClaw will
|
||||
try the CLI backend next.
|
||||
@@ -102,7 +102,7 @@ The provider id becomes the left side of your model ref:
|
||||
defaults: {
|
||||
cliBackends: {
|
||||
"claude-cli": {
|
||||
command: "/opt/homebrew/bin/claude"
|
||||
command: "/opt/homebrew/bin/claude",
|
||||
},
|
||||
"my-cli": {
|
||||
command: "my-cli",
|
||||
@@ -112,7 +112,7 @@ The provider id becomes the left side of your model ref:
|
||||
modelArg: "--model",
|
||||
modelAliases: {
|
||||
"claude-opus-4-5": "opus",
|
||||
"claude-sonnet-4-5": "sonnet"
|
||||
"claude-sonnet-4-5": "sonnet",
|
||||
},
|
||||
sessionArg: "--session",
|
||||
sessionMode: "existing",
|
||||
@@ -121,21 +121,21 @@ The provider id becomes the left side of your model ref:
|
||||
systemPromptWhen: "first",
|
||||
imageArg: "--image",
|
||||
imageMode: "repeat",
|
||||
serialize: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
serialize: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## How it works
|
||||
|
||||
1) **Selects a backend** based on the provider prefix (`claude-cli/...`).
|
||||
2) **Builds a system prompt** using the same OpenClaw prompt + workspace context.
|
||||
3) **Executes the CLI** with a session id (if supported) so history stays consistent.
|
||||
4) **Parses output** (JSON or plain text) and returns the final text.
|
||||
5) **Persists session ids** per backend, so follow-ups reuse the same CLI session.
|
||||
1. **Selects a backend** based on the provider prefix (`claude-cli/...`).
|
||||
2. **Builds a system prompt** using the same OpenClaw prompt + workspace context.
|
||||
3. **Executes the CLI** with a session id (if supported) so history stays consistent.
|
||||
4. **Parses output** (JSON or plain text) and returns the final text.
|
||||
5. **Persists session ids** per backend, so follow-ups reuse the same CLI session.
|
||||
|
||||
## Sessions
|
||||
|
||||
@@ -172,6 +172,7 @@ load local files from plain paths (Claude Code CLI behavior).
|
||||
- `output: "text"` treats stdout as the final response.
|
||||
|
||||
Input modes:
|
||||
|
||||
- `input: "arg"` (default) passes the prompt as the last CLI arg.
|
||||
- `input: "stdin"` sends the prompt via stdin.
|
||||
- If the prompt is very long and `maxPromptArgChars` is set, stdin is used.
|
||||
|
||||
Reference in New Issue
Block a user