Skip to main content

CLI Reference

Basic commands

# Start interactive TUI session (coding mode with DeepSeek default)
toporic

# One-shot autonomous execution (non-interactive, exits when done)
toporic --goal "Add unit tests for the auth module"

# Plan a goal without executing anything
toporic --goal "Refactor the router" --plan

# Execute a goal with per-change confirmation prompts
toporic --goal "Migrate to async/await" --build

# Get JSON output (for scripts / CI)
toporic --goal "Fix clippy warnings" --json

# Choose a provider and model
toporic --provider openai --model gpt-4o-mini
toporic --provider ollama --model llama3.2

# Choose an agent mode
toporic --mode assistant     # conversational, no tools
toporic --mode research      # web research, no file editing

# Resume the most recent session
toporic --resume

# Resume a specific session by ID
toporic --resume 550e8400-e29b-41d4-a716-446655440000

# Run without persisting session to disk
toporic --no-persist

Goal-based execution (one-shot mode)

When you pass --goal (shorthand -g), Toporic runs autonomously and exits after completion — no TUI is started. The agent automatically decomposes the goal into tasks and executes them.

toporic --goal "Add integration tests for the payment endpoint"

Combine with mode flags to control confirmation behavior:

FlagBehavior
(default)Auto mode — skip all confirmation prompts, run fully autonomously
--autoSame as default (skip prompts)
--buildPrompt before each mutating tool (run_command, write_file, etc.)
--planShow the execution plan and exit without running any tools
--jsonOutput structured JSON to stdout for programmatic consumption
# Plan-only: see what the agent would do
toporic --goal "Set up CI pipeline" --plan

# Build mode: review each change before it is made
toporic --goal "Refactor error handling" --build

# CI-friendly JSON output
toporic --goal "Run all tests" --auto --json

All CLI flags

FlagShortTypeDefaultDescription
--version-VFlagShow version and check for updates
--mode-mcoding / assistant / researchconfig → codingAgent preset mode
--provider-pProvider nameconfig → deepseekLLM backend
--modelStringProvider’s defaultModel override
--themeamber / purple / greenconfig → amberTUI color theme
--no-persistFlagfalseRun without writing session to disk
--resumeOptional UUIDlatest if bareResume session. Bare --resume = latest
--goal-gStringOne-shot autonomous execution goal
--autoFlagfalse (but is default for --goal)Skip permission prompts
--buildFlagfalsePrompt before each change
--planFlagfalseShow plan without executing
--jsonFlagfalseOutput structured JSON

Subcommands

set-key

Save an API key to ~/.toporic/providers.json:

toporic set-key --provider anthropic --key sk-ant-...
toporic set-key --provider openai --key sk-...

Ollama is silently ignored (no key needed). If the provider does not exist in the file, a stub entry is created.

init

Scaffold a Toporic workspace in the current directory:

toporic init
toporic init --workspace /path/to/project

Creates .toporic/ directory, AGENTS.md stub, and runs git init if needed. All operations are idempotent.

serve

Start an HTTP server with SSE streaming API:

toporic serve
toporic serve --addr 127.0.0.1:3000 --workspace /path/to/project

Exposes POST /v1/chat with streaming responses. Pre-builds a RAG index on startup.

update-models

Fetch the latest model pricing and context window data:

toporic update-models

Downloads from toporic.com and stores in ~/.toporic/models/models.json. This file overrides built-in model tables when present.

Provider list

Toporic supports 21 providers out of the box. Use the lowercase ID with --provider:

IDProviderEnv varAPI protocol
anthropicAnthropicANTHROPIC_API_KEYNative SDK
openaiOpenAIOPENAI_API_KEYOpenAI-compat
deepseekDeepSeekDEEPSEEK_API_KEYOpenAI-compat
openrouterOpenRouterOPENROUTER_API_KEYOpenAI-compat
googleGoogleGOOGLE_API_KEYGemini native
ollamaOllama (local)(none)Native SDK
groqGroqGROQ_API_KEYOpenAI-compat
togetherTogether AITOGETHER_API_KEYOpenAI-compat
perplexityPerplexityPERPLEXITY_API_KEYOpenAI-compat
mistralMistralMISTRAL_API_KEYOpenAI-compat
cerebrasCerebrasCEREBRAS_API_KEYOpenAI-compat
fireworksFireworksFIREWORKS_API_KEYOpenAI-compat
alibabaAlibabaDASHSCOPE_API_KEYOpenAI-compat
cohereCohereCOHERE_API_KEYOpenAI-compat
nvidiaNvidiaNVIDIA_API_KEYOpenAI-compat
xaixAIXAI_API_KEYOpenAI-compat
zhipuaiZhipu AIZHIPU_API_KEYOpenAI-compat
minimaxMiniMaxMINIMAX_API_KEYOpenAI-compat
kimiKimi (Moonshot)KIMI_API_KEYOpenAI-compat
tencent-coding-planTencent Coding PlanTENCENT_CODING_PLAN_API_KEYOpenAI-compat
tencent-tokenhubTencent TokenHubTENCENT_TOKENHUB_API_KEYOpenAI-compat

Custom providers can also be defined in ~/.toporic/providers.json.

Config integration

CLI flags override the config file for the current session. The resolution order is:

SettingCLI flagConfig keyHard default
Provider--providerdefaults.providerdeepseek
Mode--modedefaults.modecoding
Model--modeldefaults.modelProvider’s default
Theme--themedefaults.themeamber
Language(TUI only)defaults.languageEnglish

API key resolution (highest priority first):

  1. Provider-specific environment variable (ANTHROPIC_API_KEY, etc.)
  2. AGENT_API_KEY environment variable
  3. api_key field in ~/.toporic/providers.json