-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGeminiTools.postman_collection.json
More file actions
338 lines (338 loc) · 15.4 KB
/
GeminiTools.postman_collection.json
File metadata and controls
338 lines (338 loc) · 15.4 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
{
"info": {
"name": "GeminiTools API",
"_postman_id": "gemini-tools-collection",
"description": "Gemini Chat API Proxy — OpenAI-compatible endpoints powered by Google Gemini via Electron.\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\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 a single model: `gemini`."
}
},
{
"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 API, no OpenAI format. Returns raw Gemini conversation IDs for manual continuation.",
"item": [
{
"name": "POST /api/chat - New conversation",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"message\": \"Xin chào, bạn là ai?\",\n \"lang\": \"vi\"\n}"
},
"url": {
"raw": "{{base_url}}/api/chat",
"host": ["{{base_url}}"],
"path": ["api", "chat"]
},
"description": "Start a new conversation.\n\n**Body:**\n- `message` (required): The user message\n- `lang` (optional): Language code, default `vi`\n\n**Response:**\n```json\n{\n \"success\": true,\n \"message\": \"Xin chào! Tôi là...\",\n \"conversation_id\": \"...\",\n \"response_id\": \"...\",\n \"choice_id\": \"...\"\n}\n```"
}
},
{
"name": "POST /api/chat - Continue conversation",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"message\": \"Tiếp tục câu hỏi trước đó\",\n \"conversation_id\": \"PASTE_conversation_id_HERE\",\n \"response_id\": \"PASTE_response_id_HERE\",\n \"choice_id\": \"PASTE_choice_id_HERE\",\n \"lang\": \"vi\"\n}"
},
"url": {
"raw": "{{base_url}}/api/chat",
"host": ["{{base_url}}"],
"path": ["api", "chat"]
},
"description": "Continue an existing conversation by passing IDs from previous response.\n\n**Body:**\n- `message` (required): The user message\n- `conversation_id`: Gemini conversation ID from previous response\n- `response_id`: Gemini response ID from previous response\n- `choice_id`: Gemini choice ID from previous response\n- `lang` (optional): Language code, default `vi`"
}
}
]
},
{
"name": "OpenAI Compatible",
"description": "OpenAI-compatible `/v1/chat/completions` endpoint. Works with Cline, Void, and other OpenAI-compatible clients.\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 via console-message channel).",
"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\": \"gemini\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Bạn là một trợ lý AI hữu ích.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Tên bạn là gì?\"\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\": \"gemini\",\n \"conversation_id\": \"conv_...\",\n \"choices\": [{\n \"index\": 0,\n \"message\": { \"role\": \"assistant\", \"content\": \"...\" },\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\": \"gemini\",\n \"conversation_id\": \"{{conversation_id}}\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Câu hỏi trước tôi hỏi gì?\"\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 Gemini."
}
},
{
"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\": \"gemini\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Bạn là một trợ lý AI hữu ích.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Tên bạn là gì?\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Tôi là Gemini, trợ lý AI của Google.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Bạn có thể làm gì?\"\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 full message history — if stored messages are a prefix of incoming messages, the existing Gemini 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\": \"gemini\",\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 Gemini generates them.\n\n**SSE Format:**\n```\ndata: {\"id\":\"chatcmpl-...\",\"object\":\"chat.completion.chunk\",\"choices\":[{\"delta\":{\"role\":\"assistant\",\"content\":\"...\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-...\",\"choices\":[{\"delta\":{\"content\":\"...\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-...\",\"choices\":[{\"delta\":{},\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n```\n\nEach chunk contains `conversation_id` 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\": \"gemini\",\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\": \"gemini\",\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."
}
}
]
}
]
}