opencode-gemini-business 2.0.5 → 2.2.0
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.
- package/CHANGELOG.md +19 -0
- package/README.en.md +278 -0
- package/README.md +159 -272
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +84 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +6 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -25
- package/dist/index.js.map +1 -1
- package/dist/opencode-gemini-business-2.2.0.tgz +0 -0
- package/dist/src/browser-auth.d.ts +35 -0
- package/dist/src/browser-auth.d.ts.map +1 -0
- package/dist/src/browser-auth.js +212 -0
- package/dist/src/browser-auth.js.map +1 -0
- package/dist/src/gemini-business-api.d.ts.map +1 -1
- package/dist/src/gemini-business-api.js +85 -25
- package/dist/src/gemini-business-api.js.map +1 -1
- package/dist/src/types.d.ts +19 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/README.ru.md +0 -397
- package/dist/opencode-gemini-business-2.0.5.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,102 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# 🔄 opencode-gemini-business
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Мульти-аккаунтный пул Gemini Business с интеллектуальной ротацией для OpenCode**
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/opencode-gemini-business)
|
|
8
|
+
[](https://www.npmjs.com/package/opencode-gemini-business)
|
|
9
|
+
[](https://github.com/izzzzzi/opencode-gemini-business/releases)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://www.typescriptlang.org/)
|
|
12
|
+
[](https://nodejs.org/)
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
**🇷🇺 Русский** | [🇬🇧 English](README.en.md)
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
<br />
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
*Auth-плагин для [OpenCode](https://github.com/anomalyco/opencode) — пул из нескольких аккаунтов Gemini Business с автоматической ротацией, фейловером и балансировкой нагрузки.*
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
</div>
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
---
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|---------|-------------|
|
|
23
|
-
| 🔄 **Multi-Account Rotation** | Automatically rotate between multiple Gemini Business accounts |
|
|
24
|
-
| 🛡️ **Automatic Failover** | Retry failed requests with different accounts seamlessly |
|
|
25
|
-
| 🔐 **Session Management** | Built-in XSRF token and session lifecycle management |
|
|
26
|
-
| ⚙️ **Flexible Strategies** | Round-robin, least-used, or random rotation |
|
|
27
|
-
| 📊 **Health Monitoring** | Track usage statistics and error counts per account |
|
|
28
|
-
| 🚀 **OpenCode Compatible** | Works seamlessly with OpenCode's provider system |
|
|
29
|
-
| 💾 **Persistent Config** | Secure storage in `~/.config/opencode/gemini-business-accounts.json` |
|
|
24
|
+
## 📖 Обзор
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
**opencode-gemini-business** — плагин для OpenCode, который обеспечивает ротацию между несколькими аккаунтами **Gemini Business API** (`business.gemini.google`), предоставляя автоматическое переключение при ошибках и балансировку нагрузки.
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
> **Важно**: Плагин использует **Gemini Business / Enterprise API**, НЕ Google AI Studio.
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|-------|---------------|------------|----------|
|
|
37
|
-
| `gemini-2.5-pro` | 1M tokens | 32K tokens | Complex reasoning, long documents |
|
|
38
|
-
| `gemini-2.5-flash` | 1M tokens | 8K tokens | Fast responses, simple tasks |
|
|
39
|
-
| `gemini-2.0-pro` | 2M tokens | 32K tokens | Massive context, deep analysis |
|
|
40
|
-
| `gemini-1.5-pro` | 2M tokens | 8K tokens | Production workloads |
|
|
41
|
-
| `gemini-1.5-flash` | 1M tokens | 8K tokens | Cost-effective development |
|
|
30
|
+
---
|
|
42
31
|
|
|
43
|
-
##
|
|
32
|
+
## ✨ Возможности
|
|
44
33
|
|
|
45
|
-
|
|
34
|
+
| Возможность | Описание |
|
|
35
|
+
|-------------|----------|
|
|
36
|
+
| 🔄 **Ротация аккаунтов** | Автоматическое переключение между несколькими аккаунтами Gemini Business |
|
|
37
|
+
| 🛡️ **Автоматический фейловер** | Повторные запросы с другим аккаунтом при ошибках |
|
|
38
|
+
| 🔐 **JWT-аутентификация** | Встроенное получение XSRF-токена и подписание JWT (HS256) |
|
|
39
|
+
| 📡 **Поддержка стриминга** | Полная поддержка SSE, JSON-lines и fallback-парсинга |
|
|
40
|
+
| ⚙️ **Гибкие стратегии** | Round-robin, least-used или случайный выбор |
|
|
41
|
+
| 🔑 **Автонастройка auth** | `add-account` автоматически создаёт auth-запись OpenCode |
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
npm install -g opencode-gemini-business
|
|
49
|
-
```
|
|
43
|
+
---
|
|
50
44
|
|
|
51
|
-
|
|
45
|
+
## 🤖 Поддерживаемые модели
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
| Модель | Internal API ID | Для чего |
|
|
48
|
+
|--------|:---------------:|----------|
|
|
49
|
+
| `gemini-2.5-flash` | `gemini-2.5-flash` | Повседневные задачи, быстрые ответы |
|
|
50
|
+
| `gemini-2.5-pro` | `gemini-2.5-pro` | Сложные рассуждения |
|
|
51
|
+
| `gemini-3-flash` | `gemini-3-flash-preview` | Новое поколение, быстрая |
|
|
52
|
+
| `gemini-3.1-pro` | `gemini-3.1-pro-preview` | Продвинутые рассуждения (preview) |
|
|
53
|
+
| `auto` | *(пусто)* | Gemini автоматически выберет лучшую модель |
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
---
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
## 🚀 Быстрый старт
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
"$schema": "https://opencode.ai/config.json",
|
|
64
|
-
"plugin": ["opencode-gemini-business@latest"],
|
|
65
|
-
"provider": {
|
|
66
|
-
"gemini-business": {
|
|
67
|
-
"models": {
|
|
68
|
-
"gemini-2.5-pro": {
|
|
69
|
-
"name": "Gemini 2.5 Pro (Business)",
|
|
70
|
-
"limit": { "context": 1048576, "output": 32768 },
|
|
71
|
-
"modalities": { "input": ["text"], "output": ["text"] }
|
|
72
|
-
},
|
|
73
|
-
"gemini-2.5-flash": {
|
|
74
|
-
"name": "Gemini 2.5 Flash (Business)",
|
|
75
|
-
"limit": { "context": 1048576, "output": 8192 },
|
|
76
|
-
"modalities": { "input": ["text"], "output": ["text"] }
|
|
77
|
-
},
|
|
78
|
-
"gemini-2.0-pro": {
|
|
79
|
-
"name": "Gemini 2.0 Pro (Business)",
|
|
80
|
-
"limit": { "context": 2097152, "output": 32768 },
|
|
81
|
-
"modalities": { "input": ["text"], "output": ["text"] }
|
|
82
|
-
},
|
|
83
|
-
"gemini-1.5-pro": {
|
|
84
|
-
"name": "Gemini 1.5 Pro (Business)",
|
|
85
|
-
"limit": { "context": 2097152, "output": 8192 },
|
|
86
|
-
"modalities": { "input": ["text"], "output": ["text"] }
|
|
87
|
-
},
|
|
88
|
-
"gemini-1.5-flash": {
|
|
89
|
-
"name": "Gemini 1.5 Flash (Business)",
|
|
90
|
-
"limit": { "context": 1048576, "output": 8192 },
|
|
91
|
-
"modalities": { "input": ["text"], "output": ["text"] }
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
```
|
|
59
|
+
### Шаг 1: Настроить OpenCode
|
|
98
60
|
|
|
99
|
-
|
|
61
|
+
Добавьте в `~/.config/opencode/opencode.json`:
|
|
100
62
|
|
|
101
63
|
```json
|
|
102
64
|
{
|
|
@@ -104,288 +66,213 @@ Add to `~/.config/opencode/opencode.json`:
|
|
|
104
66
|
"plugin": ["opencode-gemini-business@latest"],
|
|
105
67
|
"provider": {
|
|
106
68
|
"gemini-business": {
|
|
69
|
+
"name": "Gemini Business",
|
|
70
|
+
"options": {
|
|
71
|
+
"baseURL": "https://business.gemini.google/v1",
|
|
72
|
+
"apiKey": "unused"
|
|
73
|
+
},
|
|
107
74
|
"models": {
|
|
108
|
-
"gemini-2.5-pro": { "name": "Gemini 2.5 Pro" },
|
|
109
75
|
"gemini-2.5-flash": { "name": "Gemini 2.5 Flash" },
|
|
110
|
-
"gemini-2.
|
|
111
|
-
"gemini-
|
|
112
|
-
"gemini-1
|
|
76
|
+
"gemini-2.5-pro": { "name": "Gemini 2.5 Pro" },
|
|
77
|
+
"gemini-3-flash": { "name": "Gemini 3 Flash" },
|
|
78
|
+
"gemini-3.1-pro": { "name": "Gemini 3.1 Pro" },
|
|
79
|
+
"auto": { "name": "Авто-выбор" }
|
|
113
80
|
}
|
|
114
81
|
}
|
|
115
82
|
}
|
|
116
83
|
}
|
|
117
84
|
```
|
|
118
85
|
|
|
119
|
-
###
|
|
86
|
+
### Шаг 2: Добавить аккаунт Gemini Business
|
|
120
87
|
|
|
121
|
-
|
|
88
|
+
Установите CLI-инструмент:
|
|
122
89
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- [Chrome Web Store: Get cookies.txt LOCALLY](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc)
|
|
127
|
-
- This extension can export **all cookies** including HttpOnly (which JavaScript cannot access)
|
|
128
|
-
|
|
129
|
-
2. **Login** to [Gemini Business](https://business.gemini.google)
|
|
130
|
-
|
|
131
|
-
3. **Click extension icon** → Export cookies for `business.gemini.google`
|
|
132
|
-
|
|
133
|
-
4. **Find in exported file**:
|
|
134
|
-
- `__Secure-C_SES`: `CSE.xxx...`
|
|
135
|
-
- `__Host-C_OSES`: `COS.xxx...`
|
|
136
|
-
|
|
137
|
-
5. **Get csesidx from URL**:
|
|
138
|
-
- Look at your browser URL: `?csesidx=1370433092`
|
|
139
|
-
- Copy the number after `csesidx=`
|
|
140
|
-
|
|
141
|
-
6. **Get team_id from URL**:
|
|
142
|
-
- Look at your browser URL: `/cid/e1f353e7-0291-44cf-9085-e0b6efd20e41/`
|
|
143
|
-
- Copy the UUID after `/cid/` - this is your `team_id`
|
|
144
|
-
- Format: `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
|
|
145
|
-
|
|
146
|
-
7. **Add account** (see below)
|
|
147
|
-
|
|
148
|
-
#### Method 2: Manual Extraction via DevTools
|
|
90
|
+
```bash
|
|
91
|
+
npm install -g opencode-gemini-business
|
|
92
|
+
```
|
|
149
93
|
|
|
150
|
-
|
|
94
|
+
Добавьте аккаунт (нужен Google Chrome или Chromium):
|
|
151
95
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
96
|
+
```bash
|
|
97
|
+
opencode-gemini-business add-account
|
|
98
|
+
```
|
|
155
99
|
|
|
156
|
-
|
|
157
|
-
- Look at your browser URL: `?csesidx=1370433092`
|
|
158
|
-
- Copy the number after `csesidx=`
|
|
100
|
+
Откроется окно Chrome — войдите в аккаунт Gemini Business и отправьте любое сообщение в чат. Куки и учётные данные будут захвачены автоматически. Готово!
|
|
159
101
|
|
|
160
|
-
|
|
102
|
+
> **Примечание:** `add-account` автоматически создаёт auth-запись в `~/.local/share/opencode/auth.json`, поэтому запускать `opencode auth login` не нужно.
|
|
161
103
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- Find `__Host-C_OSES` → copy the value
|
|
104
|
+
<details>
|
|
105
|
+
<summary>Ручной режим (для продвинутых)</summary>
|
|
165
106
|
|
|
166
|
-
|
|
107
|
+
Если хотите указать данные вручную или Chrome не установлен:
|
|
167
108
|
|
|
168
109
|
```bash
|
|
169
|
-
opencode-gemini-business add-account \
|
|
170
|
-
"
|
|
110
|
+
opencode-gemini-business add-account --manual \
|
|
111
|
+
"Мой аккаунт" \
|
|
171
112
|
"e1f353e7-0291-44cf-9085-e0b6efd20e41" \
|
|
172
113
|
"CSE.AXUaAj_MKeqeFLr_..." \
|
|
173
114
|
"COS.AfQtEyCcW1aLwKb3..." \
|
|
174
115
|
"1370433092"
|
|
175
116
|
```
|
|
176
117
|
|
|
177
|
-
|
|
118
|
+
| # | Аргумент | Описание |
|
|
119
|
+
|:-:|----------|----------|
|
|
120
|
+
| 1 | Имя аккаунта | Отображаемое имя аккаунта |
|
|
121
|
+
| 2 | `team_id` | UUID из URL `/cid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/` |
|
|
122
|
+
| 3 | `__Secure-C_SES` | Значение cookie (начинается с `CSE.`) |
|
|
123
|
+
| 4 | `__Host-C_OSES` | Значение cookie (начинается с `COS.`) |
|
|
124
|
+
| 5 | `csesidx` | Число из URL `?csesidx=...` |
|
|
125
|
+
|
|
126
|
+
Или через переменные окружения:
|
|
178
127
|
|
|
179
128
|
```bash
|
|
180
|
-
export GEMINI_ACCOUNT_NAME="
|
|
129
|
+
export GEMINI_ACCOUNT_NAME="Мой аккаунт"
|
|
181
130
|
export GEMINI_TEAM_ID="e1f353e7-0291-44cf-9085-e0b6efd20e41"
|
|
182
131
|
export GEMINI_SECURE_C_SES="CSE.AXUaAj_MKeqeFLr_..."
|
|
183
132
|
export GEMINI_HOST_C_OSES="COS.AfQtEyCcW1aLwKb3..."
|
|
184
133
|
export GEMINI_CSESIDX="1370433092"
|
|
185
134
|
|
|
186
|
-
opencode-gemini-business add-account
|
|
135
|
+
opencode-gemini-business add-account --manual
|
|
187
136
|
```
|
|
188
137
|
|
|
189
|
-
|
|
138
|
+
</details>
|
|
190
139
|
|
|
191
|
-
###
|
|
140
|
+
### Шаг 3: Использовать
|
|
192
141
|
|
|
193
142
|
```bash
|
|
194
|
-
#
|
|
195
|
-
opencode run
|
|
143
|
+
# Flash (быстрая)
|
|
144
|
+
opencode run --model=gemini-business/gemini-2.5-flash "Исправь баг"
|
|
196
145
|
|
|
197
|
-
#
|
|
198
|
-
opencode run
|
|
146
|
+
# Pro (лучшее качество)
|
|
147
|
+
opencode run --model=gemini-business/gemini-2.5-pro "Спроектируй архитектуру"
|
|
199
148
|
|
|
200
|
-
#
|
|
201
|
-
opencode run
|
|
149
|
+
# Модели нового поколения
|
|
150
|
+
opencode run --model=gemini-business/gemini-3-flash "Быстрая задача"
|
|
151
|
+
opencode run --model=gemini-business/gemini-3.1-pro "Продвинутые рассуждения"
|
|
152
|
+
opencode run --model=gemini-business/auto "Gemini выберет сам"
|
|
202
153
|
```
|
|
203
154
|
|
|
204
|
-
|
|
155
|
+
Установить модель по умолчанию в `opencode.json`:
|
|
205
156
|
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"model": "gemini-business/gemini-2.5-flash"
|
|
160
|
+
}
|
|
161
|
+
```
|
|
209
162
|
|
|
210
|
-
|
|
211
|
-
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🔍 Извлечение учётных данных
|
|
212
166
|
|
|
213
|
-
|
|
214
|
-
opencode run "Analyze entire codebase" --model=gemini-2-pro
|
|
167
|
+
### Где найти каждое значение
|
|
215
168
|
|
|
216
|
-
|
|
217
|
-
opencode run "Review this PR" --model=gemini-1.5-pro
|
|
169
|
+
Войдите в [business.gemini.google](https://business.gemini.google) и посмотрите URL:
|
|
218
170
|
|
|
219
|
-
|
|
220
|
-
|
|
171
|
+
```
|
|
172
|
+
https://business.gemini.google/home/cid/e1f353e7-0291-44cf-9085-e0b6efd20e41/r/session/123?csesidx=1370433092
|
|
173
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^
|
|
174
|
+
team_id (UUID после /cid/) csesidx
|
|
221
175
|
```
|
|
222
176
|
|
|
223
|
-
###
|
|
177
|
+
### Cookies
|
|
224
178
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
179
|
+
**Способ 1: Расширение браузера (рекомендуется)**
|
|
180
|
+
|
|
181
|
+
1. Установите [Get cookies.txt LOCALLY](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc)
|
|
182
|
+
2. Откройте `business.gemini.google` и экспортируйте cookies
|
|
183
|
+
3. Найдите `__Secure-C_SES` (начинается с `CSE.`) и `__Host-C_OSES` (начинается с `COS.`)
|
|
184
|
+
|
|
185
|
+
**Способ 2: DevTools**
|
|
186
|
+
|
|
187
|
+
1. Откройте DevTools (F12) → **Application** → **Cookies** → `https://business.gemini.google`
|
|
188
|
+
2. Скопируйте значения `__Secure-C_SES` и `__Host-C_OSES`
|
|
189
|
+
|
|
190
|
+
---
|
|
230
191
|
|
|
231
|
-
|
|
192
|
+
## 🔧 Управление аккаунтами
|
|
232
193
|
|
|
233
194
|
```bash
|
|
234
|
-
#
|
|
195
|
+
# Список аккаунтов
|
|
235
196
|
opencode-gemini-business list-accounts
|
|
236
197
|
|
|
237
|
-
#
|
|
198
|
+
# Тест подключения
|
|
238
199
|
opencode-gemini-business test-account <account_id>
|
|
239
200
|
|
|
240
|
-
#
|
|
201
|
+
# Удалить аккаунт
|
|
241
202
|
opencode-gemini-business remove-account <account_id>
|
|
242
203
|
|
|
243
|
-
#
|
|
204
|
+
# Помощь
|
|
244
205
|
opencode-gemini-business help
|
|
245
206
|
```
|
|
246
207
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
| Strategy | Behavior | Use Case |
|
|
250
|
-
|----------|----------|----------|
|
|
251
|
-
| `round-robin` | Cycles through accounts in order | Balanced usage across all accounts |
|
|
252
|
-
| `least-used` | Selects account with oldest last_used timestamp | Minimize individual account usage |
|
|
253
|
-
| `random` | Random probabilistic selection | Unpredictable load distribution |
|
|
254
|
-
|
|
255
|
-
**Configure strategy** in OpenCode config:
|
|
256
|
-
|
|
257
|
-
```json
|
|
258
|
-
{
|
|
259
|
-
"$schema": "https://opencode.ai/config.json",
|
|
260
|
-
"plugin": ["opencode-gemini-business@latest"],
|
|
261
|
-
"provider": {
|
|
262
|
-
"gemini-business": {
|
|
263
|
-
"rotation_strategy": "least-used", // ← Change here
|
|
264
|
-
"models": {
|
|
265
|
-
"gemini-2.5-pro": {
|
|
266
|
-
"name": "Gemini 2.5 Pro (Business)",
|
|
267
|
-
"limit": { "context": 1048576, "output": 32768 },
|
|
268
|
-
"modalities": { "input": ["text"], "output": ["text"] }
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
```
|
|
208
|
+
---
|
|
275
209
|
|
|
210
|
+
## ⚙️ Стратегии ротации
|
|
276
211
|
|
|
277
|
-
|
|
212
|
+
| Стратегия | Поведение |
|
|
213
|
+
|-----------|-----------|
|
|
214
|
+
| `round-robin` (по умолчанию) | Циклический обход аккаунтов по порядку |
|
|
215
|
+
| `least-used` | Выбор наименее недавно использованного |
|
|
216
|
+
| `random` | Случайный выбор |
|
|
278
217
|
|
|
279
|
-
|
|
280
|
-
<summary><b>Q: How do I handle session expiration?</b></summary>
|
|
218
|
+
Настраивается в `~/.config/opencode/gemini-business-accounts.json` (создаётся автоматически при первом `add-account`).
|
|
281
219
|
|
|
282
|
-
|
|
220
|
+
---
|
|
283
221
|
|
|
284
|
-
|
|
222
|
+
## 🛠️ Как это работает
|
|
285
223
|
|
|
286
|
-
|
|
287
|
-
|
|
224
|
+
1. Плагин регистрируется как auth-провайдер `gemini-business` в OpenCode
|
|
225
|
+
2. При запросе `loader()` возвращает кастомную функцию `fetch()`
|
|
226
|
+
3. Кастомный `fetch()` перехватывает запрос от `@ai-sdk/openai-compatible`
|
|
227
|
+
4. Вместо вызова `baseURL/chat/completions` он:
|
|
228
|
+
- Выбирает аккаунт по стратегии ротации
|
|
229
|
+
- Получает XSRF-токен и создаёт JWT (HS256)
|
|
230
|
+
- Создаёт сессию через `widgetCreateSession`
|
|
231
|
+
- Отправляет запрос на `widgetStreamAssist`
|
|
232
|
+
- Конвертирует ответ в OpenAI-совместимый формат
|
|
233
|
+
5. Поддерживает стриминг (SSE) и обычные ответы
|
|
288
234
|
|
|
289
|
-
|
|
290
|
-
- **Quick tasks**: `gemini-2.5-flash` or `gemini-1.5-flash` for speed
|
|
291
|
-
- **Large contexts**: `gemini-2.0-pro` supports up to 2M tokens
|
|
235
|
+
---
|
|
292
236
|
|
|
293
|
-
|
|
237
|
+
## ❓ FAQ
|
|
294
238
|
|
|
295
239
|
<details>
|
|
296
|
-
<summary><b
|
|
240
|
+
<summary><b>В: Где найти team_id?</b></summary>
|
|
297
241
|
|
|
298
|
-
|
|
242
|
+
Посмотрите URL в браузере: `https://business.gemini.google/home/cid/e1f353e7-0291-44cf-9085-e0b6efd20e41/...`
|
|
299
243
|
|
|
244
|
+
UUID после `/cid/` — это ваш `team_id`.
|
|
300
245
|
</details>
|
|
301
246
|
|
|
302
247
|
<details>
|
|
303
|
-
<summary><b
|
|
304
|
-
|
|
305
|
-
**Easy way:** Look at your browser URL when logged into Gemini Business:
|
|
306
|
-
```
|
|
307
|
-
https://business.gemini.google/home/cid/e1f353e7-0291-44cf-9085-e0b6efd20e41/...
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
The UUID after `/cid/` is your `team_id`. Format: `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
|
|
311
|
-
|
|
312
|
-
This ID identifies your organization/team in Google Workspace and is required for all API requests.
|
|
248
|
+
<summary><b>В: Нужно ли запускать `opencode auth login`?</b></summary>
|
|
313
249
|
|
|
250
|
+
Нет. Команда `add-account` автоматически создаёт auth-запись в `~/.local/share/opencode/auth.json`. Если по какой-то причине запись не создалась, запустите `opencode auth login`, выберите **gemini-business** и введите любой ключ (например `unused`).
|
|
314
251
|
</details>
|
|
315
252
|
|
|
316
253
|
<details>
|
|
317
|
-
<summary><b
|
|
318
|
-
|
|
319
|
-
**YES, 100% safe!** The script:
|
|
320
|
-
- ✅ Runs ONLY in your browser (locally)
|
|
321
|
-
- ✅ Does NOT send data to external servers
|
|
322
|
-
- ✅ Only reads cookies from business.gemini.google
|
|
323
|
-
- ✅ Open source - you can review the code
|
|
324
|
-
|
|
325
|
-
**Never** run scripts from untrusted sources. Only use from official repository.
|
|
254
|
+
<summary><b>В: Ошибки истечения сессии?</b></summary>
|
|
326
255
|
|
|
256
|
+
Плагин автоматически обновляет сессии (кешируются на 50 минут). Если ошибки не проходят — cookies могли истечь, извлеките их заново из браузера.
|
|
327
257
|
</details>
|
|
328
258
|
|
|
329
259
|
<details>
|
|
330
|
-
<summary><b
|
|
331
|
-
|
|
332
|
-
This plugin uses **Gemini Business API** (`business.gemini.google`), which is:
|
|
333
|
-
- ✅ Enterprise/business accounts
|
|
334
|
-
- ✅ Higher rate limits
|
|
335
|
-
- ✅ Business-grade features
|
|
336
|
-
|
|
337
|
-
**NOT** Google AI Studio (`aistudio.google.com`), which is:
|
|
338
|
-
- ❌ Free/developer tier
|
|
339
|
-
- ❌ Lower rate limits
|
|
340
|
-
- ❌ Different API endpoints
|
|
260
|
+
<summary><b>В: Чем отличается от Google AI Studio?</b></summary>
|
|
341
261
|
|
|
262
|
+
Плагин использует **Gemini Business API** (`business.gemini.google`) — корпоративные аккаунты с высокими лимитами. НЕ Google AI Studio (`aistudio.google.com`).
|
|
342
263
|
</details>
|
|
343
264
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
### Credential Safety
|
|
347
|
-
|
|
348
|
-
```
|
|
349
|
-
⚠️ CRITICAL: Keep your credentials PRIVATE!
|
|
350
|
-
|
|
351
|
-
✅ DO:
|
|
352
|
-
- Store credentials only in ~/.config/opencode/gemini-business-accounts.json
|
|
353
|
-
- Use environment variables for temporary access
|
|
354
|
-
- Rotate credentials regularly
|
|
355
|
-
- Add *.json to .gitignore
|
|
356
|
-
|
|
357
|
-
❌ DON'T:
|
|
358
|
-
- Commit credentials to git repositories
|
|
359
|
-
- Share credentials with others
|
|
360
|
-
- Store credentials in plain text files
|
|
361
|
-
- Use credentials in public environments
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
### Cookie Extraction Script Safety
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
✅ The extraction script is SAFE because:
|
|
368
|
-
- Runs 100% locally in your browser
|
|
369
|
-
- NO external network requests
|
|
370
|
-
- NO data transmission to servers
|
|
371
|
-
- Open source and reviewable
|
|
372
|
-
|
|
373
|
-
⚠️ Security Tips:
|
|
374
|
-
- Only use from official repository
|
|
375
|
-
- Review code before running (it's short!)
|
|
376
|
-
- Never paste modified scripts
|
|
377
|
-
- Check browser console for any warnings
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
## 📄 License
|
|
381
|
-
|
|
382
|
-
MIT License - feel free to use this plugin!
|
|
265
|
+
---
|
|
383
266
|
|
|
384
|
-
##
|
|
267
|
+
## 🔒 Безопасность
|
|
385
268
|
|
|
386
|
-
-
|
|
387
|
-
-
|
|
388
|
-
-
|
|
269
|
+
- Учётные данные хранятся локально в `~/.config/opencode/gemini-business-accounts.json`
|
|
270
|
+
- Не коммитьте credentials в git
|
|
271
|
+
- Регулярно обновляйте cookies
|
|
272
|
+
- Плагин не отправляет данные третьим сторонам
|
|
389
273
|
|
|
390
274
|
---
|
|
391
275
|
|
|
276
|
+
## 📄 Лицензия
|
|
277
|
+
|
|
278
|
+
[MIT](LICENSE) © opencode-gemini-business contributors
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AAUA;;GAEG;AACH,wBAAsB,GAAG,kBAkCxB"}
|