Skip to main content
This page lists all environment variables that ChatCLI recognizes. Configure them in your .env file or via export in the shell.

General


LLM Providers

OpenAI

Anthropic (Claude)

AWS Bedrock (full catalog)

BEDROCK provider — invokes the entire Bedrock catalog (Anthropic, OpenAI, Llama, Nova, Mistral, Cohere, AI21, DeepSeek, Moonshot Kimi (also available directly via MOONSHOT), MiniMax, Qwen, Z.AI/GLM, Gemma, Nemotron, TwelveLabs, and any provider AWS adds) using the SDK’s credential chain (env vars, ~/.aws/credentials, SSO via ~/.aws/config, IAM role). Activation requires real credentials — the mere existence of ~/.aws/config with only region/output does not activate Bedrock.
Modern models on Bedrock (Claude 3.7+/4.x/4.5/4.6/4.7 and equivalents from other providers) require inference profile IDs (prefix global., us., eu., or apac.). /switch --model automatically filters out base IDs that don’t support ON_DEMAND, so only invokable IDs + profiles appear in the listing. See AWS Bedrock for details.

Google AI (Gemini)

xAI (Grok)

Ollama (Local Models)

Devin CLI (Cognition)

The DEVIN provider wraps the local devin binary — auth belongs to the CLI (devin auth login); see Devin Provider.
For Agent mode to work well with some Ollama models that “think out loud” (Qwen3, Llama3…), keep OLLAMA_FILTER_THINKING=true.

ZAI (Zhipu AI)

Keys in id.secret format automatically enable JWT token rotation (HMAC-SHA256). Tokens are cached for 30 minutes with a 5-minute safety margin before regeneration. Keys without ”.” continue to work as traditional Bearer tokens. No additional configuration is needed.

MiniMax

Set MINIMAX_API_COMPAT=anthropic to use the Anthropic Messages-compatible endpoint (https://api.minimax.io/anthropic/v1/messages). The anthropic-version: 2023-06-01 header is added automatically. Bearer token auth remains the same. Native tool calling is disabled in this mode (falls back to XML).

Moonshot (Kimi)

MOONSHOT_THINKING=disabled forces Instant mode (direct response, cheaper) even on models with the thinking capability. enabled forces explicit reasoning. auto (default) lets the model choose. Models without the thinking capability ignore the flag — no surprise billing.

OpenRouter

OpenRouter is a multi-provider gateway — a single API key gives access to 200+ models from OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, and more. Models use the provider/model-name format (e.g., openai/gpt-4o, anthropic/claude-sonnet-4). The default model is openai/gpt-4o.

GitHub Copilot

StackSpot

StackSpot’s agent API decides the output limit server-side (it ignores max_tokens in the payload). ChatCLI’s catalog assumes a 128K context window for StackSpot agents — previously the generic 50K fallback made auto-compact fire on almost every turn. If your agent’s foundation model has a different window, tune it with CHATCLI_CONTEXT_WINDOW.

Agent Mode


Multi-Agent (Parallel Orchestration)


Mixture-of-Agents (MoA)

An ensemble where several models propose an answer in parallel and an aggregator synthesizes the best one. Distinct from the parallel orchestration above (which dispatches specialist agents): here the axis is model/provider diversity. Triggered by the /moa command. Every participant — proposers and aggregator — gets the same briefing as a chat turn (attached contexts, workspace memory, skills) and read-only tools: knowledge, CCR recall and long-term memory recall. See Mixture-of-Agents.

Token Efficiency

Knobs for the token-saving optimizations (structured prompt caching, stagnation detector, smart routing, webfetch auto-save, microcompaction). See Token Efficiency for details.

Stagnation early-exit

Tool-failure guard (toolguard)

An advisory guard (it never aborts) that detects the same tool failing repeatedly inside the agent loop and injects a hint for the model to change approach instead of retrying the same error.

Smart chat ↔ agent routing

Model routing tool

WebFetch auto-save

Tool result microcompaction

Applied to the session history to shrink old tool results. See also Tool Result Management.
For chat/lookup sessions where token frugality matters more than long-term recall, tighten the knobs:

Context compression (CCR)

Content-aware, reversible compression of tool output, logs, diffs, JSON and prose. See Context Compression.

Output-token reduction


Harness/Quality Pipeline (7 Patterns)

Variables for the harness/quality pipeline that implements the seven LLM-agent patterns. See full overview and detailed configuration.

Master switch

Self-Refine (#5)

Semantic convergence cascade (char → Jaccard → embedding)

Chain-of-Verification (#6)

Reflexion (#3)

Durable queue (WAL + worker pool + DLQ)

When enabled, reflexion triggers flow through a persistent queue — lessons survive process crashes via WAL replay on next boot.

Plan-and-Solve / ReWOO (#2)

RAG + HyDE (#4)

Embedding Providers (used by HyDE 3b)

Bedrock embeddings support amazon.titan-embed-text-v2:0 (default), amazon.titan-embed-text-v1, cohere.embed-english-v3, and cohere.embed-multilingual-v3. Titan parallelizes batches with an 8-worker pool (the API accepts only 1 text per call); Cohere v3 sends the entire batch in one call. Dispatch is automatic from the model id prefix. See RAG + HyDE and AWS Bedrock.

Reasoning Backbone (#7)

Per-Agent Overrides (includes refiner / verifier)

Recommended presets (cheap dev, rigorous review, docs, incident, autopilot) in Pipeline Configuration.

Session Workspace and Subagent

Variables that control the Session Workspace (scratch dir + tool-result overflow) and Subagent Delegation.

Global TLS Trust (Corporate Proxy)

For environments behind a corporate proxy/gateway performing TLS inspection with a private CA (Zscaler, Netskope, CrowdStrike Falcon, etc.). Both variables apply to every outbound HTTPS connection in the process: all LLM providers, TTS/STT, embeddings, web tools (@webfetch/@websearch/@osv), gateway channels, MCP transports, skill registries and the version check. The process-wide equivalent of NODE_EXTRA_CA_CERTS / NODE_TLS_REJECT_UNAUTHORIZED in Node.js tools such as Claude Code.
Go — and therefore ChatCLI — already trusts the operating system’s cert store by default (Keychain on macOS, the Windows cert store, /etc/ssl on Linux). If the corporate CA is already installed on the machine, no configuration is needed. CHATCLI_CA_BUNDLE covers the case where the CA cannot be installed system-wide.
With CHATCLI_TLS_INSECURE_SKIP_VERIFY=true ChatCLI accepts any certificate — invalid, expired, forged — and is exposed to man-in-the-middle attacks (capture of API keys, code and credentials). Never use it in production.
The Bedrock-specific variables (CHATCLI_BEDROCK_CA_BUNDLE / CHATCLI_BEDROCK_INSECURE_SKIP_VERIFY, in the AWS Bedrock section) take precedence over the global ones; when absent, Bedrock inherits the globals as fallback, since the AWS SDK builds its own HTTP client.
Quick diagnosis: unresolved TLS inspection produces an x509 error (certificate signed by unknown authority) — that is what CHATCLI_CA_BUNDLE fixes. A 403 comes from a layer above (WAF/proxy policy: User-Agent, fingerprint, authentication) and is not solved by TLS trust — for that, see the web proxy variables (HTTPS_PROXY, CHATCLI_PROXY_AUTH) in /config resilience.

History Compaction and Payload Recovery

Controls the HistoryCompactor (3-level pipeline: trim → summarize → emergency) and the reactive detection of corporate-proxy/gateway limits. See Context Recovery.
Behind a corporate proxy you usually don’t need to guess anymore: on the first rejection, ChatCLI learns the cap from the exact size the gateway refused (¾ of the rejected request) and applies it for the session. Set CHATCLI_MAX_PAYLOAD explicitly only when you know the proxy limit up front — an explicit value below the learned one always wins. ChatCLI leaves a 30% headroom for JSON overhead + system prompt + tool definitions.
When a 413/WAF/EOF hits, Bedrock errors carry the exact rejected request size and the session cap is derived from it (adaptive learned cap). Only when the size is unknown does ChatCLI fall back to assuming 4 MB for the rest of the session. Either way it injects a one-time hint into history telling the AI to prefer line-ranged reads. If the system prompt alone (personas, skills, MCP tool docs) meets the rejected size, recovery fails fast with an actionable diagnosis instead of retrying — see Context Recovery.

/coder and /agent UI

Available styles:
  • full (default) — full bordered cards ╭── ICON TITLE ─────╮ … ╰─╯. Each tool call is a highlighted action. Best for /agent (supervised plan-and-execute).
  • compact — inline lines ↻ Read(main.go) / ✓ Read(main.go) 0.3s. Long sessions with dozens of tools stay scannable. Best for /coder.
  • minimal — middle ground: smaller cards with truncated content.
The variable keeps the legacy name CHATCLI_CODER_UI for back-compat, but as of v1.119 it controls BOTH modes. If you had CHATCLI_CODER_UI=compact set, /agent will now also render compactly.
Color change also in v1.119: tool failures (, ❌ EXECUTION FAILED) now render in true red instead of purple. Previously they shared the header color (ColorPurple), which was confusing. If your terminal maps ANSI 31 (red) to a non-red color via theme, adjust the palette.

Provider Fallback


MCP (Model Context Protocol)

The MCP subsystem also manages ~/.chatcli/mcp/ for durable state: channels.jsonl (durable push-notification ring, with rotation) and triggers.json (opt-in trigger engine rules). These paths are fixed — no environment variables override them. Details: MCP Channels and MCP Config.

Bootstrap and Memory


Scheduler

See Scheduler (Chronos) for the full design. All boolean variables accept enabled/disabled/true/false/1/0.

Core

Default budget (per-job overrides win)

Safety

Audit log

Daemon


Metrics and Observability


Security

Context and memory threat scan

Sanitizes injected prompt content — contexts attached via /context attach and long-term memory — against prompt-injection before sending it to the model.

Server Security

Agent Security

Plugin and Auth Security

Operator Security

The operator REST API authentication loads API keys with hot-reload every 30s in the following priority order: Secret chatcli-operator-secretsConfigMap chatcli-operator-config → reject (or accept in dev-mode if CHATCLI_OPERATOR_DEV_MODE=true).

OAuth


Remote Server


Remote Client


Chat Gateway (Telegram / Slack / Discord / WhatsApp / Webhook)

Bridge that exposes ChatCLI as a bot/service on messaging platforms. Started with /gateway start. Each inbound message runs through the real agent loop (tools, shell, file edits — auto-executed) and the progress is streamed back to the chat. Each adapter only activates when its required variables are present — set only the channels you want. See Chat Gateway.

Telegram

Slack

Discord

WhatsApp (Cloud API)

Generic webhook

Voice / transcription (audio on channels)

Transcribes voice notes to text before the pipeline. Local-first selection: command → self-hosted URL → whisper CLI on PATH (auto, downloads the model) → Groq → OpenAI → disabled. See Chat Gateway → Voice messages.
Voice notes are OGG/Opus; local whisper.cpp and the embedded engine need ffmpeg to decode them (cloud/self-hosted backends decode server-side). With nothing configured, the gateway uses the embedded Whisper automatically — only platforms without a prebuilt engine get the configuration hint.

Proactive messaging (@send)

Home channels for the @send tool when the target is just the platform.

Voice reply / TTS

Synthesizes the reply to audio. Local-first: command → self-hosted URL → embedded (if provisioned)say/espeak on PATH → OpenAI → Groq → Gemini → disabled. See Text-to-Speech and Voice Replies.

Image generation (@image)

Generates images from text. Local-first: SD WebUI → OpenAI-compatible URL → OpenAI → Google Imagen → xAI grok-image → Bedrock. See Image Generation.

Diagram rendering (@diagram)

Renders Graphviz DOT to PNG/SVG/JPG with crisp, correct text. Graphviz is embedded (WASM, no install); when a system dot is on PATH, the auto backend uses it for more polished output. See Diagrams (@diagram).

Interactive graph (@graphview)

Renders an interactive, Obsidian-style force-directed graph (draggable) to a self-contained HTML file opened in the browser. See Interactive graph (@graphview).

Vision / image input

Lets the model see attached images (@file photo.png) in chat/coder/agent and over the gateway. Hybrid strategy: providers with vision in the catalog get the image natively; without vision, a vision model describes the image and the text is folded into the prompt (describe-fallback). See Image Input (Vision).
xAI (image) and Groq (voice) use their standard keys (XAI_API_KEY, GROQ_API_KEY); Google uses GOOGLEAI_API_KEY/GEMINI_API_KEY; Bedrock uses the chat provider’s AWS credential chain (BEDROCK_REGION/AWS_REGION, BEDROCK_PROFILE/AWS_PROFILE). The @osv, @session and @skill tools need no variables. Use @image models or /config image to view/switch backend and model at runtime.

Conversation Hub (cross-channel continuity)

Carries a conversation across channels: a topic started on Telegram/Slack/WhatsApp continues in the notebook chatcli (and vice-versa), until /newsession. It is a momentary bridge with a bounded database — not long-term memory (that lives in /memory and /session). See Conversation Hub. Every option below can also be changed at runtime by command (/config hub set <key> <value>), with precedence: setting (in hub.db) > environment variable > default. A value set by command persists in the database and is read live by the gateway daemon.
To “run chatcli + the gateway on one machine and share context”: just CHATCLI_HUB_PRINCIPAL (or the default) — no bindings needed. For a multi-user bot, turn on CHATCLI_HUB_ISOLATE=true and use CHATCLI_HUB_BINDINGS to map who is who.

LSP (Language Server Protocol — diagnostics)

Code diagnostics (compiler/linter errors and warnings) for a file, via LSP servers. Triggered manually by the /lsp <file> command. Each variable overrides the command used to start the language server for its language; when unset, ChatCLI uses the default preset (if the binary is on PATH). See LSP Diagnostics.
Backends are keyless by design: DuckDuckGo (HTML scraping, default) + SearxNG (self-hosted via SEARXNG_URL). See Web Tools for the fallback chain.

K8s Watcher


Complete .env Example