Vấn đề
Khi làm việc với codebase lớn, một trong những frustration lớn nhất với AI coding tools là context window limits. Bạn phải chia nhỏ codebase, feed từng phần, hoặc chọn lọc context — và AI có thể miss important relationships giữa files.
Và nếu bạn không muốn trả $100-200/tháng cho Claude Code Max just để có được extended context?
Gemini CLI giải quyết cả hai vấn đề: massive context window, và $0 price tag.
Gemini CLI là gì?
Gemini CLI là official terminal agent từ Google, được release như một phần của Gemini ecosystem. Nó chạy trực tiếp trong terminal của bạn và sử dụng Gemini 2.5 Pro làm model underlying.
Đặc điểm nổi bật
1. 1M Token Context Window
Con số này không phải marketing — đây là thực. Gemini 2.5 Pro's 1M token context cho phép bạn:
- Feed entire monorepo vào một prompt
- Xử lý codebase với hàng trăm files mà không mất context
- Hỏi questions about entire system architecture
- Yêu cầu multi-file refactors trong một command
# Đọc entire codebase và hỏi về architecture
gemini "Explain the architecture of this monorepo. What are the main modules and their dependencies?"
# Multi-file refactor
gemini "Convert all class components to functional components with hooks in the frontend/ directory"
2. Free Tier Generous
| Plan | Requests/day | Model |
|---|---|---|
| Free | 1,000 | Gemini 2.5 Pro |
| Paid | Unlimited | Gemini 2.5 Pro + Flash |
1,000 requests/ngày là rất nhiều cho developer cá nhân. Bạn có thể chạy vài chục complex tasks mỗi ngày mà không hết quota.
3. Native Google Ecosystem Integration
Nếu bạn đã dùng Google AI services, Gemini CLI integrate tốt với:
- Google Cloud projects
- Gemini API keys (cùng key bạn dùng cho Gemini in other places)
- Google Workspace context
So sánh: Gemini CLI vs Claude Code
| Tiêu chí | Gemini CLI | Claude Code |
|---|---|---|
| Giá | Miễn phí (1,000 req/day) | $20-200/tháng |
| Context window | 1M tokens | 200K tokens |
| Model | Gemini 2.5 Pro | Claude Opus/Sonnet |
| Git integration | Basic | Advanced |
| CI/CD integration | Via API | Native GitHub Actions |
| Complex refactor accuracy | 70-80% | 90%+ |
Gemini CLI thắng ở:
- Context window (5x lớn hơn)
- Giá (miễn phí vs đắt đỏ)
- Best cho: huge codebase ingestion, quick tasks
Claude Code thắng ở:
- Accuracy trên complex tasks
- Git workflow integration
- Production-grade reliability
Khi nào nên dùng Gemini CLI
Phù hợp nhất cho:
1. Huge Codebase Exploration
Khi join một project mới hoặc cần understand một hệ thống phức tạp, Gemini CLI's 1M token cho phép bạn ask questions about entire codebase in one shot.
# Map ra architecture của hệ thống 500-file
gemini "Create a diagram of the module dependencies in this codebase"
# Find all places where a specific API is called
gemini "Find every file that calls the /api/users endpoint"
2. Quick Code Generation Tasks
Khi bạn cần generate boilerplate, simple scripts, hoặc quick fixes và không muốn mở IDE.
3. Learning New Codebases
New team member onboarding — feed them entire codebase vào Gemini CLI và let them explore.
Không phù hợp khi:
- Bạn cần production-grade reliability (Claude Code's 90%+ accuracy matter)
- Bạn đang làm việc với proprietary code cần privacy (check Google's data policy)
- Bạn cần deep git integration (Claude Code better)
Setup và sử dụng
# Cài đặt qua npm
npm install -g @google/gemini-cli
# Authenticate
gemini auth
# Bắt đầu session
gemini
# Hoặc one-shot command
gemini "refactor this function to be async"
Thực tế từ dự án BKGlobal
Chúng tôi đã dùng Gemini CLI trong vài scenarios:
Khi nào hiệu quả:
- Onboarding new team members — "explain this entire backend"
- Architecture review — "map dependencies of our 200-service monorepo"
- Quick code generation — "write a script to generate test data"
Khi nào không đủ:
- Complex refactors touching 10+ files
- Production code cần 100% accuracy
- Tasks require deep understanding of business logic
Strategy của team: Dùng Gemini CLI như complementary tool bên cạnh Claude Code. Cùng nhau, chúng cover hầu hết use cases với cost-effective approach.
Takeaway
Gemini CLI là best free terminal agent in 2026. Với 1M token context và 1,000 daily requests miễn phí, đây là tool không có lý do để skip nếu bạn muốn explore large codebases hoặc cần quick AI assistance không có price tag.
Dùng khi:
- Codebase > 200 files
- Ngân sách hạn chế
- Quick exploration tasks
Pair với Claude Code cho complex production work.
Son Do — BKGlobal Tech Team