- Go 99.1%
- Shell 0.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| cmd | ||
| docs | ||
| internal | ||
| scripts | ||
| static | ||
| .agents-sync.jsonc | ||
| .gitignore | ||
| AGENTS.md | ||
| AGENTS.project.md | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| main_test.go | ||
| README.md | ||
| VERSION | ||
chatgpt-cli
An unofficial ChatGPT client for your terminal, in a single Go binary.
It talks to ChatGPT's web endpoints using your existing account, so there are no API tokens to pay for. Your account's model access and usage limits still apply.
Status: MVP. Not affiliated with OpenAI. The undocumented endpoints it relies on can change without notice.
Features
- Streaming chats with Markdown and syntax-highlighted code blocks
- Full chat history, search, projects, branching, and archiving
- Model selection
- File attachments, downloads, and Markdown export
- Inline images in Kitty and Ghostty (or via chafa elsewhere)
- Mouse text selection and clipboard copy, including over SSH
- No Python, Node, or background daemon — Chrome is only needed once, to sign in
Install
Requires Go 1.25.2 or newer.
go build -o chatgpt-cli .
./chatgpt-cli
Prebuilt Linux and macOS binaries are attached to each release.
Sign in
You only need Chrome to capture your session. After that, everything runs in Go.
-
Start Chrome with a dedicated profile and remote debugging enabled (macOS shown):
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \ --no-first-run --remote-debugging-port=9222 \ --remote-debugging-address=127.0.0.1 \ --user-data-dir="$HOME/.local/share/chatgpt-cli/chrome-profile" \ https://chatgpt.com/ -
Sign in to ChatGPT in that browser.
-
Run
./chatgpt-cli, enterhttp://127.0.0.1:9222on the authentication screen, and press Enter. You can close Chrome afterwards.
Running on a headless server? See remote authentication.
Use /auth any time you need to sign in again.
Basic use
Type a message and press Enter to send it. Type / to see all commands.
| Key | Action |
|---|---|
| Enter | Send |
| Shift+Enter or Ctrl+J | New line |
/ |
Show commands (Tab completes, Enter runs) |
| Left (empty input) | Browse chats |
| Shift+Up / PageUp | Scroll the conversation |
| Mouse drag, then Ctrl+C | Copy selected text |
| Ctrl+C | Cancel a response, clear input, or quit |
Common commands:
| Command | Action |
|---|---|
/new |
Start a new chat |
/chats |
Browse your chats |
/search |
Search all chats |
/projects |
Browse projects |
/model |
Choose a model |
/attach [PATH] |
Attach a file to your next message |
/copy |
Copy the last response |
/export [PATH] |
Save the chat as Markdown |
/help |
Show all controls and commands |
The usage guide covers every key, command, and feature in detail.
Where your data lives
| Data | Location |
|---|---|
| Credentials and preferences | ~/.local/state/chatgpt-cli/ |
| Cached conversations | ~/.local/share/chatgpt-cli/conversations/ |
| Sentinel SDK cache | ~/.cache/chatgpt-cli/sentinel/ |
The usual XDG_*_HOME variables override these. Files are private to your user
but not encrypted — your session grants access to your ChatGPT account, so
don't share it. To sign out, quit and delete session.json from the state
directory.
Documentation
- Usage guide — every feature, key, and command
- Remote authentication — signing in on a headless machine
- Development — building, testing, and releasing
- Protocol notes — how it talks to ChatGPT
Future plans
Features
- Non-interactive commands
- Automated builds for all relevant platforms
- Multiple color schemes
/copyshould allow selecting which response to copy with Up/Down
Bug fixes
- Weird box didn't render in sentinel planning
License
Licensed under the MIT License.
