Shell GPT (sgpt) is an open-source command-line productivity tool created by Farkhod Sadykov (TheR1D). It connects standard terminal workflows directly to OpenAI and OpenAI-compatible Large Language Models, allowing users to query models without leaving the terminal. Day-to-day, developers interact with the tool using the sgpt binary. It supports single-line queries, interactive REPL chat sessions, and automated shell command generation. Because it adheres to Unix piping conventions, users can pipe stdout from commands like git, cat, or docker directly into sgpt to analyze logs, refactor code, or generate bash commands. Unlike complex autonomous agents designed for multi-file workspace orchestration, Shell GPT focuses strictly on low-latency, modular terminal tasks. It acts as an intelligent command generator and text processor rather than an autonomous harness that modifies repository trees. Shell GPT is licensed under the MIT license and is free to use. Operational costs are limited to the user's direct API consumption with OpenAI or alternative compatible endpoints.
Shell command generation — Translates natural language descriptions directly into executable shell commands. - Interactive REPL mode — Supports ongoing conversational context within interactive terminal sessions. - Standard input integration — Accepts piped input directly from stdout for real-time log analysis and code reviews. - Configurable model parameters — Allows configuration of default parameters like temperature and endpoint URLs in local settings. - OpenAI compatibility — Connects to OpenAI APIs and compatible local or hosted LLM endpoints.
Use cases
Use Case: Natural Language to Shell Commands Developers can generate complex shell, awk, or sed commands by describing the desired outcome in natural language directly from the prompt.
Use Case: Piped Log and Error Diagnosis System administrators can pipe command error output or system log files directly into sgpt to diagnose failures and identify resolution steps.
Use Case: Inline Code Snippet Refactoring Programmers can send code snippets to sgpt from the terminal or text streams to explain logic, find bugs, or suggest optimizations.
Who it is for
Shell GPT is built for developers, DevOps engineers, and system administrators who spend significant time in the terminal and need quick command assistance or piped text analysis. It is not suitable for users seeking a full-repo autonomous coding agent or a graphical IDE extension.
Install guide
Installation Install Shell GPT using pip: bash pip install shell-gpt
First Run Set your OpenAI API key as an environment variable or provide it on first invocation: bash export OPENAI_API_KEY="your_openai_api_key_here" sgpt "Hello, are you ready to assist in the terminal?"
Example Session Generate and review a shell command: bash sgpt --shell "find all .log files modified in the last 24 hours and compress them" Pipe command output for diagnosis: bash cat error.log | sgpt "summarize the root cause of these exceptions"
tu — tu is an open-source terminal agent harness and automation utility maintained by Sahil Ahuja (sahil87). Built primarily with Node.js and…
Qwen Code — Qwen Code is an open-source terminal-based AI coding assistant maintained by the Qwen team (Alibaba Cloud / QwenLM). Built on…
Cline — Cline is an open-source autonomous coding agent runtime maintained by Cline Bot Inc. and an active open-source community. Available as…
GitHub Copilot CLI — GitHub Copilot CLI is a terminal-based AI coding assistant developed by GitHub. It integrates the Copilot coding agent runtime directly…
Continue — Continue is an open-source AI code assistant and agent framework originally developed by the Continue team (continuedev) and recently acquired…
Aider — Aider is an open-source terminal-based AI pair programming tool created by Paul Gauthier and the Aider-AI community. It operates directly…