gemi-cli 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,462 @@
1
+ Metadata-Version: 2.4
2
+ Name: gemi-cli
3
+ Version: 0.1.0
4
+ Summary: Free AI coding agent CLI — multi-account Gemini key rotation with provider failover
5
+ Project-URL: Homepage, https://github.com/parteekahlawat/gemi-cli
6
+ Project-URL: Repository, https://github.com/parteekahlawat/gemi-cli
7
+ Project-URL: Issues, https://github.com/parteekahlawat/gemi-cli/issues
8
+ Author-email: Parteek <pratham@a79.ai>
9
+ License-Expression: MIT
10
+ Keywords: ai,cli,coding-agent,gemini,llm
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Software Development
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: cryptography>=42.0
19
+ Requires-Dist: google-genai>=1.0
20
+ Requires-Dist: ollama>=0.4
21
+ Requires-Dist: openai>=1.0
22
+ Requires-Dist: prompt-toolkit>=3.0
23
+ Requires-Dist: pyyaml>=6.0
24
+ Requires-Dist: rich>=13.0
25
+ Requires-Dist: typer>=0.9.0
26
+ Description-Content-Type: text/markdown
27
+
28
+ ```
29
+ __ _ ___ _ __ ___ (_)
30
+ / _` / _ \ '_ ` _ \| |
31
+ | (_| \__/ | | | | | |
32
+ \__, \___|_| |_| |_|_|
33
+ __/ |
34
+ |___/
35
+ ```
36
+
37
+ **Free AI coding agent for your terminal.**
38
+ Multi-account key rotation. 9 providers. Auto-failover. Never pay for AI coding.
39
+
40
+ [Install](#installation) • [Quick Start](#quick-start) • [Providers](#supported-providers) • [Never Pay Setup](#the-never-pay-setup) • [Features](#features)
41
+
42
+ ---
43
+
44
+ ## What is gemi?
45
+
46
+ gemi is a free, open-source AI coding agent that runs in your terminal — like Claude Code or Cursor, but **free forever**.
47
+
48
+ It uses Google Gemini's free API tier as the primary provider, rotates across multiple API keys when you hit rate limits, and automatically fails over to 8 other providers (Groq, OpenRouter, Mistral, Cerebras, DeepSeek, Together AI, OpenAI, Ollama).
49
+
50
+ **The key insight:** A single free Gemini account gives you ~250-1,500 requests/day. With 3 accounts + fallback providers, you can code all day without paying a cent.
51
+
52
+ ---
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ # Install from PyPI
58
+ pipx install gemi-cli
59
+ # or
60
+ pip install gemi-cli
61
+
62
+ # From source
63
+ git clone https://github.com/parteekahlawat/gemi-cli.git
64
+ cd gemi
65
+ pip install -e .
66
+
67
+ # Verify
68
+ gemi --help
69
+ ```
70
+
71
+ > **Requires Python 3.10+**
72
+
73
+ ---
74
+
75
+ ## Quick Start
76
+
77
+ ```bash
78
+ # 1. Add a free Gemini API key (https://aistudio.google.com/apikey)
79
+ gemi key add gemini
80
+
81
+ # 2. Navigate to your project
82
+ cd ~/your-project
83
+
84
+ # 3. Start coding
85
+ gemi
86
+ ```
87
+
88
+ That's it. gemi reads your project, understands the codebase, and can read/write files, run commands, manage git, and build features for you.
89
+
90
+ ---
91
+
92
+ ## Demo
93
+
94
+ ```
95
+ ❯ build a REST API for a todo app with FastAPI
96
+
97
+ 📋 Plan: Build Todo REST API
98
+ ╭──────────────────────────────────────────────╮
99
+ │ ○ 1. Set up project structure │
100
+ │ ○ 2. Create database models │
101
+ │ ○ 3. Build CRUD endpoints │
102
+ │ ○ 4. Add input validation │
103
+ │ ○ 5. Run and verify │
104
+ ╰──────────────────────────────────────────────╯
105
+ a) Yes, execute this plan
106
+
107
+ 📝 Write app/main.py
108
+ 📝 Write app/models.py
109
+ 📝 Write app/routes.py
110
+ ⚙️ `pip install fastapi uvicorn sqlalchemy`
111
+ ⚙️ `uvicorn app.main:app --reload`
112
+ ✓ Process running in background (PID 12345)
113
+
114
+ Done! API running at http://localhost:8000
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Supported Providers
120
+
121
+ 9 providers pre-configured. Zero URL config — just add your key.
122
+
123
+ | Provider | Free Tier | Default Model | Get Key |
124
+ |---|---|---|---|
125
+ | **Gemini** | Yes — 250+ RPD | `gemini-2.5-flash` | [aistudio.google.com/apikey](https://aistudio.google.com/apikey) |
126
+ | **Groq** | Yes — 1,000 RPD | `llama-3.3-70b-versatile` | [console.groq.com/keys](https://console.groq.com/keys) |
127
+ | **OpenRouter** | Yes — 27+ free models | `deepseek/deepseek-r1:free` | [openrouter.ai/keys](https://openrouter.ai/keys) |
128
+ | **Mistral** | Yes — 1B tokens/month | `codestral-latest` | [console.mistral.ai/api-keys](https://console.mistral.ai/api-keys) |
129
+ | **Cerebras** | Yes — fast inference | `llama-3.3-70b` | [cloud.cerebras.ai](https://cloud.cerebras.ai/) |
130
+ | **DeepSeek** | No (cheap) | `deepseek-chat` | [platform.deepseek.com](https://platform.deepseek.com/api_keys) |
131
+ | **Together AI** | Signup credits | `Llama-3.3-70B-Instruct-Turbo` | [api.together.ai](https://api.together.ai/settings/api-keys) |
132
+ | **OpenAI** | No | `gpt-4o-mini` | [platform.openai.com](https://platform.openai.com/api-keys) |
133
+ | **Ollama** | Unlimited (local) | `qwen3` | No key needed |
134
+
135
+ ```bash
136
+ # Add any provider
137
+ gemi key add gemini
138
+ gemi key add groq --key gsk_...
139
+ gemi key add openrouter
140
+
141
+ # See all providers
142
+ gemi providers
143
+ ```
144
+
145
+ ---
146
+
147
+ ## The "Never Pay" Setup
148
+
149
+ ```bash
150
+ # Gemini — 3 Google accounts for rotation
151
+ gemi key add gemini --name acc1 --key AIzaSy...
152
+ gemi key add gemini --name acc2 --key AIzaSy...
153
+ gemi key add gemini --name acc3 --key AIzaSy...
154
+
155
+ # Groq — fast fallback
156
+ gemi key add groq --key gsk_...
157
+
158
+ # Cerebras — another free option
159
+ gemi key add cerebras --key csk-...
160
+
161
+ # OpenRouter — 27+ free models
162
+ gemi key add openrouter --key sk-or-...
163
+
164
+ # Ollama — unlimited local (optional)
165
+ ollama pull qwen3
166
+ ```
167
+
168
+ **Automatic failover chain:**
169
+
170
+ ```
171
+ gemini/acc1 → gemini/acc2 → gemini/acc3 → groq → cerebras → openrouter → mistral → ollama
172
+ ```
173
+
174
+ All automatic. You never have to think about it. Context is preserved across switches.
175
+
176
+ | Gemini Accounts | Requests/Day | Coding Time |
177
+ |---|---|---|
178
+ | 1 | ~500-1,500 | 2-4 hours |
179
+ | 3 | ~1,500-4,500 | 6-12 hours |
180
+ | 5 | ~2,500-7,500 | Full day |
181
+
182
+ ---
183
+
184
+ ## Features
185
+
186
+ ### AI Coding Agent
187
+ - Full ReAct agent loop — reads code, makes plans, writes files, runs commands
188
+ - **Plan mode** — automatically creates step-by-step plans for complex tasks, asks for approval before executing
189
+ - Streaming markdown responses with syntax highlighting
190
+ - 13 built-in tools (file ops, git, shell, search)
191
+
192
+ ### Multi-Provider Key Rotation
193
+ - 9 pre-configured providers (zero URL/format config)
194
+ - Unlimited API keys per provider
195
+ - Auto-rotation on rate limit (429)
196
+ - Auto-failover across providers when all keys exhausted
197
+ - Encrypted key storage (`~/.gemi/keys.json`)
198
+ - Per-key usage tracking
199
+ - 3 rotation strategies: `failover`, `round-robin`, `least-used`
200
+
201
+ ### Smart Command Execution
202
+ - All commands run non-blocking — fast commands return instantly, long-running ones (dev servers, builds) return after 30s with partial output and continue in background
203
+ - Background processes auto-cleaned on exit
204
+
205
+ ### Session Management
206
+ - Auto-save after every message
207
+ - Resume any session: `gemi --resume <id>`
208
+ - Context auto-compaction at 75% usage
209
+ - Auto-trim on provider switch to fit smaller context windows
210
+
211
+ ### Safety
212
+ - Diff preview on every file edit (green/red with line numbers)
213
+ - User approval required for writes and commands
214
+ - `/undo` to revert the last edit
215
+ - Configurable auto-approve settings
216
+
217
+ ### Project Context
218
+ - Drop a `.gemi.md` in your project root with stack info, conventions, and instructions
219
+ - gemi reads it on startup and follows your project's rules
220
+
221
+ ---
222
+
223
+ ## Commands
224
+
225
+ ### CLI (Terminal)
226
+
227
+ | Command | Description |
228
+ |---------|-------------|
229
+ | `gemi` | Start interactive coding session |
230
+ | `gemi --resume <id>` | Resume a saved session |
231
+ | `gemi key add <provider>` | Add an API key |
232
+ | `gemi key list [provider]` | List stored keys |
233
+ | `gemi key remove <provider> <name>` | Remove a key |
234
+ | `gemi key status` | Show key health & usage |
235
+ | `gemi model [name]` | Show or change default model |
236
+ | `gemi providers` | List all supported providers |
237
+ | `gemi sessions` | List saved sessions |
238
+ | `gemi config` | Show current config |
239
+ | `gemi config set <key> <value>` | Update a config value |
240
+
241
+ ### In-Session (Inside gemi)
242
+
243
+ | Command | Description |
244
+ |---------|-------------|
245
+ | `/help` | Show help panel |
246
+ | `/status` | Key rotation status & usage summary |
247
+ | `/tokens` | Detailed token and session stats |
248
+ | `/model <name>` | Switch model mid-session |
249
+ | `/plan` | View current plan progress |
250
+ | `/undo` | Undo last file edit |
251
+ | `/sessions` | List saved sessions |
252
+ | `/clear` | Clear conversation & reset counters |
253
+ | `/quit` | Exit gemi (also `/exit`, `/q`, Ctrl+C) |
254
+
255
+ ### Agent Tools
256
+
257
+ The AI uses these automatically — you don't call them directly.
258
+
259
+ **Read tools** (auto-approved, run silently):
260
+
261
+ | Tool | Description |
262
+ |------|-------------|
263
+ | `read_file` | Read file with line numbers |
264
+ | `list_directory` | List files and folders |
265
+ | `search_files` | Grep for text across files |
266
+ | `find_files` | Find files by glob pattern |
267
+ | `git_status` | Show modified/staged/untracked |
268
+ | `git_diff` | Show diffs |
269
+ | `git_log` | Commit history |
270
+ | `git_branch` | List/create/switch branches |
271
+
272
+ **Write tools** (require approval):
273
+
274
+ | Tool | Description |
275
+ |------|-------------|
276
+ | `write_file` | Create or overwrite a file |
277
+ | `edit_file` | Find-and-replace with diff view |
278
+ | `run_command` | Execute shell command (non-blocking) |
279
+ | `git_commit` | Stage and commit |
280
+ | `create_plan` | Create a step-by-step plan for complex tasks |
281
+
282
+ ---
283
+
284
+ ## Configuration
285
+
286
+ Config file: `~/.gemi/config.yaml`
287
+
288
+ ```yaml
289
+ default_provider: gemini
290
+ default_model: gemini-2.5-flash
291
+
292
+ rotation:
293
+ strategy: failover # failover | round-robin | least-used
294
+ auto_switch_provider: true
295
+ provider_priority:
296
+ - gemini
297
+ - groq
298
+ - deepseek
299
+ - openrouter
300
+ - cerebras
301
+ - mistral
302
+ - together
303
+ - openai
304
+ - ollama
305
+
306
+ agent:
307
+ max_iterations: 50
308
+ auto_approve_reads: true
309
+ auto_approve_writes: false # set true to skip approval prompts
310
+ ```
311
+
312
+ ```bash
313
+ gemi config set default_model gemini-2.5-pro
314
+ gemi config set rotation.strategy round-robin
315
+ gemi config set agent.auto_approve_writes true
316
+ ```
317
+
318
+ ---
319
+
320
+ ## Free Tier Rate Limits
321
+
322
+ ### Google Gemini
323
+
324
+ | Model | RPM | RPD | TPM | Context |
325
+ |---|---|---|---|---|
326
+ | `gemini-2.5-flash` | 10 | 250 | 250,000 | 1M |
327
+ | `gemini-2.5-flash-lite` | 15 | 1,000 | 250,000 | 1M |
328
+ | `gemini-2.5-pro` | 5 | 100 | 250,000 | 1M |
329
+
330
+ ### Groq
331
+
332
+ | Model | RPM | RPD | TPM | Context |
333
+ |---|---|---|---|---|
334
+ | `llama-3.3-70b-versatile` | 30 | 1,000 | 12,000 | 128K |
335
+ | `llama-3.1-8b-instant` | 30 | 14,400 | 6,000 | 128K |
336
+ | `meta-llama/llama-4-scout-17b-16e-instruct` | 30 | 1,000 | 30,000 | 128K |
337
+
338
+ ### OpenRouter (Free Models)
339
+
340
+ 27+ free models. IDs end with `:free`. Key highlights:
341
+
342
+ | Model | Context |
343
+ |---|---|
344
+ | `nvidia/nemotron-3-ultra-550b-a55b:free` | 1M |
345
+ | `qwen/qwen3-coder:free` | 1M |
346
+ | `google/gemma-4-31b-it:free` | 262K |
347
+ | `meta-llama/llama-3.3-70b-instruct:free` | 128K |
348
+
349
+ ### Others
350
+
351
+ | Provider | Key Limits | Notes |
352
+ |---|---|---|
353
+ | **Mistral** | 2 RPM, 1B tokens/month | Slow RPM, huge monthly budget |
354
+ | **Cerebras** | 5-30 RPM, 1M tokens/day | Fastest inference (~2,600 tok/s) |
355
+ | **Ollama** | Unlimited | Local, no internet needed |
356
+
357
+ ### Best Free Models for Coding
358
+
359
+ | Use Case | Best Option | Why |
360
+ |---|---|---|
361
+ | Daily driver | Gemini 2.5 Flash | 1M context, strong tool calling |
362
+ | Fast responses | Groq Llama 3.3 70B | ~300 tokens/sec |
363
+ | Largest model | OpenRouter Nemotron Ultra 550B | 550B params, free |
364
+ | Most requests | Groq Llama 3.1 8B | 14,400 RPD |
365
+ | Most tokens/month | Mistral Codestral | 1B tokens/month, code-focused |
366
+ | Unlimited local | Ollama Qwen 3 | No limits, best tool calling |
367
+
368
+ ---
369
+
370
+ ## Context & Switching
371
+
372
+ **Context is 100% preserved when switching keys or providers.** Conversation history lives in gemi's memory, not on any server. When a key or provider switches mid-task, the full context is sent to the new endpoint.
373
+
374
+ When switching to a smaller model, gemi auto-trims old messages to fit. Recent messages are always kept.
375
+
376
+ ---
377
+
378
+ ## Project Context File
379
+
380
+ Create `.gemi.md` in your project root:
381
+
382
+ ```markdown
383
+ # My Project
384
+
385
+ FastAPI backend with PostgreSQL.
386
+
387
+ ## Stack
388
+ - Python 3.12, FastAPI, SQLAlchemy
389
+ - pytest for testing
390
+
391
+ ## Conventions
392
+ - snake_case everywhere
393
+ - Routes in app/routes/
394
+ - Models in app/models/
395
+ - Run tests: pytest -v
396
+ ```
397
+
398
+ gemi reads this on startup and follows your project's rules.
399
+
400
+ ---
401
+
402
+ ## Sessions
403
+
404
+ ```bash
405
+ gemi # auto-generates session ID
406
+ gemi sessions # list saved sessions
407
+ gemi --resume a3f8b2c1 # resume a session
408
+ ```
409
+
410
+ Sessions are stored at `~/.gemi/sessions/` as JSON.
411
+
412
+ ---
413
+
414
+ ## vs Other Tools
415
+
416
+ | Feature | gemi | Claude Code | Gemini CLI | Cursor |
417
+ |---|---|---|---|---|
418
+ | Free | Yes | No ($20/mo) | Yes | No ($20/mo) |
419
+ | Multi-account rotation | Yes | No | No | No |
420
+ | Multi-provider failover | Yes (9) | No | No | No |
421
+ | Local model fallback | Yes (Ollama) | No | No | No |
422
+ | Key usage tracking | Yes | No | No | No |
423
+ | Plan mode | Yes | Yes | No | Yes |
424
+ | Open source | Yes | Yes | Yes | No |
425
+ | Install | `pip` / `pipx` | `npm` | `npx` | App |
426
+
427
+ ---
428
+
429
+ ## Roadmap
430
+
431
+ ### Built (v0.1.0)
432
+
433
+ - [x] 13 agent tools (files, git, shell, search, planning)
434
+ - [x] 9 pre-configured providers
435
+ - [x] Multi-account key rotation & failover
436
+ - [x] Plan mode (auto-detect complex tasks)
437
+ - [x] Non-blocking command execution
438
+ - [x] Session persistence & resume
439
+ - [x] Context compaction & auto-trim
440
+ - [x] Diff view + undo
441
+ - [x] `.gemi.md` project context
442
+ - [x] Encrypted key storage
443
+
444
+ ### Planned
445
+
446
+ - [ ] Tab completion (commands, paths, models)
447
+ - [ ] Multi-line input (paste code blocks)
448
+ - [ ] Image/screenshot reading (Gemini vision)
449
+ - [ ] Web search tool
450
+ - [ ] Memory system (cross-session preferences)
451
+ - [ ] MCP server support
452
+ - [ ] VS Code extension
453
+
454
+ ---
455
+
456
+ ## License
457
+
458
+ MIT
459
+
460
+ ---
461
+
462
+ **Built by [a79.ai](https://a79.ai)** — [GitHub](https://github.com/parteekahlawat/gemi-cli) • [Issues](https://github.com/parteekahlawat/gemi-cli/issues)
@@ -0,0 +1,22 @@
1
+ gemi/__init__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
2
+ gemi/compaction.py,sha256=6Je-y0DS1ieQOs1MgkllSQrtHm__ygWmueGQE5SzNdE,2308
3
+ gemi/config.py,sha256=8crsRWI4DPtQ4HknBn77tdmDWB576E5DCx-TzKt8qkI,1418
4
+ gemi/main.py,sha256=ZgcVrN9lgLasRYDDWFgAF9_XWqcuo6OTqSS7gNBV7Qo,15392
5
+ gemi/registry.py,sha256=4leqvw6C8OUCm0Tit18CbFIzpg4agOdEdBKwzxXwTBg,5887
6
+ gemi/sessions.py,sha256=GEZDisBQzEnDUEi6KzR9noVKNKErbo-3PCsF0U2ArhE,2431
7
+ gemi/ui.py,sha256=Uj9zGdSVoh2ufkku4mi3YlvW5XQzQ4YW9D5BLIiVS9Q,13402
8
+ gemi/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ gemi/agent/loop.py,sha256=fj1slkRkAiKt4M4LIhrpdg_tjU5PXczdIgohzxi_xkM,27503
10
+ gemi/agent/tools.py,sha256=bOCyY57Sf5KhDHjHmRjzhYtIrmAWNs4epbtxAAsYw2g,19020
11
+ gemi/keys/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ gemi/keys/manager.py,sha256=GWQMVfMcUMLQKApIDl7lOkJmWlheSlrHBHXlBQv3FYg,9294
13
+ gemi/keys/store.py,sha256=U9jhOn7J2b8NL8JR0DAm4nL6Azl-mJhFl9-i39MbYxw,2385
14
+ gemi/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ gemi/providers/base.py,sha256=aLceAjPhmbr-C6UcwfczbBdnOdnZj8g67Ggihf296T0,790
16
+ gemi/providers/gemini.py,sha256=nmqix1MwmSKwhTjZUpBiuN-nDXD7JV6Acqwsf7unOoA,5170
17
+ gemi/providers/ollama.py,sha256=PQHm0cSOZQQ4h5O7_DniM6Tw2Nxk-_kMyGLnguqjPfo,2505
18
+ gemi/providers/openai_compat.py,sha256=18XpqejlSQK3Jtufor0_ITkLRatjFza_wOsPZMycPzU,5551
19
+ gemi_cli-0.1.0.dist-info/METADATA,sha256=kHteyrwCfYtdXO9vy7Xb9q3BZBNYoIuG4Q5oyrDLCWk,13765
20
+ gemi_cli-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
21
+ gemi_cli-0.1.0.dist-info/entry_points.txt,sha256=ae7uOmr9w_-JBwc-RYZDoyP0D4Yu9wK6Wicsio7CV4o,39
22
+ gemi_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ gemi = gemi.main:app