Credentials. Each prompt is billed to your OpenAI key; set a usage limit in your OpenAI account if you use it heavily.
Who it is forA developer who wants quick scripts from the terminal without switching to a browser chat.
The problemOne-shot prompts lose context, so every follow-up means re-explaining what you already asked for.
The outcomeA working script refined step by step in a session you can return to later.
What you need first
- Python and pip
- An OpenAI API key, stored in ~/.config/shell_gpt/.sgptrc on first run, or a local backend such as Ollama
- Linux, macOS or Windows with Bash, Zsh, PowerShell or CMD
Steps
- Install with
pip install shell-gpt - Start a session:
sgpt --chat conversation_2 --code "make a request to localhost using python" - Refine it in the same session:
sgpt --chat conversation_2 --code "add caching" - Redirect pure code output to a file, as in
sgpt --code "solve classic fizz buzz problem using Python" > fizz_buzz.py - Use the REPL mode for longer back and forth; sessions live at the configurable CHAT_CACHE_PATH
Prompt for your agent
Using TheR1D/shell_gpt, start a chat session named <name> with --code to write a Python script that <task>, refine it with two follow-ups about <changes>, and save the final code to <file>. Run it once to check it works.
Caveat. Generated code is unreviewed: test it before relying on it.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for TheR1D/shell_gpt and "Build and refine code in a named terminal chat session"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer