diff --git a/docs/concepts/model-providers.md b/docs/concepts/model-providers.md index 7dfd851ee94..bc2c6cf902b 100644 --- a/docs/concepts/model-providers.md +++ b/docs/concepts/model-providers.md @@ -674,6 +674,7 @@ Example (OpenAI‑compatible): - For slow local models or remote LAN/tailnet hosts, set `models.providers..timeoutSeconds`. This extends provider model HTTP request handling, including connect, headers, body streaming, and the total guarded-fetch abort, without increasing the whole agent runtime timeout. - If `baseUrl` is empty/omitted, OpenClaw keeps the default OpenAI behavior (which resolves to `api.openai.com`). - For safety, an explicit `compat.supportsDeveloperRole: true` is still overridden on non-native `openai-completions` endpoints. + - For `api: "anthropic-messages"` on non-direct endpoints (any provider other than canonical `anthropic`, or a custom `models.providers.anthropic.baseUrl` whose host is not a public `api.anthropic.com` endpoint), OpenClaw suppresses implicit Anthropic beta headers such as `claude-code-20250219`, `interleaved-thinking-2025-05-14`, and OAuth markers, so custom Anthropic-compatible proxies do not reject unsupported beta flags. Set `models.providers..headers["anthropic-beta"]` explicitly if your proxy needs specific beta features. diff --git a/docs/gateway/cli-backends.md b/docs/gateway/cli-backends.md index b8b169cd633..8854ef62ab8 100644 --- a/docs/gateway/cli-backends.md +++ b/docs/gateway/cli-backends.md @@ -224,6 +224,27 @@ Serialization notes: rotation does not cut the stored CLI session. If a CLI does not expose a stable OAuth account id, OpenClaw lets that CLI enforce resume permissions. +## Fallback prelude from claude-cli sessions + +When a `claude-cli` attempt fails over to a non-CLI candidate in +[`agents.defaults.model.fallbacks`](/concepts/model-failover), OpenClaw seeds +the next attempt with a context prelude harvested from Claude Code's local +JSONL transcript at `~/.claude/projects/`. Without this seed, the fallback +provider would start cold because OpenClaw's own session transcript is empty +for `claude-cli` runs. + +- The prelude prefers the latest `/compact` summary or `compact_boundary` + marker, then appends the most recent post-boundary turns up to a char + budget. Pre-boundary turns are dropped because the summary already represents + them. +- Tool blocks are coalesced to compact `(tool call: name)` and + `(tool result: …)` hints to keep the prompt budget honest. The summary is + labeled `(truncated)` if it overflows. +- Same-provider `claude-cli` to `claude-cli` fallbacks rely on Claude's own + `--resume` and skip the prelude. +- The seed reuses the existing Claude session-file path validation, so + arbitrary paths cannot be read. + ## Images (pass-through) If your CLI accepts image paths, set `imageArg`: