gpt2agent 0.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gpt2agent-0.0.5/LICENSE +21 -0
- gpt2agent-0.0.5/NOTICES.md +52 -0
- gpt2agent-0.0.5/PKG-INFO +334 -0
- gpt2agent-0.0.5/README.md +308 -0
- gpt2agent-0.0.5/gpt2agent/__init__.py +0 -0
- gpt2agent-0.0.5/gpt2agent/_log_redact.py +67 -0
- gpt2agent-0.0.5/gpt2agent/_vendored/__init__.py +2 -0
- gpt2agent-0.0.5/gpt2agent/_vendored/pow.py +467 -0
- gpt2agent-0.0.5/gpt2agent/_vendored/turnstile.py +265 -0
- gpt2agent-0.0.5/gpt2agent/auth.py +162 -0
- gpt2agent-0.0.5/gpt2agent/backend.py +205 -0
- gpt2agent-0.0.5/gpt2agent/install.py +442 -0
- gpt2agent-0.0.5/gpt2agent/sentinel.py +78 -0
- gpt2agent-0.0.5/gpt2agent/server.py +388 -0
- gpt2agent-0.0.5/gpt2agent/setup.py +302 -0
- gpt2agent-0.0.5/gpt2agent/skills/deep-research/SKILL.md +165 -0
- gpt2agent-0.0.5/gpt2agent/skills/deep-research/bin/deep_research.py +180 -0
- gpt2agent-0.0.5/gpt2agent/skills/deep-research/bin/quota.sh +29 -0
- gpt2agent-0.0.5/gpt2agent/skills/deep-research/bin/run.sh +24 -0
- gpt2agent-0.0.5/gpt2agent/skills/gpt2agent/SKILL.md +172 -0
- gpt2agent-0.0.5/gpt2agent/skills/gpt2agent/tools-reference.md +670 -0
- gpt2agent-0.0.5/gpt2agent/sse.py +1645 -0
- gpt2agent-0.0.5/gpt2agent/tools/__init__.py +29 -0
- gpt2agent-0.0.5/gpt2agent/tools/_redact.py +9 -0
- gpt2agent-0.0.5/gpt2agent/tools/account.py +50 -0
- gpt2agent-0.0.5/gpt2agent/tools/apps.py +31 -0
- gpt2agent-0.0.5/gpt2agent/tools/codex.py +48 -0
- gpt2agent-0.0.5/gpt2agent/tools/conversations.py +109 -0
- gpt2agent-0.0.5/gpt2agent/tools/gpts.py +21 -0
- gpt2agent-0.0.5/gpt2agent/tools/images.py +86 -0
- gpt2agent-0.0.5/gpt2agent/tools/instructions.py +21 -0
- gpt2agent-0.0.5/gpt2agent/tools/memory.py +38 -0
- gpt2agent-0.0.5/gpt2agent/tools/tools_features.py +60 -0
- gpt2agent-0.0.5/gpt2agent/tools/writes.py +91 -0
- gpt2agent-0.0.5/gpt2agent.egg-info/PKG-INFO +334 -0
- gpt2agent-0.0.5/gpt2agent.egg-info/SOURCES.txt +50 -0
- gpt2agent-0.0.5/gpt2agent.egg-info/dependency_links.txt +1 -0
- gpt2agent-0.0.5/gpt2agent.egg-info/entry_points.txt +2 -0
- gpt2agent-0.0.5/gpt2agent.egg-info/requires.txt +10 -0
- gpt2agent-0.0.5/gpt2agent.egg-info/top_level.txt +1 -0
- gpt2agent-0.0.5/pyproject.toml +50 -0
- gpt2agent-0.0.5/setup.cfg +4 -0
- gpt2agent-0.0.5/tests/test_backend_token.py +105 -0
- gpt2agent-0.0.5/tests/test_backend_tools.py +36 -0
- gpt2agent-0.0.5/tests/test_deep_research.py +111 -0
- gpt2agent-0.0.5/tests/test_dr_clarification.py +242 -0
- gpt2agent-0.0.5/tests/test_heavy_dr_parser.py +553 -0
- gpt2agent-0.0.5/tests/test_install.py +335 -0
- gpt2agent-0.0.5/tests/test_security_hardening.py +185 -0
- gpt2agent-0.0.5/tests/test_sse.py +128 -0
- gpt2agent-0.0.5/tests/test_sse_parser.py +139 -0
- gpt2agent-0.0.5/tests/test_writes.py +121 -0
gpt2agent-0.0.5/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 robotlearning123
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
This project includes portions of code from:
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## lanqian528/chat2api
|
|
8
|
+
|
|
9
|
+
- **License:** MIT License
|
|
10
|
+
- **Copyright:** Copyright (c) 2024 aurora-develop
|
|
11
|
+
- **Source:** https://github.com/lanqian528/chat2api
|
|
12
|
+
- **Files derived from upstream:**
|
|
13
|
+
- `gpt2agent/_vendored/pow.py` — ported from `chatgpt/proofofWork.py`
|
|
14
|
+
- `gpt2agent/_vendored/turnstile.py` — ported from `chatgpt/turnstile.py`
|
|
15
|
+
|
|
16
|
+
**Modifications:** removed `diskcache`, `pybase64`, `ua_generator`, and `utils.*`
|
|
17
|
+
dependencies in favor of the Python standard library; reduced to the minimum
|
|
18
|
+
surface needed to produce Sentinel `proof` and `turnstile` tokens.
|
|
19
|
+
|
|
20
|
+
### Full MIT License Text (lanqian528/chat2api)
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
MIT License
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2024 aurora-develop
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
NOTE ON LICENSING: Portions of this project (vendored solver code in
|
|
49
|
+
`gpt2agent/_vendored/`) are under the MIT License as reproduced above.
|
|
50
|
+
The rest of the project is under the terms in `LICENSE`. Downstream users
|
|
51
|
+
of the vendored files may continue to use them under MIT regardless of any
|
|
52
|
+
additional restrictions the containing project imposes on its original code.
|
gpt2agent-0.0.5/PKG-INFO
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gpt2agent
|
|
3
|
+
Version: 0.0.5
|
|
4
|
+
Summary: Use your ChatGPT Plus/Pro in Claude Code and other AI agents — one command setup
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/robotlearning123/gpt2agent
|
|
7
|
+
Project-URL: Repository, https://github.com/robotlearning123/gpt2agent
|
|
8
|
+
Project-URL: Changelog, https://github.com/robotlearning123/gpt2agent/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/robotlearning123/gpt2agent/issues
|
|
10
|
+
Keywords: mcp,chatgpt,claude,openai,agent,llm
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
License-File: NOTICES.md
|
|
18
|
+
Requires-Dist: mcp>=1.26.0
|
|
19
|
+
Requires-Dist: uvicorn>=0.30.0
|
|
20
|
+
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
|
|
21
|
+
Requires-Dist: curl_cffi>=0.11.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# gpt2agent
|
|
28
|
+
|
|
29
|
+
> **Your `codex login` → full ChatGPT Plus/Pro account inside any MCP client.**
|
|
30
|
+
|
|
31
|
+
Use your **ChatGPT Plus or Pro** subscription — every model, every account-tier
|
|
32
|
+
feature — inside Claude Code, Codex, and any MCP client.
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/gpt2agent/)
|
|
35
|
+
[](./LICENSE)
|
|
36
|
+
[](https://pypi.org/project/gpt2agent/)
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## What it does
|
|
41
|
+
|
|
42
|
+
gpt2agent exposes **25 MCP tools** that forward requests directly to ChatGPT's backend API.
|
|
43
|
+
No proxy process. No separate account. No platform API key. Your `codex login`,
|
|
44
|
+
your token, your quota.
|
|
45
|
+
|
|
46
|
+
If you already have the [`codex`](https://github.com/openai/codex) CLI logged in,
|
|
47
|
+
setup is **zero extra steps** — gpt2agent reuses the same `~/.codex/auth.json`
|
|
48
|
+
bearer and picks up its background-refreshed token automatically.
|
|
49
|
+
|
|
50
|
+
Works with Claude Code, Codex CLI, and any client that speaks the MCP protocol over stdio.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Install — one line
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
curl -fsSL https://raw.githubusercontent.com/robotlearning123/gpt2agent/main/install.sh | bash
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
That command:
|
|
61
|
+
1. Installs `gpt2agent` via pipx (creates an isolated env).
|
|
62
|
+
2. Reuses your existing `~/.codex/auth.json` if you've run `codex login` — no separate ChatGPT token paste needed.
|
|
63
|
+
3. Detects which MCP clients you have (Claude Code, Codex) and writes the right config snippet for each.
|
|
64
|
+
4. Drops the `deep-research` Claude Code skill into `~/.claude/skills/`.
|
|
65
|
+
|
|
66
|
+
### Or step-by-step
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# 1. Install the package globally (isolated venv)
|
|
70
|
+
pipx install gpt2agent
|
|
71
|
+
|
|
72
|
+
# 2. Register with all detected MCP clients (Claude Code, Codex)
|
|
73
|
+
gpt2agent install # auto-detect everything
|
|
74
|
+
|
|
75
|
+
# Want only one client?
|
|
76
|
+
gpt2agent install --client claude-code
|
|
77
|
+
gpt2agent install --client codex
|
|
78
|
+
|
|
79
|
+
# HTTP transport instead of stdio?
|
|
80
|
+
gpt2agent install --transport http --http-port 9000
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Per-client config
|
|
84
|
+
|
|
85
|
+
The `install` subcommand writes the right thing for each:
|
|
86
|
+
|
|
87
|
+
| Client | File | Section |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| **Claude Code** | `~/.claude.json` | `mcpServers.gpt2agent` (stdio: `gpt2agent run --stdio`) |
|
|
90
|
+
| **Codex CLI** | `~/.codex/config.toml` | `[mcp_servers.gpt2agent]` |
|
|
91
|
+
|
|
92
|
+
Both are idempotent and back up the prior file as `<name>.bak-gpt2agent`.
|
|
93
|
+
|
|
94
|
+
After running `install`, restart Claude Code so it re-spawns the subprocess.
|
|
95
|
+
Codex picks up the new server on its next invocation automatically.
|
|
96
|
+
|
|
97
|
+
### Manual config (if you'd rather not run install)
|
|
98
|
+
|
|
99
|
+
Claude Code — add to `~/.claude.json`:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"mcpServers": {
|
|
104
|
+
"gpt2agent": {
|
|
105
|
+
"type": "stdio",
|
|
106
|
+
"command": "gpt2agent",
|
|
107
|
+
"args": ["run", "--stdio"]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Codex CLI — add to `~/.codex/config.toml`:
|
|
114
|
+
|
|
115
|
+
```toml
|
|
116
|
+
[mcp_servers.gpt2agent]
|
|
117
|
+
command = "gpt2agent"
|
|
118
|
+
args = ["run", "--stdio"]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Setup (manual token paste — only if codex isn't available)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
gpt2agent setup
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Prompts for a ChatGPT session token and saves it to `~/.gpt2agent/token.json`.
|
|
130
|
+
The `codex login` flow is preferred when available because codex auto-refreshes
|
|
131
|
+
its token; gpt2agent reloads `~/.codex/auth.json` on mtime change so long
|
|
132
|
+
calls don't 401 mid-flight.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Tools (25)
|
|
137
|
+
|
|
138
|
+
### Chat & reasoning
|
|
139
|
+
|
|
140
|
+
| Tool | What it does |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `chat` | Talk to any model on your account (`gpt-5-3` default, override via `model=`). Pass `gpt-5-5-pro`, `o3-pro`, `gpt-5-4-thinking`, … |
|
|
143
|
+
| `agent` | **Agent Mode** — 262K context with autonomous browsing, code execution, tool use |
|
|
144
|
+
| `deep_research` | Web-augmented research with citations (~30–120 s). Auto-confirms by default |
|
|
145
|
+
| `deep_research_heavy` | Long-form DR via `gpt-5-5-pro` + connector (5–30 min, monthly quota). Configurable via `[models].heavy_dr` |
|
|
146
|
+
| `gpt_chat` | Talk through one of your private Custom GPTs (`g-p-*`) — *experimental* |
|
|
147
|
+
|
|
148
|
+
### Image & file management
|
|
149
|
+
|
|
150
|
+
| Tool | What it does |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `generate_image` | Generate images via ChatGPT's built-in DALL-E. Returns download URLs + metadata |
|
|
153
|
+
| `get_file_info` | Metadata for any ChatGPT file (images, uploads) |
|
|
154
|
+
| `get_file_download_url` | Temporary download URL for a ChatGPT file (~1h expiry) |
|
|
155
|
+
|
|
156
|
+
### Code execution
|
|
157
|
+
|
|
158
|
+
| Tool | What it does |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `code_interpreter` | Run Python in ChatGPT's sandbox. Returns output + any generated charts/images |
|
|
161
|
+
| `canvas_execute` | Execute code via ChatGPT's Canvas feature (live editing environment) |
|
|
162
|
+
|
|
163
|
+
### Account introspection
|
|
164
|
+
|
|
165
|
+
| Tool | What it does |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `account_status` | Plan, country, MFA, feature count, subscription expiry |
|
|
168
|
+
| `list_models` | All models on your account (slug, max_tokens, reasoning_type, capabilities, enabled_tools) |
|
|
169
|
+
| `list_conversations` | Recent ChatGPT conversations (titles: emails/phones redacted) |
|
|
170
|
+
| `get_conversation` | Full message history for a specific conversation (multimodal, code, images) |
|
|
171
|
+
| `list_tasks` | Scheduled / completed ChatGPT tasks |
|
|
172
|
+
| `list_apps` | Connected apps + connectors |
|
|
173
|
+
| `list_custom_gpts` | Your private `g-p-*` GPTs |
|
|
174
|
+
|
|
175
|
+
### Memory & instructions
|
|
176
|
+
|
|
177
|
+
| Tool | What it does |
|
|
178
|
+
|---|---|
|
|
179
|
+
| `memory_list` | List all ChatGPT memory entries (emails/phones redacted) |
|
|
180
|
+
| `memory_search` | Keyword filter over memories |
|
|
181
|
+
| `memory_create_via_chat` | Add a memory (model-initiated workaround — POST `/memories` is 405) |
|
|
182
|
+
| `custom_instructions_get` | Read your current `about_user` / `about_model` |
|
|
183
|
+
| `custom_instructions_set` | Update them (read-modify-write, preserves unspecified fields) |
|
|
184
|
+
|
|
185
|
+
### Codex (cloud agent)
|
|
186
|
+
|
|
187
|
+
| Tool | What it does |
|
|
188
|
+
|---|---|
|
|
189
|
+
| `list_codex_envs` | Codex environments (label, repos, network policy) |
|
|
190
|
+
| `list_codex_tasks` | Recent Codex tasks + status |
|
|
191
|
+
| `codex_task_create` | Kick off a new Codex task (resolves env from `repo_label`) |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Architecture
|
|
196
|
+
|
|
197
|
+
Native Python implementation — no proxy. The server calls
|
|
198
|
+
`/backend-api/conversation` (SSE) directly using `curl_cffi` for TLS
|
|
199
|
+
impersonation. Vendored POW and Turnstile solvers handle the OpenAI Sentinel
|
|
200
|
+
challenge. Token is reloaded from disk on each request, so codex's background
|
|
201
|
+
refresh propagates transparently. See [NOTICES](./NOTICES.md) for attribution.
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
~/.codex/auth.json (or ~/.gpt2agent/token.json) ← auto-refreshed by codex
|
|
205
|
+
|
|
|
206
|
+
gpt2agent (stdio MCP server, token reloaded on each call)
|
|
207
|
+
|
|
|
208
|
+
curl_cffi → chatgpt.com /backend-api/{conversation,f/conversation,me,
|
|
209
|
+
models, memories, codex, gizmos, ...}
|
|
210
|
+
|
|
|
211
|
+
25 MCP tools (chat, agent, DR ×2, GPT chat, image gen,
|
|
212
|
+
code interpreter, canvas, memory r/w,
|
|
213
|
+
instructions r/w, codex r/w, account introspect)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Configuration
|
|
219
|
+
|
|
220
|
+
Optional `~/.gpt2agent/config.toml` or `./config.toml`:
|
|
221
|
+
|
|
222
|
+
```toml
|
|
223
|
+
[server]
|
|
224
|
+
host = "127.0.0.1" # loopback only; the HTTP transport is UNAUTHENTICATED
|
|
225
|
+
port = 9000
|
|
226
|
+
|
|
227
|
+
[models]
|
|
228
|
+
chat = "gpt-5-3" # default for chat tool
|
|
229
|
+
agent = "agent-mode" # default for agent tool
|
|
230
|
+
heavy_dr = "gpt-5-5-pro" # override slug for deep_research_heavy
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Limitations
|
|
236
|
+
|
|
237
|
+
- **Deep Research quota:** roughly ~248 heavy requests / monthly cycle on Pro,
|
|
238
|
+
lower on Plus — approximate and account/region-dependent, not a guaranteed number.
|
|
239
|
+
- **Account-tier features not yet supported:** Sora video, Operator/CUA, voice
|
|
240
|
+
sessions. These use HTTP endpoints that return 404 or haven't yet been
|
|
241
|
+
reverse-engineered out of the chatgpt.com web bundle.
|
|
242
|
+
- **`gpt_chat`** is experimental — `gizmo_id` payload field verified against
|
|
243
|
+
web traffic but not load-tested across all g-p-* types.
|
|
244
|
+
- Requires an active ChatGPT Plus or Pro subscription.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Security & risk — read before you run this
|
|
249
|
+
|
|
250
|
+
gpt2agent talks to ChatGPT's **private** backend the way the web app does. That
|
|
251
|
+
has real consequences; please understand them before pointing it at your account.
|
|
252
|
+
|
|
253
|
+
- **It impersonates the chatgpt.com web client.** It uses `curl_cffi` TLS
|
|
254
|
+
fingerprint impersonation and vendored Proof-of-Work + Cloudflare Turnstile
|
|
255
|
+
solvers to pass the OpenAI Sentinel challenge. This is **very likely against
|
|
256
|
+
the OpenAI Terms of Service**, and automated/abnormal traffic can get your
|
|
257
|
+
account **rate-limited, challenged, suspended, or banned**. Use an account you
|
|
258
|
+
can afford to lose, keep volume human-scale, and don't rely on it for anything
|
|
259
|
+
critical. This is a reverse-engineering / research tool, not an official API.
|
|
260
|
+
- **The HTTP transport is UNAUTHENTICATED.** It proxies your *entire* account —
|
|
261
|
+
read all conversations, spend Deep Research quota, overwrite custom
|
|
262
|
+
instructions, launch Codex cloud tasks. Anyone who can reach the port controls
|
|
263
|
+
your account. Therefore:
|
|
264
|
+
- **Use stdio** (the default for `gpt2agent install`) for local clients like
|
|
265
|
+
Claude Code and Codex. It is not network-exposed.
|
|
266
|
+
- The server **binds `127.0.0.1` by default** and **refuses** to start the HTTP
|
|
267
|
+
transport on a non-loopback host unless you explicitly set
|
|
268
|
+
`GPT2AGENT_ALLOW_REMOTE=1`. Only do that behind your own auth proxy / firewall.
|
|
269
|
+
- **Your token stays local.** It is read from `~/.codex/auth.json` (or
|
|
270
|
+
`~/.gpt2agent/token.json`, chmod `600`) and sent only to `chatgpt.com`.
|
|
271
|
+
gpt2agent never transmits it anywhere else. Token/secret values are redacted
|
|
272
|
+
from error messages and logs (best-effort).
|
|
273
|
+
- **PII redaction is limited.** Tools that return conversation/memory data strip
|
|
274
|
+
only **emails and phone numbers** from text — names, addresses, IDs, and the
|
|
275
|
+
full message bodies of `get_conversation` are returned verbatim. Don't treat
|
|
276
|
+
the output as anonymized.
|
|
277
|
+
- **`GPT2AGENT_RAW_DUMP`** (debug) writes raw, unredacted SSE/poll traffic —
|
|
278
|
+
including prompts, responses, and resume tokens — to the path you give it.
|
|
279
|
+
Use only for debugging and delete the dumps after.
|
|
280
|
+
|
|
281
|
+
Found a security issue? See [SECURITY.md](./SECURITY.md).
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Development
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
python -m venv .venv
|
|
289
|
+
source .venv/bin/activate
|
|
290
|
+
pip install -e ".[dev]"
|
|
291
|
+
pytest
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Release
|
|
295
|
+
|
|
296
|
+
Tagged releases are configured to publish to PyPI and create a GitHub Release
|
|
297
|
+
with the matching CHANGELOG section:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# bump version
|
|
301
|
+
$EDITOR pyproject.toml # e.g. "0.0.3" → "0.0.4"
|
|
302
|
+
$EDITOR CHANGELOG.md # add ## [0.0.4] - YYYY-MM-DD ...
|
|
303
|
+
git commit -am "release: 0.0.4"
|
|
304
|
+
git tag v0.0.4
|
|
305
|
+
git push origin main --tags # release workflow fires on the tag
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
The release workflow (`.github/workflows/release.yml`) verifies the tag
|
|
309
|
+
matches `pyproject.toml`, runs the test matrix, builds wheel + sdist, publishes
|
|
310
|
+
to PyPI via OIDC trusted publishing, and posts a GitHub Release with that
|
|
311
|
+
version's CHANGELOG body.
|
|
312
|
+
|
|
313
|
+
> **One-time PyPI setup required before the first publish succeeds.** PyPI's
|
|
314
|
+
> OIDC exchange needs a Trusted Publisher registered for this repo (project
|
|
315
|
+
> `gpt2agent`, owner `robotlearning123`, workflow `release.yml`, environment
|
|
316
|
+
> `pypi`) at
|
|
317
|
+
> [pypi.org → Publishing](https://pypi.org/manage/account/publishing/) — or a
|
|
318
|
+
> first manual `twine upload` to create the project. Until that is done the
|
|
319
|
+
> release job fails with `invalid-publisher` and the package is not on PyPI;
|
|
320
|
+
> the `install.sh` one-liner falls back to a `git+https` install in the meantime.
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## License
|
|
325
|
+
|
|
326
|
+
[MIT](./LICENSE). See [NOTICES](./NOTICES.md) for third-party attributions.
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Acknowledgments
|
|
331
|
+
|
|
332
|
+
- [lanqian528/chat2api](https://github.com/lanqian528/chat2api) — POW and Turnstile solver code (MIT)
|
|
333
|
+
- [basketikun/chatgpt2api](https://github.com/basketikun/chatgpt2api) — survey of ChatGPT backend API patterns
|
|
334
|
+
- [7836246/cursor2api](https://github.com/7836246/cursor2api) — survey of Cursor API patterns
|