A Python command-line tool and workflow manager for interacting with LLMs such as ChatGPT/GPT-4 from the terminal.
j178/chatgpt
A terminal CLI for chatting with OpenAI's GPT-3.5 and GPT-4 models, with interactive chat mode and pipeline support.
Open-source alternative to:ChatGPT
- Stars
- 776
- Forks
- 47
- Open issues
- 11
- Last commit
- 2 months ago
What is it?
chatgpt is a command-line client for OpenAI's chat models, written in Go. Running `chatgpt` opens an interactive chat session in the terminal, and `chatgpt -p` starts a session with a named or ad-hoc system prompt, such as a translator persona.
The tool also works in shell pipelines: text piped in via stdin is sent as input, so it can be combined with other commands to transform files or output. Conversations are saved locally in a JSON file, and each one can carry its own model, prompt, context length and token settings. Keyboard shortcuts for multi-line input, history navigation and switching between conversations are configurable.
It reads an OpenAI API key from an environment variable or config file, and can target a custom endpoint or Azure OpenAI deployments through model mapping.
Key features
- 01Interactive chat mode in the terminal
- 02Predefined or on-the-fly prompts via the -p flag
- 03Stdin support for use in shell pipelines
- 04Local saving and switching of multiple conversations
- 05Configurable key bindings and per-conversation model settings
- 06Supports custom endpoints and Azure OpenAI deployments
Use cases
- Quick questions from a terminal without opening a browser
- Transforming files or command output with a prompt in a shell pipeline
- Running a translator or other persona-based prompt from the command line
Quick start
- 1
Install the binary with Go
go install github.com/j178/chatgpt/cmd/chatgpt@latest - 2
Get an OpenAI API key and export it
export OPENAI_API_KEY=xxx - 3
Start chat mode
chatgpt
Things to know
- Requires an OpenAI API key and only supports OpenAI GPT-3.5 and GPT-4 models for now.
- The project has no license specified in its metadata, so reuse terms are unclear.
In collections
Topics
FAQ
- What is chatgpt?
- A terminal CLI for chatting with OpenAI's GPT-3.5 and GPT-4 models, with interactive chat mode and pipeline support. chatgpt is a command-line client for OpenAI's chat models, written in Go. Running `chatgpt` opens an interactive chat session in the terminal, and `chatgpt -p` starts a session with a named or ad-hoc system prompt, such as a translator persona.
- Is chatgpt free to use? What license does it have?
- chatgpt has no declared license. Its code is public, but without a license you have no explicit permission to reuse it; ask the author before relying on it.
- Is chatgpt still maintained?
- Updated within 6 months. The last commit to chatgpt was on Aug 29, 2026.
- What can I use chatgpt for?
- Quick questions from a terminal without opening a browser Transforming files or command output with a prompt in a shell pipeline Running a translator or other persona-based prompt from the command line
- How do I install chatgpt?
- Install the binary with Go: go install github.com/j178/chatgpt/cmd/chatgpt@latest Get an OpenAI API key and export it: export OPENAI_API_KEY=xxx Start chat mode: chatgpt
- Where can I get chatgpt?
- The source code and installation instructions are on GitHub: https://github.com/j178/chatgpt
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A VS Code extension that lets you send code questions, explanations, tests and fixes to OpenAI models from inside the editor.
Desktop app that translates subtitle files (SRT, VTT, ASS, SSA) into other languages using ChatGPT-style LLMs.
A multi-provider command-line client for ChatGPT-style LLMs, supporting OpenAI, Azure, Perplexity and LLaMA endpoints with streaming, interactive chat and agent mode.
An open-source Obsidian plugin that generates text in your notes using OpenAI, Anthropic, Google, HuggingFace and local models.
AI code assistant plugin for Vim and Neovim that generates, edits and chats with OpenAI-compatible models from inside the editor.