Gemini CLI Integration
AVELIN API works with Gemini CLI — Google's open-source terminal AI coding tool. While Gemini CLI is designed for Google's Gemini models, it supports custom OpenAI-compatible endpoints, letting you bring AVELIN's frontier coding models into the same powerful terminal workflow.
Why AVELIN + Gemini CLI? Get the best of both worlds: Gemini CLI's multi-modal terminal experience and native Google integrations, paired with AVELIN's coding-optimized models, 1M-token context windows, 90% prompt caching, and automatic failover.
What is Gemini CLI?
Gemini CLI is Google's open-source AI coding assistant that runs directly in your terminal. Its killer feature is the combination of a free tier with Gemini models and BYOK (Bring Your Own Key) support for any OpenAI-compatible API — plus native Google integrations for Search, Maps, and more. It also supports multi-modal input, letting you analyze images and screenshots right from the terminal.
Gemini CLI is ideal for developers who want a Google-backed terminal coding tool with the flexibility to use any model provider. It's particularly useful for teams already in the Google ecosystem who want AI coding assistance without leaving the command line.
Quick Setup
Step 1: Get your AVELIN API key
Sign up at avelin.ai and generate an API key. It will look like sk-ave...xxxx.
Step 2: Install Gemini CLI
# Install via npm npm install -g @google/gemini-cli # Or via Google's installer npx @google/gemini-cli # Verify installation gemini --version
Step 3: Configure Gemini CLI for AVELIN
Gemini CLI supports custom OpenAI-compatible endpoints. Set up AVELIN via environment variables:
# Point Gemini CLI to AVELIN's OpenAI-compatible endpoint export OPENAI_API_BASE=https://api.avelin.ai/v1 export OPENAI_API_KEY=sk-avelin-YOUR_KEY
Or configure via the settings file at ~/.gemini/settings.json:
{ "model": "avelin-coding-pro", "providers": { "avelin": { "type": "openai-compatible", "baseUrl": "https://api.avelin.ai/v1", "apiKey": "sk-ave...xxxx" } } }
Step 4: Start Gemini CLI
# Start an interactive session with AVELIN gemini # Or run a single prompt gemini -p "Explain the authentication flow in this codebase"
Recommended Models
Primary Recommendation: avelin-coding-pro
For coding tasks in Gemini CLI:
Alternative Models
Why AVELIN for Gemini CLI?
1. Beyond Gemini Models
While Gemini CLI is built for Google's models, AVELIN gives you access to a broader range of frontier coding models optimized specifically for software engineering tasks — through the same familiar interface.
2. Cost Optimization
- Prompt caching: ~80% cost reduction on repeated system prompts
- Competitive pricing: Lower per-token costs than direct provider APIs
- Pay-per-token: No subscription lock-in — pay only for what you use
3. 1M Context Windows
Gemini CLI sessions benefit from large context windows when analyzing codebases. AVELIN's 1M-token context means you can load entire repositories and work across many files without context loss.
4. Automatic Failover
- Provider failover: If one backend is slow or down, AVELIN switches to another
- Retry logic: Transient errors handled automatically
- 99.9% uptime: Enterprise-grade infrastructure — no interrupted sessions
Example Session
$ gemini ╭─ Gemini CLI ─────────────────────────────────────╮ │ Model: avelin-coding-pro (via AVELIN) │ │ Provider: AVELIN (api.avelin.ai) │ ╰──────────────────────────────────────────────────╯ You> Analyze the database schema in this project and suggest optimizations for query performance. Gemini CLI> Let me examine your database schema and query patterns... [Reads migrations/, models/, queries/] I found 3 potential performance issues: 1. Missing index on users.email — used in 4 queries 2. N+1 query pattern in OrderService.getAllWithItems() 3. Unindexed foreign key on order_items.order_id Here are the optimizations: [Creates migration: add_users_email_index.sql] [Refactors OrderService to use eager loading] [Creates migration: add_order_items_fk_index.sql] Want me to run the migrations?
Using Google's Free Tier + AVELIN
Gemini CLI offers a free tier with Google's Gemini models. You can use both:
- Free Gemini models for quick questions and simple tasks
- AVELIN models for complex coding, large context, and production workloads
Switch between them by updating your configuration or environment variables as needed.
Troubleshooting
Related
- API Quickstart — First API call in 5 minutes
- Hermes Agent Guide — Terminal-based agentic coding tool
- Claude Code Guide — Anthropic's CLI coding tool
- Aider Guide — AI pair programming in the terminal
- Model Catalog — Full model comparison
- Gemini CLI GitHub — Official Gemini CLI repository