ccc — Call Coding CLIs
A Rust library and CLI for calling coding agents (opencode, claude, codex, kimi, roocode, crush) from your Rust programs or terminal. Run prompts against any supported coding agent with a consistent interface, streaming support, and structured output parsing.
Quick Start
Install the CLI
Rust Library
[]
= "0.1"
use ;
let runner = new;
// Build and run a command
let spec = new
.with_cwd;
let result = runner.run;
println!;
CLI Usage
# Run a prompt with opencode (default)
# Use a different runner
# Thinking level (+0 to +4)
# Model selection
# Preset alias from config
# Force literal prompt (no flag parsing)
# Streaming output
Library API
CommandSpec
Describes a command to run: argv, stdin, working directory, and environment.
use CommandSpec;
// Minimal
let spec = new;
// With options
let spec = new
.with_cwd
.with_stdin
.with_env;
CompletedRun
Result of a completed command run.
let result = runner.run;
println!;
println!;
println!;
Runner
Executes commands with blocking or streaming modes.
use Runner;
let runner = new;
// Blocking run
let result = runner.run;
// Streaming with callback (stdout/stderr per line)
let result = runner.stream;
build_prompt_spec
Convenience helper to build an opencode run command from a prompt string.
use build_prompt_spec;
let spec = build_prompt_spec?;
let result = new.run;
CLI Reference
Runner Selectors
| Shortcut | Runner |
|---|---|
oc |
opencode |
cc |
claude |
c, cx |
codex |
k |
kimi |
rc |
roocode |
cr |
crush |
Thinking Levels
+0 / +none Disable thinking
+1 / +low Low effort
+2 / +med Medium effort (default for most)
+3 / +high High effort
+4 / +max Maximum effort
Model Selection
Output Modes
| Mode | Description |
|---|---|
text |
Raw stdout/stderr |
stream-text |
Stream raw output line-by-line |
json |
Raw JSON (for runners that output JSON) |
stream-json |
Stream JSON line-by-line |
formatted |
Parse and render structured output for humans |
stream-formatted |
Stream parsed structured output |
Shortcuts: .text, ..text, .json, ..json, .fmt, ..fmt
Permission Modes
Other Flags
--show-thinking Show thinking in formatted output
--no-show-thinking Hide thinking in formatted output
--sanitize-osc Strip OSC escape sequences (titles, bells)
--no-sanitize-osc Keep OSC escape sequences
--forward-unknown-json Forward unparseable JSON lines to stderr
--print-config Print example config file
-- Treat all following args as literal prompt
Configuration
Config file lookup order:
.ccc.tomlin project directory (or nearest ancestor)XDG_CONFIG_HOME/ccc/config.toml~/.config/ccc/config.toml$CCC_CONFIG(explicit path)
Generate an example config:
Example .ccc.toml:
[]
= "oc"
= "anthropic"
= "claude-4"
= 2
= false
= true
= "formatted"
[]
= "cc"
[]
= "cc"
= "anthropic"
= "claude-4"
= 3
= true
= "formatted"
= "reviewer"
= "Review the current changes"
= "default"
Aliases
Aliases bundle runner, model, thinking level, and prompt into a single name:
The @reviewer alias might resolve to claude with specific settings and a base prompt like "Review the current changes". Your explicit prompt is appended or prepended based on prompt_mode.
Prompt Modes
default— Use user prompt if provided, else alias promptprepend— Add user prompt before alias promptappend— Add user prompt after alias prompt
Environment Variables
| Variable | Purpose |
|---|---|
CCC_REAL_OPENCODE |
Override opencode binary path (for testing) |
CCC_REAL_CLAUDE |
Override claude binary path (for testing) |
CCC_REAL_KIMI |
Override kimi binary path (for testing) |
CCC_PROVIDER |
Set provider for current run |
CCC_CONFIG |
Explicit config file path |
FORCE_COLOR |
Force colored output |
NO_COLOR |
Disable colored output |
Supported Runners
| Runner | Binary | Thinking | Models | JSON Output | Formatted |
|---|---|---|---|---|---|
| opencode | opencode | ✓ | ✓ | ✓ | ✓ |
| claude | claude | ✓ | ✓ | ✓ | ✓ |
| codex | codex | — | ✓ | — | — |
| kimi | kimi | ✓ | ✓ | ✓ | ✓ |
| roocode | roocode | — | — | — | — |
| crush | crush | — | — | — | — |
License
Unlicense