tgpt vs Shell GPT
Side-by-side comparison to help you choose.
| Feature | tgpt | Shell GPT |
|---|---|---|
| Type | CLI Tool | CLI Tool |
| UnfragileRank | 41/100 | 40/100 |
| Adoption | 1 | 1 |
| Quality | 0 | 0 |
| Ecosystem | 0 | 0 |
| Match Graph | 0 | 0 |
| Pricing | Free | Free |
| Capabilities | 14 decomposed | 12 decomposed |
| Times Matched | 0 | 0 |
Tgpt implements a multi-provider abstraction layer that routes requests to free AI providers (Phind, Isou, KoboldAI) without requiring API keys, while also supporting optional API-key-based providers (OpenAI, Gemini, Deepseek, Groq) and self-hosted Ollama. The architecture uses a provider registry pattern where each provider implements a common interface for request/response handling, enabling transparent switching between free and paid backends based on user configuration or environment variables (AI_PROVIDER, AI_API_KEY).
Unique: Implements provider registry pattern with transparent fallback logic, allowing users to access free AI without API keys while maintaining compatibility with premium providers — most competitors require API keys upfront or lock users into single providers
vs alternatives: Eliminates API key friction for casual users while maintaining enterprise provider support, unlike ChatGPT CLI (API-only) or Ollama (self-hosted only)
Tgpt maintains conversation state across multiple turns using two interactive modes: normal interactive (-i/--interactive) for single-line input with command history, and multiline interactive (-m/--multiline) for editor-like input. The architecture preserves previous messages in memory (PrevMessages field in Params structure) and passes them to the AI provider with each new request, enabling the model to maintain context across turns. This is implemented via the interactive loop in main.go (lines 319-425) which accumulates messages and manages the conversation thread.
Unique: Implements in-memory conversation state with ThreadID-based conversation isolation, allowing users to maintain multiple independent conversation threads without external database — most CLI tools either reset context per invocation or require Redis/database backends
vs alternatives: Simpler than ChatGPT Plus (no subscription) and faster than web interfaces, but trades persistence for simplicity; better for ephemeral conversations than tools requiring conversation export
Tgpt's image generation mode supports generating multiple images in a single request via ImgCount parameter, with customizable dimensions (Width, Height) and aspect ratios (ImgRatio). The ImageParams structure enables fine-grained control over generation parameters, and the imagegen module handles batch processing and disk output. Multiple images are saved with sequential naming (e.g., image_1.png, image_2.png) to the specified output directory (Out parameter).
Unique: Implements batch image generation with aspect ratio and dimension control via ImageParams structure, enabling content creators to generate multiple variations without manual iteration — most CLI image tools generate single images per invocation
vs alternatives: Faster than manual iteration, but slower than commercial batch APIs (DALL-E, Midjourney); better for prototyping than production workflows
Supports local AI model inference via Ollama, a self-hosted model runner that allows users to run open-source models (Llama, Mistral, etc.) on their own hardware. The implementation treats Ollama as a provider in the registry, routing requests to a local Ollama instance via HTTP API. This enables offline operation and full data privacy, as all inference happens locally without sending data to external providers.
Unique: Integrates Ollama as a first-class provider in the registry, treating local inference identically to cloud providers from the user's perspective. This enables seamless switching between cloud and local models via the --provider flag without code changes.
vs alternatives: Provides offline AI inference without external dependencies, making it more private and cost-effective than cloud providers for heavy usage, though slower on CPU-only hardware.
Supports configuration through multiple channels: command-line flags (e.g., -p/--provider, -k/--api-key), environment variables (AI_PROVIDER, AI_API_KEY), and configuration files (tgpt.json). The system implements a precedence hierarchy where CLI flags override environment variables, which override config file settings. This enables flexible configuration for different use cases (single invocation, session-wide, or persistent).
Unique: Implements a three-tier configuration system (CLI flags > environment variables > config file) that enables flexible configuration for different use cases without requiring a centralized configuration management system. The system respects standard Unix conventions (environment variables, command-line flags).
vs alternatives: More flexible than single-source configuration; respects Unix conventions unlike tools with custom configuration formats.
Supports HTTP/HTTPS proxy configuration via environment variables (HTTP_PROXY, HTTPS_PROXY) or configuration files, enabling tgpt to route requests through corporate proxies or VPNs. The system integrates proxy settings into the HTTP client initialization, allowing transparent proxy support without code changes. This is essential for users in restricted network environments.
Unique: Integrates proxy support directly into the HTTP client initialization, enabling transparent proxy routing without requiring external tools or wrapper scripts. The system respects standard environment variables (HTTP_PROXY, HTTPS_PROXY) following Unix conventions.
vs alternatives: More convenient than manually configuring proxies for each provider; simpler than using separate proxy tools like tinyproxy.
Tgpt's code generation mode (-c/--code) routes prompts to AI providers with a specialized preprompt that instructs models to generate code, then applies syntax highlighting to the output based on detected language. The implementation uses the helper module (src/helper/helper.go) to parse code blocks from responses and apply terminal color formatting. The Preprompt field in Params structure allows customization of the system message, enabling code-specific instructions to be injected before the user's prompt.
Unique: Implements preprompt injection pattern to steer AI models toward code generation, combined with terminal-native syntax highlighting via ANSI codes — avoids external dependencies like Pygments or language servers
vs alternatives: Lighter weight than GitHub Copilot (no IDE required) and faster than web-based code generators, but lacks IDE integration and real-time validation
Tgpt's shell command mode (-s/--shell) generates executable shell commands from natural language descriptions by routing prompts through AI providers with shell-specific preprompts. The architecture separates generation from execution — commands are displayed to the user for review before running, preventing accidental execution of potentially dangerous commands. The implementation uses the Preprompt field to inject instructions that guide models toward generating safe, idiomatic shell syntax.
Unique: Implements safety-first command generation by displaying commands for user review before execution, with preprompt steering toward idiomatic shell syntax — avoids silent execution of untrusted commands unlike some shell AI tools
vs alternatives: Safer than shell copilots that auto-execute, more accessible than manual man page lookup, but requires user judgment unlike IDE-integrated tools with syntax validation
+6 more capabilities
Generates platform-specific shell commands by detecting the user's OS and active shell ($SHELL environment variable), then presents an interactive prompt allowing execution, description, or abortion of the generated command. The DefaultHandler routes the --shell flag to a SHELL SystemRole that constrains LLM output to executable commands. After generation, sgpt parses the response and offers [E]xecute, [D]escribe, [A]bort options, with --no-interaction flag enabling pipeline-friendly non-interactive mode that writes directly to stdout.
Unique: Detects OS and shell environment at runtime to generate platform-specific commands, then wraps generation with an interactive execution gate ([E]xecute/[D]escribe/[A]bort) that prevents blind execution while maintaining pipeline compatibility via --no-interaction flag. This three-way decision point is built into the Handler base class, not a post-processing step.
vs alternatives: Faster context-switching than web search and safer than piping LLM output directly to shell because the interactive prompt forces review before execution, unlike tools that auto-execute or require manual copy-paste.
Implements a SystemRole abstraction (defined in sgpt/role.py) that wraps user prompts with role-specific system instructions before sending to the LLM. Built-in roles include SHELL (command generation), DESCRIBE_SHELL (command explanation), CODE (code generation), and GENERAL (Q&A). Roles are selected via CLI flags (--shell, --describe-shell, --code) and mapped through DefaultRoles.check_get() in app.py. Custom roles can be created and persisted via --create-role, allowing users to define domain-specific prompt templates that are reused across sessions.
Unique: Roles are first-class abstractions in the architecture (sgpt/role.py) that decouple prompt templates from CLI logic. The DefaultRoles.check_get() function maps flag combinations to roles, and custom roles are persisted as configuration files, enabling non-developers to create and share role definitions without code changes.
More flexible than hardcoded prompt prefixes because roles are user-definable and persistent, but less powerful than full prompt engineering frameworks because there's no role composition, versioning, or A/B testing infrastructure.
tgpt scores higher at 41/100 vs Shell GPT at 40/100.
Need something different?
Search the match graph →© 2026 Unfragile. Stronger through disorder.
Allows users to compose prompts in their preferred text editor via the --editor flag, which opens $EDITOR (or a configured editor) for prompt composition. This is useful for long, complex prompts that are cumbersome to type on the command line. The editor integration is implemented in sgpt/utils.py and captures the editor's output as the prompt text. After the user saves and closes the editor, the prompt is sent to the LLM. This enables multi-line prompts, code snippets, and formatted text without shell escaping.
Unique: Editor integration is implemented in sgpt/utils.py as a utility function that launches $EDITOR, captures its output, and returns the text as the prompt. The --editor flag is a simple boolean that triggers this flow in app.py. This allows users to compose prompts in their preferred editor without leaving the terminal.
vs alternatives: More flexible than command-line argument prompts because it supports multi-line input and editor features, but slower because it requires launching an external process. Similar to 'git commit --editor' in workflow but specific to prompt composition.
Manages tool configuration via ~/.config/shell_gpt/.sgptrc, a file-based configuration store that persists settings across invocations. Configuration includes API keys, backend selection (USE_LITELLM), model choice, cache TTL, and custom roles. The config.py module handles reading and writing configuration, with sensible defaults for unset values. On first run, sgpt prompts the user for an OpenAI API key and writes it to .sgptrc. Configuration can also be overridden via environment variables (e.g., OPENAI_API_KEY, API_BASE_URL), allowing both file-based and environment-based configuration.
Unique: Configuration is file-based (~/.config/shell_gpt/.sgptrc) and read by config.py at startup, with environment variable overrides for CI/CD flexibility. On first run, sgpt interactively prompts for an API key and writes it to the config file. This hybrid approach supports both interactive setup and automated deployment.
vs alternatives: Simpler than complex configuration systems (YAML, TOML, environment-based) because it uses a flat file format, but less secure because API keys are stored in plaintext. More portable than environment-only configuration because settings persist across sessions.
Abstracts LLM provider selection through a Handler base class (sgpt/handlers/handler.py) that supports OpenAI (default), Azure OpenAI, and OpenAI-compatible servers (Ollama, local models) via LiteLLM. Backend selection is controlled by the USE_LITELLM config flag in ~/.config/shell_gpt/.sgptrc and environment variables (API_BASE_URL, OPENAI_API_KEY). The Handler class owns client initialization, request routing, and response streaming, allowing providers to be swapped without changing CLI or role logic. LiteLLM is an optional dependency; if not installed, the tool falls back to OpenAI's official client.
Unique: Handler base class abstracts provider selection at the architecture level, not as a post-hoc wrapper. Backend logic lives in sgpt/handlers/handler.py and is controlled by a single USE_LITELLM config flag; switching providers requires only environment variable changes, not code modifications. LiteLLM is optional, allowing lightweight deployments with OpenAI while supporting advanced users who need local models.
vs alternatives: More flexible than tools locked to a single provider (e.g., GitHub Copilot → OpenAI only) because it supports Ollama and Azure, but less integrated than provider-native SDKs because abstraction adds latency and loses provider-specific optimizations.
Maintains multi-turn conversations using the --chat <id> flag, which routes requests to ChatHandler instead of DefaultHandler. Chat sessions are persisted to disk (location managed by sgpt/cache.py) with full conversation history, allowing users to reference previous messages and build context across multiple invocations. Each session is identified by a unique ID; the same ID can be reused to continue a conversation. Session state includes all prior user prompts and LLM responses, enabling the LLM to maintain context without re-sending the entire history on each request (handled by the Handler's context management).
Unique: ChatHandler (separate from DefaultHandler) manages session state by persisting full conversation history to disk and passing it to the LLM on each request. Session IDs are arbitrary user-provided strings, not auto-generated UUIDs, allowing users to name conversations semantically. History is stored in ~/.config/shell_gpt/ alongside configuration, making it portable and inspectable.
vs alternatives: Simpler than full chat applications (no UI, no cloud sync) but more persistent than stateless tools because history survives terminal restarts and can be manually reviewed. Weaker than ChatGPT web UI because there's no conversation search, branching, or multi-device sync.
Provides a read-eval-print loop (REPL) via the --repl <id> flag, which routes requests to ReplHandler and creates an interactive shell-like environment where users can issue multiple prompts in sequence without restarting the tool. Each REPL session maintains state (conversation history, role context) across multiple user inputs, similar to chat sessions but with a continuous interactive loop. The REPL mode is useful for exploratory tasks where users want rapid iteration without the overhead of invoking sgpt multiple times.
Unique: ReplHandler implements a continuous event loop that maintains session state across multiple user inputs, similar to Python's REPL or a shell. Unlike --chat, REPL mode is designed for rapid iteration within a single terminal session and does not persist history by default. The REPL loop is implemented in sgpt/handlers/ and integrates with the same role and caching systems as other handlers.
vs alternatives: More interactive than --chat (no need to re-invoke sgpt for each prompt) but less persistent because history is not saved by default. Similar to ChatGPT's web interface in feel but without the GUI or cloud persistence.
Caches LLM responses to disk using sgpt/cache.py, reducing API calls and latency for repeated or similar prompts. Caching is enabled by default (--cache flag) and uses a hash of the prompt, role, and other parameters as the cache key. Cached responses are stored in ~/.config/shell_gpt/ with configurable time-to-live (TTL); expired cache entries are automatically invalidated. The cache is transparent to users — if a cached response exists, it is returned without making an API call. Cache behavior can be controlled via configuration flags.
Unique: Caching is implemented at the Handler base class level (sgpt/cache.py), making it transparent and consistent across all handler types (DefaultHandler, ChatHandler, ReplHandler). Cache keys are deterministic hashes of prompt + role + parameters, and TTL is configurable. Caching is enabled by default but can be disabled per-request or globally via configuration.
vs alternatives: Simpler than distributed caching systems (Redis, Memcached) because it's local and requires no setup, but less powerful because there's no cache invalidation, sharing, or analytics. Faster than making repeated API calls but slower than in-memory caches because responses are read from disk.
+4 more capabilities