Files
openclaw-skill/openclaw-knowhow-skill/docs/infrastructure/gateway/cli-backends.md
Selig 4c966a3ad2 Initial commit: OpenClaw Skill Collection
6 custom skills (assign-task, dispatch-webhook, daily-briefing,
task-capture, qmd-brain, tts-voice) with technical documentation.
Compatible with Claude Code, OpenClaw, Codex CLI, and OpenCode.
2026-03-13 10:58:30 +08:00

1.9 KiB

CLI Backends

Overview

OpenClaw enables execution of local AI command-line interfaces as a fallback mechanism when primary API providers experience outages, rate limitations, or performance issues. This feature operates in text-only mode with these characteristics:

  • Tool functionality remains disabled
  • Text input produces text output reliably
  • Session support maintains conversational coherence
  • Image pass-through available if the CLI supports image paths

Quick Start

The system ships with pre-configured defaults for Claude and Codex CLIs, allowing immediate use without additional setup:

openclaw agent --message "hi" --model claude-cli/opus-4.6

For systems with minimal PATH variables, specify the command location explicitly through configuration.

Fallback Configuration

Integrate CLI backends into your fallback chain by adding them to your model configuration. The system attempts the primary provider first, then progresses through fallback options upon failure. Note: If you use agents.defaults.models (allowlist), you must include claude-cli/...

Technical Architecture

The implementation follows this sequence:

  1. Provider identification from model reference prefix
  2. System prompt construction using OpenClaw context
  3. CLI execution with session persistence
  4. Output parsing and response return
  5. Session ID storage for follow-up continuity

Configuration Options

Key parameters include session arguments, resume commands for resuming conversations, image handling modes, input/output formats, and model name aliasing for CLI compatibility.

Built-in Defaults

Claude CLI ships with JSON output formatting and permission-skipping flags. Codex CLI uses JSONL streaming with read-only sandbox mode. Override only the command path when needed.

Constraints

The feature explicitly excludes OpenClaw tool integration, streaming output, and full structured output support. Session resumption varies by CLI implementation.