{"id":51840303,"url":"https://github.com/yxhpy/chatgpt-pro-browser","last_synced_at":"2026-07-23T04:01:14.463Z","repository":{"id":366942189,"uuid":"1278084643","full_name":"yxhpy/chatgpt-pro-browser","owner":"yxhpy","description":"Use your logged-in ChatGPT (incl. Pro) from the terminal by driving the real Chrome browser. ZCode/Codex skill + Python harness.","archived":false,"fork":false,"pushed_at":"2026-06-24T00:29:33.000Z","size":109,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-24T02:05:36.199Z","etag":null,"topics":["automation","chatgpt","chatgpt-pro","claude-code","codex","gpt-5","macos","playwright","skill","zcode"],"latest_commit_sha":null,"homepage":"https://github.com/yxhpy/chatgpt-pro-browser","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/yxhpy.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-06-23T12:56:21.000Z","updated_at":"2026-06-24T01:24:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/yxhpy/chatgpt-pro-browser","commit_stats":null,"previous_names":["yxhpy/chatgpt-pro-browser"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/yxhpy/chatgpt-pro-browser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yxhpy%2Fchatgpt-pro-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yxhpy%2Fchatgpt-pro-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yxhpy%2Fchatgpt-pro-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yxhpy%2Fchatgpt-pro-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yxhpy","download_url":"https://codeload.github.com/yxhpy/chatgpt-pro-browser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yxhpy%2Fchatgpt-pro-browser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35787351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-23T02:00:06.683Z","response_time":57,"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":["automation","chatgpt","chatgpt-pro","claude-code","codex","gpt-5","macos","playwright","skill","zcode"],"created_at":"2026-07-23T04:01:13.793Z","updated_at":"2026-07-23T04:01:14.450Z","avatar_url":"https://github.com/yxhpy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chatgpt-pro-browser\n\n\u003e Use your **already-logged-in ChatGPT (incl. Pro)** from the terminal by driving the real Chrome browser — call it, upload files, and generate executable plans.\n\n[![tests](https://img.shields.io/badge/tests-20%2F20%20pass-brightgreen)](TEST_REPORT.md)\n[![platform](https://img.shields.io/badge/platform-macOS-lightgrey)](#prerequisites)\n[![python](https://img.shields.io/badge/python-3.10%2B-blue)](requirements.txt)\n\nThis is a ZCode/Codex **plugin** (two skills) plus a reusable Python **harness** that lets you call ChatGPT (especially **GPT-5 Pro / GPT-5.5 Pro**) from scripts, automation, or other agents — by operating the actual chatgpt.com web UI with your own logged-in session.\n\nIt is **not** a reverse-engineered API. Raw HTTP/cookie access to ChatGPT is blocked by Cloudflare (`cf-mitigated: challenge`, confirmed 403). This project decrypts Chrome's login cookies and injects them into a Playwright-controlled **real** Chrome, then drives the UI like a human would.\n\n## Two skills\n\n| Skill | What it does |\n|---|---|\n| **chatgpt-pro-browser** | Call ChatGPT Pro from code: send prompts, upload files, multi-turn. The reusable `lib/harness.py`. |\n| **chatgpt-pro-planner** | Generate executable engineering plans (dev / test / refactor / bugfix) via Pro's reasoning, in the **superpowers markdown format** that Codex, Claude Code, and `executing-plans` / `subagent-driven-development` consume directly. |\n\n## What works (verified, 20/20 tests passing)\n\n| Capability | Status |\n|---|---|\n| Login reuse (Pro/Plus/Free) | ✅ |\n| Single prompt → text reply | ✅ |\n| File uploads: PNG, JPG, PDF, CSV, TXT, JSON, PY, MD, DOCX, XLSX | ✅ |\n| Multi-file uploads (3-5 files, mixed types) | ✅ |\n| Cross-file reasoning | ✅ |\n| Big inputs (132 KB file, 14 KB pasted prompt) | ✅ |\n| Long outputs (2000+ words) | ✅ |\n| Deep reasoning (GPT-5 Pro) | ✅ |\n| Multi-turn conversation state | ✅ |\n| **Resume after disconnect** (server keeps generating) | ✅ |\n| **Multi-line/large prompts** (paste mode, no Enter-submits-early) | ✅ |\n\nSee [TEST_REPORT.md](TEST_REPORT.md) for the full matrix.\n\n## Prerequisites\n\n- **macOS** (uses the Keychain + Chrome's on-disk cookies).\n- **Google Chrome** installed and used to log into [chatgpt.com](https://chatgpt.com) at least once.\n- **Python 3.10+** with `playwright` and `cryptography`.\n- A ChatGPT **Pro** subscription (for Pro models; the harness also works on Plus/Free with `--no-pro`).\n\n## Install\n\n### Option A: one-line (symlinks both skills into `~/.agents/skills/`)\n\n```bash\nbash \u003c(curl -fsSL https://raw.githubusercontent.com/yxhpy/chatgpt-pro-browser/main/install.sh)\n```\n\n### Option B: clone + install\n\n```bash\ngit clone https://github.com/yxhpy/chatgpt-pro-browser.git\ncd chatgpt-pro-browser\nbash install.sh           # or: bash install.sh --copy for a frozen snapshot\n```\n\n### Option C: as a plugin (zcode / codex)\n\nThis repo ships `.zcode-plugin/plugin.json` and `.codex-plugin/plugin.json`, so it can be added as a plugin:\n\n```bash\n# ZCode\nzcode plugin marketplace add yxhpy/chatgpt-pro-browser --ref main\nzcode plugin add chatgpt-pro-browser\n\n# Codex\ncodex plugin marketplace add yxhpy/chatgpt-pro-browser --ref main\ncodex plugin add chatgpt-pro-browser\n```\n\nThe first time you use it, macOS shows a Keychain dialog for **\"Chrome Safe Storage\"** — click **Allow** (one-time).\n\n## Quick start\n\n### Call ChatGPT Pro from the CLI\n\n```bash\npython3 skills/chatgpt-pro-browser/scripts/ask.py \"Write a haiku about SSH keys.\"\n\n# attach files\npython3 skills/chatgpt-pro-browser/scripts/ask.py \"Summarize this.\" -f report.pdf -f data.csv\n\n# multi-line/large prompts use paste mode by default (newline-safe)\n```\n\n### Generate an executable plan via Pro\n\n```bash\n# dev plan (TDD tasks, ready for executing-plans / subagent-driven-development)\npython3 skills/chatgpt-pro-planner/scripts/plan.py dev \"Add streaming to the harness\" --context lib/harness.py\n\n# test / refactor / bugfix plans\npython3 skills/chatgpt-pro-planner/scripts/plan.py test \"Cover the cookie path\" --context lib/harness.py\npython3 skills/chatgpt-pro-planner/scripts/plan.py refactor \"Extract cookie logic into cookies.py\"\npython3 skills/chatgpt-pro-planner/scripts/plan.py bugfix \"Upload hangs when send stays disabled\" --context lib/harness.py\n```\n\nPlans are saved to `docs/superpowers/plans/YYYY-MM-DD-\u003cfeature\u003e-\u003ctype\u003e.md` and validated with:\n\n```bash\npython3 skills/chatgpt-pro-planner/scripts/validate_plan.py \u003cplan.md\u003e\n```\n\n### From Python\n\n```python\nimport asyncio\nfrom lib.harness import ChatGPTSession\n\nasync def main():\n    async with ChatGPTSession(headless=False) as s:\n        await s.ensure_pro()\n        r = await s.ask(\"What model are you?\")\n        print(r.text)            # the reply\n        print(r.completed)       # True if finished in-session\n        print(r.chat_url)        # https://chatgpt.com/c/\u003cid\u003e — for resume\n\n        # upload + ask\n        r = await s.ask(\"Summarize this PDF.\", attachments=[\"report.pdf\"])\n\n        # multi-turn (same session keeps context)\n        await s.ask(\"Now translate that to Chinese.\")\n\nasyncio.run(main())\n```\n\n### Resume after a long task (resume-safe)\n\nChatGPT keeps generating **server-side** after the browser disconnects (verified: a 300-word reply that was empty in-session came back complete at 2097 chars after a reconnect). So a timed-out `ask()` is never lost:\n\n```python\nr = await s.ask(\"Write a 2000-word essay...\", timeout=120)\nif not r.completed:\n    # server is still generating — reconnect and read the full reply\n    r = await s.resume(r.chat_url, timeout=300)\nprint(r.text)\n```\n\n`resume()` works even in a **fresh** `ChatGPTSession` — the chat is identified by URL, not browser state.\n\n## How it works\n\n```\n            macOS Keychain\n       ┌──────────────────────┐\n       │ \"Chrome Safe Storage\" │── PBKDF2-SHA1(saltysalt, 1003) ──► AES-128 key\n       └──────────┬───────────┘\n                  │\n   ~/.../Chrome/  │\n   Default/       ▼\n   Cookies.sqlite ──► decrypt v10 cookie blobs → session-token, _puid, cf_clearance…\n                  │\n                  ▼\n        Playwright ── channel=\"chrome\"  (REAL Chrome — Cloudflare-safe)\n        new_context ── ctx.add_cookies([...])\n                  │\n                  ▼\n        page.goto(\"chatgpt.com/\")  ── logged in (Pro), no CF challenge\n                  │\n                  ▼\n        div.ProseMirror → execCommand insertText (paste mode, newline-safe)\n                       → click send button → poll until stop-button vanishes\n                  │\n                  ▼\n        read assistant reply  (or resume(chat_url) later if it timed out)\n```\n\nKey technical points (full detail in [skills/chatgpt-pro-browser/references/pitfalls.md](skills/chatgpt-pro-browser/references/pitfalls.md)):\n\n1. **Decrypt + inject, don't clone the profile** — Chrome 136+ integrity-checks v10 cookies; a cloned profile silently drops `session-token`.\n2. **Real Chrome, not bundled Chromium** — `cf_clearance` is TLS/JA3-fingerprint bound.\n3. **Paste mode for input** — `execCommand('insertText')` handles multi-line/large prompts without Enter submitting early. (`keyboard.type()` is the legacy fallback.)\n4. **Send-button click to submit** — immune to multi-line content; waits for the button to re-enable after uploads (binary files need server-side parse).\n5. **Resume-safe** — `ask()` captures the `/c/\u003cid\u003e` URL; on timeout, `resume()` reopens it. Server generation is independent of the browser.\n\n## Repo layout\n\n```\nchatgpt-pro-browser/\n├── .zcode-plugin/plugin.json          # ZCode plugin manifest\n├── .codex-plugin/plugin.json          # Codex plugin manifest\n├── skills/\n│   ├── chatgpt-pro-browser/           # call ChatGPT Pro\n│   │   ├── SKILL.md\n│   │   ├── references/ (api.md, pitfalls.md, http-bridge.md)\n│   │   └── scripts/ (ask.py, prereq_check.sh)\n│   └── chatgpt-pro-planner/           # generate executable plans via Pro\n│       ├── SKILL.md\n│       ├── references/ (output-contract.md, {dev,test,refactor,bugfix}-template.md)\n│       └── scripts/ (plan.py, validate_plan.py)\n├── lib/harness.py                     # reusable driver (decrypt → inject → drive → resume)\n├── fixtures/ + run_suite.py           # 20/20 test suite\n├── install.sh                         # one-line installer (both skills)\n└── TEST_REPORT.md\n```\n\n## Performance\n\n| Task | Typical |\n|---|---|\n| Simple prompt | 12-25 s |\n| File read (txt/json/code) | 13-20 s |\n| Binary file (pdf/docx/xlsx) | 18-55 s |\n| Plan generation (single round) | 60-180 s |\n| Long output (2000+ words) | ~240 s |\n| Deep reasoning (GPT-5 Pro) | 30-120 s |\n\nLong tasks may exceed a single `ask()` budget — that's exactly what `resume()` is for.\n\n## Privacy \u0026 safety\n\n- Cookies are decrypted **in-process only**, never written to disk or logged.\n- The harness binds to your local machine; it does not exfiltrate credentials.\n- Driving the ChatGPT web UI is against OpenAI's Terms of Service. Personal/research use.\n- Bind any HTTP bridge to `127.0.0.1` only.\n\n## Troubleshooting\n\n| Symptom | Fix |\n|---|---|\n| Keychain dialog denied | Re-run, click **Allow** |\n| \"missing auth cookies\" | Log into chatgpt.com in Chrome, retry |\n| \"Login wall detected\" | Reload failed too — re-login in Chrome |\n| Cloudflare challenge page | Wait 5-10 s; if persistent, re-login |\n| Empty reply / `completed=False` | Call `resume(chat_url)` — server still generating |\n| Wrong context bleeds in | Call `s.new_chat()` between independent tasks |\n\nRun `bash skills/chatgpt-pro-browser/scripts/prereq_check.sh` to diagnose environment issues.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyxhpy%2Fchatgpt-pro-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyxhpy%2Fchatgpt-pro-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyxhpy%2Fchatgpt-pro-browser/lists"}