{"id":50789714,"url":"https://github.com/wolfiesch/chatgpt-cli","last_synced_at":"2026-06-12T10:02:46.309Z","repository":{"id":338413799,"uuid":"1157771740","full_name":"wolfiesch/chatgpt-cli","owner":"wolfiesch","description":"CLI interface to ChatGPT using Chrome auth. Supports GPT-5.2 thinking modes, file/image upload, conversation management.","archived":false,"fork":false,"pushed_at":"2026-02-14T14:50:08.000Z","size":226,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-14T19:15:47.012Z","etag":null,"topics":["browser-automation","chatgpt","cli","gpt-5","macos","nodriver","openai","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wolfiesch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-14T09:15:10.000Z","updated_at":"2026-02-14T14:50:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wolfiesch/chatgpt-cli","commit_stats":null,"previous_names":["wolfiesch/chatgpt-cli"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/wolfiesch/chatgpt-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfiesch%2Fchatgpt-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfiesch%2Fchatgpt-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfiesch%2Fchatgpt-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfiesch%2Fchatgpt-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wolfiesch","download_url":"https://codeload.github.com/wolfiesch/chatgpt-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfiesch%2Fchatgpt-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34238715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-automation","chatgpt","cli","gpt-5","macos","nodriver","openai","python"],"created_at":"2026-06-12T10:02:44.729Z","updated_at":"2026-06-12T10:02:46.301Z","avatar_url":"https://github.com/wolfiesch.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChatGPT CLI\n\nQuery ChatGPT from the command line using your existing Chrome authentication. Supports GPT-5.2 with 4 thinking modes (Auto, Instant, Thinking, Pro) and legacy models (o3, GPT-4.5). Upload files for analysis and images for vision. Continue existing conversations, start fresh chats, search/export/delete/archive/rename/share history, use custom GPTs, generate images with DALL-E, manage memories, extract code blocks, and use temporary chats.\n\n## Features\n\n- **GPT-5.2 Thinking Modes**: Auto, Instant, Thinking, Pro — each with different reasoning depth\n- **Legacy Models**: o3, GPT-4.5, GPT-5.1 variants behind a submenu\n- **File Upload**: Send documents for analysis (`--file report.pdf`)\n- **Image Upload**: GPT-5.2 vision for screenshots, diagrams, photos (`--image photo.jpg`)\n- **Conversation Management**: List, search, continue, export, delete, archive, rename, share chats\n- **Custom GPTs**: Route prompts to any custom GPT by name (`--gpt \"CS Tutor\"`)\n- **Image Generation**: Generate images with DALL-E and download them (`--generate-image`)\n- **Memory Management**: List ChatGPT's saved memories (`--list-memories`)\n- **Code Extraction**: Pull just the code blocks from responses (`--code-only`)\n- **Multiple Output Formats**: Formatted, JSON, raw text\n- **Project Context**: Send prompts within ChatGPT Projects\n- **Temporary Chat**: Ephemeral mode that doesn't save to history\n\n## Prerequisites\n\n- **macOS** (cookie decryption uses macOS Keychain)\n- **Python 3.10+**\n- **Chrome** with an active ChatGPT login session\n- **ChatGPT Plus/Pro** subscription (required for GPT-5.2 Pro; optional for other models)\n\n## Installation\n\n```bash\ngit clone https://github.com/wolfiesch/chatgpt-cli.git\ncd chatgpt-cli\n```\n\nThe virtual environment and dependencies are set up automatically on first run. If auto-setup fails:\n\n```bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n```\n\n## Quick Start\n\n```bash\n# Check version\npython3 scripts/run.py --version\n\n# Basic query (GPT-5.2 Auto mode)\npython3 scripts/run.py chatgpt.py --prompt \"Explain quantum entanglement\" --show-browser\n\n# Use specific thinking mode\npython3 scripts/run.py chatgpt.py --prompt \"Prove this theorem\" --model pro\n\n# Upload a file for analysis\npython3 scripts/run.py chatgpt.py --prompt \"Review this code\" --file main.py --show-browser\n\n# Upload an image for vision\npython3 scripts/run.py chatgpt.py --prompt \"What's in this image?\" --image photo.jpg --show-browser\n```\n\n\u003e **Important**: Always use `python3 scripts/run.py` as the entry point — it manages the virtual environment automatically.\n\n## Usage\n\n### Sending Prompts\n\n```bash\n# Auto mode — ChatGPT decides how long to think (default)\npython3 scripts/run.py chatgpt.py --prompt \"Hello\" --model auto\n\n# Instant — answers right away, no thinking\npython3 scripts/run.py chatgpt.py --prompt \"What is 2+2?\" --model instant\n\n# Thinking — thinks longer for better answers\npython3 scripts/run.py chatgpt.py --prompt \"Analyze this algorithm\" --model thinking\n\n# Pro — research-grade intelligence, up to 30 min\npython3 scripts/run.py chatgpt.py --prompt \"Prove this theorem\" --model pro\n\n# Legacy model (o3 reasoning)\npython3 scripts/run.py chatgpt.py --prompt \"Solve this step by step\" --model o3\n```\n\n### Conversation Management\n\n```bash\n# List recent conversations\npython3 scripts/run.py chatgpt.py --list-chats --show-browser\n\n# Continue an existing conversation (by index, title, or UUID)\npython3 scripts/run.py chatgpt.py --continue-chat idx-0 --prompt \"Follow up on that\"\npython3 scripts/run.py chatgpt.py --continue-chat \"quantum\" --prompt \"What about entanglement?\"\n\n# Start a fresh conversation\npython3 scripts/run.py chatgpt.py --new-chat --prompt \"Start fresh: explain relativity\"\n\n# Search conversations\npython3 scripts/run.py chatgpt.py --search-chats \"database schema\" --json\n\n# Export a conversation\npython3 scripts/run.py chatgpt.py --export idx-0 --format json \u003e chat.json\n```\n\n### File \u0026 Image Upload\n\n```bash\n# Upload files for analysis\npython3 scripts/run.py chatgpt.py --prompt \"Summarize this\" --file report.pdf --show-browser\n\n# Upload multiple files\npython3 scripts/run.py chatgpt.py --prompt \"Compare these\" --file a.py --file b.py --show-browser\n\n# Upload images for vision\npython3 scripts/run.py chatgpt.py --prompt \"Describe this\" --image photo.jpg --show-browser\n\n# Mix files and images\npython3 scripts/run.py chatgpt.py --prompt \"Does this code match this diagram?\" \\\n  --file code.py --image diagram.png --show-browser\n```\n\n### Output Options\n\n```bash\n# JSON output for parsing\npython3 scripts/run.py chatgpt.py --prompt \"Quick question\" --json\n\n# Raw text (for piping)\npython3 scripts/run.py chatgpt.py --prompt \"Capital of France?\" --raw\n\n# Extract only code blocks\npython3 scripts/run.py chatgpt.py --prompt \"Write a Python quicksort\" --code-only\n\n# Save screenshot\npython3 scripts/run.py chatgpt.py --prompt \"Design a system\" --screenshot /tmp/chatgpt.png\n\n# Temporary chat (not saved to history)\npython3 scripts/run.py chatgpt.py --prompt \"One-off question\" --temp-chat\n```\n\n### Custom GPTs\n\n```bash\n# Send prompt to a custom GPT by name (fuzzy match)\npython3 scripts/run.py chatgpt.py --gpt \"CS Tutor\" --prompt \"Explain recursion\" --show-browser\n\n# Custom GPT with a specific thinking mode\npython3 scripts/run.py chatgpt.py --gpt \"Code Reviewer\" --prompt \"Review this function\" --model thinking\n```\n\n### Rename, Share \u0026 Memories\n\n```bash\n# Rename a conversation\npython3 scripts/run.py chatgpt.py --rename-chat idx-0 --new-name \"Quantum Physics Notes\" --show-browser\n\n# Generate a shareable link for a conversation\npython3 scripts/run.py chatgpt.py --share idx-0 --show-browser\n\n# List ChatGPT's saved memories\npython3 scripts/run.py chatgpt.py --list-memories --show-browser --json\n```\n\n### Image Generation\n\n```bash\n# Generate an image with DALL-E\npython3 scripts/run.py chatgpt.py --generate-image \"A sunset over mountains in watercolor style\" --show-browser\n\n# Generate and download to a specific directory\npython3 scripts/run.py chatgpt.py --generate-image \"Logo for a coffee shop\" --output /tmp/images --show-browser\n```\n\n### Projects\n\n```bash\n# List ChatGPT Projects\npython3 scripts/run.py chatgpt.py --list-projects --show-browser\n\n# Send prompt within a project\npython3 scripts/run.py chatgpt.py --project \"CS Tutor\" --prompt \"Explain recursion\"\n```\n\n## Model Reference\n\n### GPT-5.2 Thinking Modes (primary)\n\n| Model | Timeout | Use Case |\n|-------|---------|----------|\n| `auto` | 2 min | ChatGPT decides how long to think (default) |\n| `instant` | 1 min | Answers right away, no thinking overhead |\n| `thinking` | 5 min | Thinks longer for better answers |\n| `pro` | 30 min | Research-grade intelligence, extended reasoning |\n\n### Legacy Models (behind submenu)\n\n| Model | Timeout | Use Case |\n|-------|---------|----------|\n| `o3` | 10 min | OpenAI's reasoning model |\n| `gpt-4.5` | 2 min | GPT-4.5 |\n| `gpt-5.1-pro` | 30 min | GPT-5.1 Pro reasoning |\n| `gpt-5.1-thinking` | 5 min | GPT-5.1 Thinking |\n| `gpt-5.1-instant` | 1 min | GPT-5.1 Instant |\n| `gpt-5-pro` | 30 min | GPT-5 Pro |\n| `gpt-5-mini` | 5 min | GPT-5 Thinking mini |\n\n## CLI Reference\n\n```\npython3 scripts/run.py chatgpt.py \u003cmode\u003e [options]\n\nGlobal:\n  --version, -V           Show version and exit\n  --help, -h              Show help and exit\n\nModes (mutually exclusive, one required):\n  --prompt, -p TEXT         Send a prompt to ChatGPT\n  --list-chats              List recent conversations from sidebar\n  --get-chat ID             Retrieve a conversation (by ID, index, or title)\n  --search-chats QUERY      Search conversations by keyword\n  --list-projects           List ChatGPT Projects from sidebar\n  --export ID               Export conversation as md/json/txt\n  --delete-chat ID          Delete a conversation\n  --archive-chat ID         Archive a conversation\n  --rename-chat ID          Rename a conversation (requires --new-name)\n  --share ID                Generate a shareable link for a conversation\n  --list-memories           List ChatGPT's saved memories\n  --generate-image PROMPT   Generate an image with DALL-E and download it\n  --continue-chat ID        Send prompt in existing chat (by idx-N, title, or UUID)\n  --new-chat                Force a fresh conversation before sending prompt\n\nOptions:\n  --model, -m        Model: auto, instant, thinking, pro, o3, gpt-4.5 (default: auto)\n  --file PATH        Upload file(s) with prompt (repeatable)\n  --image PATH       Upload image(s) for vision (repeatable)\n  --gpt NAME         Use a custom GPT by name (fuzzy match)\n  --new-name NAME    New name for --rename-chat\n  --output, -o DIR   Output directory for --generate-image downloads\n  --timeout, -t      Response timeout in seconds (default: model-dependent)\n  --screenshot       Save screenshot to this path\n  --show-browser     Show browser window (recommended for first use)\n  --headless         Run in headless mode (may be blocked by Cloudflare)\n  --json             Output full JSON response with metadata\n  --raw              Output only response text (no formatting)\n  --code-only        Extract only fenced code blocks from response\n  --format, -f       Export format: md, json, txt (default: md)\n  --project NAME     Send prompt within a project context\n  --temp-chat        Temporary chat mode (not saved to history)\n  --session-id       Unique ID for concurrent queries\n  --limit N          Max chats to list (default: 50)\n  --engine ENGINE    Browser engine: nodriver (default) or camoufox\n  --verbose, -v      Enable debug logging to stderr\n```\n\n## How It Works\n\n1. **Cookie Extraction** — Reads ChatGPT session cookies from Chrome's SQLite database\n2. **Decryption** — Decrypts encrypted cookie values using macOS Keychain\n3. **Stealth Browser** — Launches nodriver (undetected Chrome) to bypass Cloudflare\n4. **Cookie Injection** — Sets cookies via Chrome DevTools Protocol (CDP)\n5. **Navigation** — Opens ChatGPT (or navigates to an existing conversation)\n6. **Model Selection** — Selects model via `data-testid`-based CDP mouse events\n7. **File Upload** — Intercepts file chooser via CDP, triggers keyboard shortcut, sets files via `DOM.setFileInputFiles` with `backend_node_id`\n8. **Prompt Input** — Types prompt via ProseMirror editor, clicks send\n9. **Response Polling** — Monitors for stop button disappearance and text stability\n10. **Extraction** — Returns the stabilized response text\n\n## Troubleshooting\n\n| Problem | Solution |\n|---------|----------|\n| \"Cloudflare challenge detected\" | Use `--show-browser` flag |\n| \"Cookie extraction failed\" | Login to ChatGPT in Chrome |\n| \"Not logged in\" | Re-login to ChatGPT in Chrome |\n| \"Rate limit reached\" | Wait for reset or use different model |\n| \"Could not find input field\" | ChatGPT UI may have changed; run `dom_debug.py` |\n| \"Timeout waiting for response\" | Increase `--timeout`; reasoning may need more time |\n| ModuleNotFoundError | Use `run.py` wrapper instead of calling scripts directly |\n\n## Limitations\n\n- **macOS only** — Cookie decryption uses macOS Keychain\n- **`--show-browser` recommended** — Cloudflare may block headless mode\n- **ChatGPT Pro/Plus required** — For GPT-5.2 Pro and some legacy models\n- **Rate limits apply** — Varies by subscription tier\n- Conversation retrieval depends on sidebar rendering (may need scrolling for older chats)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfiesch%2Fchatgpt-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwolfiesch%2Fchatgpt-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfiesch%2Fchatgpt-cli/lists"}