kardolus/chatgpt-cli
ChatGPT CLI is a powerful, multi-provider command-line interface for working with modern LLMs. It supports OpenAI, Azure, Perplexity, LLaMA, and more, with features like streaming, interactive chat, prompt files, image/audio I/O, MCP tool calls, and an experimental agent mode for safe, multi-step automation.
ChatGPT CLI – a terminal front‑end for modern LLMs
What it is – A single‑binary command‑line tool that lets you talk to a variety of large‑language‑model providers (OpenAI, Azure, Perplexity, LLaMA, etc.) directly from the shell. It supports ordinary query mode, a streaming “live‑typing” mode, an interactive REPL, and an experimental agent mode that can run multi‑step tool‑using workflows.
Key capabilities
- Provider‑agnostic – configure any supported LLM via a
config.yamlor environment variables. - Streaming & query modes – get token‑by‑token output or a single response.
- Threaded context – each thread keeps its own chat history with a sliding‑window that trims automatically to stay under token limits.
- Prompt files –
--prompt <file>injects a full‑text prompt (e.g. a markdown guide) before your query. - Multimedia I/O – upload images (
--image), generate images (--draw), upload audio (--audio), transcribe (--transcribe), and synthesize speech (--speak). - MCP (Model Context Protocol) – call external tools over HTTP or stdio, have the CLI manage sessions, and inject the tool’s result into the conversation as context.
- Agent mode – a ReAct or Plan/Execute loop that can run shell commands, read/write files, and respect configurable budget (steps, tokens, wall‑time) and policy (allowed tools, denied commands, work‑dir sandbox).
- Web search – optional live web fetch for models that support it.
- Auto‑completion – generate Bash/Zsh/Fish completions via
chatgpt completion.
Installation
- Homebrew (macOS):
brew tap kardolus/chatgpt-cli && brew install chatgpt-cli(trust the tap once). - Pre‑built binaries –
curl -L …/chatgpt-<os‑arch>thenchmod +xand move to a directory on yourPATH(examples for Apple Silicon, Intel macOS, Linux amd64/arm64/386, FreeBSD, Windows are in the README).
Getting started
- Export your OpenAI key:
export OPENAI_API_KEY=sk‑…(or configure another provider). - Create the history directory:
mkdir -p ~/.chatgpt-cli. - Simple query:
chatgpt "what is the capital of the Netherlands". - Interactive REPL:
chatgpt --interactive. - Use a prompt file:
chatgpt --prompt my‑prompt.md "Summarize this code". - Run an agent task:
chatgpt "why is my test failing?" --agent(or add--agent-mode plan).
Configuration
- Settings can be supplied via flags, environment variables (prefixed with the config name), a config.yaml file, or fall back to built‑in defaults. The hierarchy is flag > env > file > default.
- Provider‑specific sections (OpenAI, Azure, Perplexity, 302 AI, Atlas Cloud) let you store API keys, endpoint URLs, model defaults, etc.
- Agent‑specific options let you set default policies, budget limits, and a sandbox work directory.
- The
--targetflag lets you switch between multiple config files.
Typical use‑cases
- Quick look‑ups without opening a browser.
- Scripting: pipe file contents or command output into the CLI and get a model‑generated answer.
- Automated workflows: use agent mode to let the model run a series of shell commands safely.
- Extending with custom tools via MCP – e.g., call a weather‑scraper service and feed the result back to the model.
Where to find more
- Full flag reference:
chatgpt --help. - Example prompt repository: https://github.com/kardolus/prompts.
- Issue tracker & contribution guide are linked in the README.
All details above are taken directly from the project's README; no additional features have been inferred.
Related
- Project
- Dispatch
- Project
- Project
- Project