-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathChatGPT-Tools.postman_collection.json
More file actions
477 lines (477 loc) · 20.1 KB
/
ChatGPT-Tools.postman_collection.json
File metadata and controls
477 lines (477 loc) · 20.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
{
"info": {
"name": "ChatGPT-Tools API",
"_postman_id": "chatgpt-tools-collection",
"description": "ChatGPT proxy — OpenAI-compatible endpoints powered by ChatGPT via Electron DOM relay.\n\n**Features:**\n- OpenAI-compatible `/v1/chat/completions` (non-streaming & real SSE streaming)\n- SQLite conversation tracking with auto-match for Cline/Void\n- Simple `/api/chat` endpoint for direct usage\n- 3 conversation modes: explicit ID, auto-match from history, new\n- Debug endpoints for token inspection, window control, and latency tracking\n\n**Default:** http://localhost:9999 (configurable via PORT env var)",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"variable": [
{
"key": "base_url",
"value": "http://localhost:9999"
},
{
"key": "conversation_id",
"value": ""
}
],
"item": [
{
"name": "Health & Info",
"description": "Service health, model listing, and conversation management endpoints.",
"item": [
{
"name": "GET /v1/index - Service info",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/v1/index",
"host": ["{{base_url}}"],
"path": ["v1", "index"]
},
"description": "Returns service status and list of available endpoints."
}
},
{
"name": "GET /v1/models - List models",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/v1/models",
"host": ["{{base_url}}"],
"path": ["v1", "models"]
},
"description": "OpenAI-compatible model listing. Returns available ChatGPT models (e.g. `gpt-4o`, `gpt-4o-mini`)."
}
},
{
"name": "GET /v1/conversations - List conversations",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/v1/conversations?limit=50",
"host": ["{{base_url}}"],
"path": ["v1", "conversations"],
"query": [
{
"key": "limit",
"value": "50",
"description": "Max conversations to return (1-200, default 50)"
}
]
},
"description": "List stored conversations from SQLite, ordered by most recently updated. Includes first user message preview."
}
},
{
"name": "DELETE /v1/conversations/:id - Delete conversation",
"request": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{base_url}}/v1/conversations/{{conversation_id}}",
"host": ["{{base_url}}"],
"path": ["v1", "conversations", "{{conversation_id}}"]
},
"description": "Delete a conversation and all its messages from SQLite."
}
}
]
},
{
"name": "Simple Chat",
"description": "Direct chat endpoint — simpler alternative to the OpenAI-compatible API. Returns a plain text reply with a conversation_id for continuation.",
"item": [
{
"name": "POST /api/chat - New conversation",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var json = pm.response.json();",
"if (json.conversation_id) {",
" pm.collectionVariables.set('conversation_id', json.conversation_id);",
" console.log('Saved conversation_id:', json.conversation_id);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"message\": \"What is 2 + 2?\"\n}"
},
"url": {
"raw": "{{base_url}}/api/chat",
"host": ["{{base_url}}"],
"path": ["api", "chat"]
},
"description": "Start a new ChatGPT conversation.\n\n**Body:**\n- `message` (required): The user message\n\n**Response:**\n```json\n{\n \"success\": true,\n \"message\": \"4\",\n \"conversation_id\": \"conv_...\"\n}\n```\n\nThe `conversation_id` is saved to the collection variable automatically."
}
},
{
"name": "POST /api/chat - Continue conversation",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var json = pm.response.json();",
"if (json.conversation_id) {",
" pm.collectionVariables.set('conversation_id', json.conversation_id);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"message\": \"What did I just ask you?\",\n \"conversation_id\": \"{{conversation_id}}\"\n}"
},
"url": {
"raw": "{{base_url}}/api/chat",
"host": ["{{base_url}}"],
"path": ["api", "chat"]
},
"description": "Continue an existing ChatGPT conversation.\n\n**Body:**\n- `message` (required): The user message\n- `conversation_id` (optional): From a previous `/api/chat` response. Omit to start a new conversation."
}
}
]
},
{
"name": "OpenAI Compatible",
"description": "OpenAI-compatible `/v1/chat/completions` endpoint. Works with Cline, Void, and any OpenAI-compatible client.\n\n**Conversation modes:**\n1. `conversation_id` provided → continue that conversation\n2. No ID but messages match stored history → auto-continue (Cline/Void auto-match)\n3. Completely new → start fresh conversation\n\n**Streaming:** Set `stream: true` for real SSE streaming. Tokens appear progressively as ChatGPT generates them.",
"item": [
{
"name": "POST /v1/chat/completions - New (non-streaming)",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var json = pm.response.json();",
"if (json.conversation_id) {",
" pm.collectionVariables.set('conversation_id', json.conversation_id);",
" console.log('Saved conversation_id:', json.conversation_id);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"What is the capital of France?\"\n }\n ]\n}"
},
"url": {
"raw": "{{base_url}}/v1/chat/completions",
"host": ["{{base_url}}"],
"path": ["v1", "chat", "completions"]
},
"description": "New conversation, non-streaming. Auto-saves `conversation_id` to collection variable.\n\n**Response:**\n```json\n{\n \"id\": \"chatcmpl-...\",\n \"object\": \"chat.completion\",\n \"model\": \"gpt-4o\",\n \"conversation_id\": \"conv_...\",\n \"choices\": [{\n \"index\": 0,\n \"message\": { \"role\": \"assistant\", \"content\": \"Paris.\" },\n \"finish_reason\": \"stop\"\n }],\n \"usage\": { \"prompt_tokens\": 0, \"completion_tokens\": 0, \"total_tokens\": 0 }\n}\n```"
}
},
{
"name": "POST /v1/chat/completions - Continue (explicit ID)",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var json = pm.response.json();",
"if (json.conversation_id) {",
" pm.collectionVariables.set('conversation_id', json.conversation_id);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"model\": \"gpt-4o\",\n \"conversation_id\": \"{{conversation_id}}\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What was my previous question?\"\n }\n ]\n}"
},
"url": {
"raw": "{{base_url}}/v1/chat/completions",
"host": ["{{base_url}}"],
"path": ["v1", "chat", "completions"]
},
"description": "Continue conversation using explicit `conversation_id`. Only the new user message is sent to ChatGPT; prior history is retrieved from SQLite."
}
},
{
"name": "POST /v1/chat/completions - Continue (auto-match)",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var json = pm.response.json();",
"if (json.conversation_id) {",
" pm.collectionVariables.set('conversation_id', json.conversation_id);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"What is the capital of France?\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Paris.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"What is the population of that city?\"\n }\n ]\n}"
},
"url": {
"raw": "{{base_url}}/v1/chat/completions",
"host": ["{{base_url}}"],
"path": ["v1", "chat", "completions"]
},
"description": "Auto-match mode (Cline/Void style). Send the full message history — if stored messages are a prefix of incoming messages, the existing conversation is automatically continued. No `conversation_id` needed.\n\nThis is how Cline and Void work: they send the entire chat history each time, and the server matches it to an existing conversation."
}
},
{
"name": "POST /v1/chat/completions - Stream (new)",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Streaming responses are SSE - parse last chunk for conversation_id",
"var body = pm.response.text();",
"var lines = body.split('\\n').filter(l => l.startsWith('data: ') && l !== 'data: [DONE]');",
"if (lines.length > 0) {",
" try {",
" var last = JSON.parse(lines[0].slice(6));",
" if (last.conversation_id) {",
" pm.collectionVariables.set('conversation_id', last.conversation_id);",
" console.log('Saved conversation_id:', last.conversation_id);",
" }",
" } catch(e) {}",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"model\": \"gpt-4o\",\n \"stream\": true,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Write a Python function to calculate fibonacci numbers\"\n }\n ]\n}"
},
"url": {
"raw": "{{base_url}}/v1/chat/completions",
"host": ["{{base_url}}"],
"path": ["v1", "chat", "completions"]
},
"description": "Real SSE streaming. Tokens appear progressively as ChatGPT generates them.\n\n**SSE Format:**\n```\ndata: {\"id\":\"chatcmpl-...\",\"object\":\"chat.completion.chunk\",\"conversation_id\":\"conv_...\",\"choices\":[{\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-...\",\"choices\":[{\"delta\":{\"content\":\"def \"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-...\",\"choices\":[{\"delta\":{},\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n```\n\n`conversation_id` is included in the first chunk for continuation."
}
},
{
"name": "POST /v1/chat/completions - Stream (continue)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"model\": \"gpt-4o\",\n \"stream\": true,\n \"conversation_id\": \"{{conversation_id}}\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Now make it use memoization\"\n }\n ]\n}"
},
"url": {
"raw": "{{base_url}}/v1/chat/completions",
"host": ["{{base_url}}"],
"path": ["v1", "chat", "completions"]
},
"description": "Continue an existing conversation with streaming enabled. Uses `conversation_id` from a previous request."
}
},
{
"name": "POST /v1/chat/completions - Cline format (array content)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"model\": \"gpt-4o\",\n \"stream\": true,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Explain this code:\"\n },\n {\n \"type\": \"text\",\n \"text\": \"console.log('hello world')\"\n }\n ]\n }\n ]\n}"
},
"url": {
"raw": "{{base_url}}/v1/chat/completions",
"host": ["{{base_url}}"],
"path": ["v1", "chat", "completions"]
},
"description": "Cline sends content as an array of `{type, text}` objects. The server normalizes this to plain text automatically.\n\nThis tests that content normalization works correctly for Cline/Void integration."
}
}
]
},
{
"name": "Debug",
"description": "Debug and diagnostic endpoints for inspecting internal state, controlling the hidden ChatGPT window, and measuring latency.",
"item": [
{
"name": "GET /debug/tokens - Show auth tokens",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/debug/tokens",
"host": ["{{base_url}}"],
"path": ["debug", "tokens"]
},
"description": "Returns the current ChatGPT auth tokens (access token, etc.) extracted from the hidden BrowserWindow session."
}
},
{
"name": "GET /debug/show-window - Show ChatGPT window",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/debug/show-window",
"host": ["{{base_url}}"],
"path": ["debug", "show-window"]
},
"description": "Makes the hidden ChatGPT BrowserWindow visible. Useful for debugging automation issues."
}
},
{
"name": "GET /debug/hide-window - Hide ChatGPT window",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/debug/hide-window",
"host": ["{{base_url}}"],
"path": ["debug", "hide-window"]
},
"description": "Hides the ChatGPT BrowserWindow after showing it with `/debug/show-window`."
}
},
{
"name": "GET /debug/latency - Show latency stats",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/debug/latency",
"host": ["{{base_url}}"],
"path": ["debug", "latency"]
},
"description": "Returns latency statistics for recent requests: min, max, average, and per-request breakdown."
}
},
{
"name": "POST /debug/latency/reset - Reset latency stats",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{base_url}}/debug/latency/reset",
"host": ["{{base_url}}"],
"path": ["debug", "latency", "reset"]
},
"description": "Resets accumulated latency statistics back to zero."
}
},
{
"name": "GET /debug/refresh-token - Force token refresh",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/debug/refresh-token",
"host": ["{{base_url}}"],
"path": ["debug", "refresh-token"]
},
"description": "Forces a ChatGPT auth token refresh. Useful when requests start failing with 401/403 errors."
}
},
{
"name": "GET /debug/cookies - Show session cookies",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/debug/cookies",
"host": ["{{base_url}}"],
"path": ["debug", "cookies"]
},
"description": "Returns the current cookies from the ChatGPT BrowserWindow session, useful for verifying login state."
}
},
{
"name": "GET /debug/cookie-test - Test cookie validity",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/debug/cookie-test",
"host": ["{{base_url}}"],
"path": ["debug", "cookie-test"]
},
"description": "Makes a test request to ChatGPT using the current session cookies and reports whether authentication is working."
}
}
]
}
]
}