Introduction
Gemini CLI is Google’s official command-line tool that allows developers to interact with Gemini AI models through the terminal. By configuring APIMart API, you can use various advanced AI models provided by APIMart in Gemini CLI, including GPT, Claude, and Gemini series.Prerequisites
Before getting started, ensure you have:-
Node.js and npm installed
Download and install from Node.js official website (v16 or higher recommended) -
APIMart API Key
Log in to APIMart Console to obtain your API key (starts withsk-)
Tip: If you don’t have an APIMart account yet, register at APIMart first and obtain an API key.
Step 1: Install Gemini CLI
1.1 Global Installation
Install Gemini CLI globally using npm:1.2 Verify Installation
Check if the installation was successful:Step 2: Configure APIMart API
2.1 Temporary Environment Variables
For testing or one-time use, expires when terminal is closed: Windows (PowerShell):2.2 Permanent Environment Variables (Recommended)
Write configuration to system, automatically applies on every terminal session: Windows (PowerShell):- Run PowerShell as Administrator
- Execute the following commands to set user-level environment variables:
- Restart PowerShell or execute the following commands to refresh environment variables:
- Edit the configuration file (choose based on your shell):
- Add the following at the end of the file:
- Save the file and reload configuration:
2.3 Using .env File
Create a.env file in your project directory:
Important:
- Replace
sk-xxxxxxxxxxxxwith your actual API key from APIMart Console - Set
GEMINI_BASE_URLtohttps://api.apimart.ai/v1to ensure Gemini CLI connects to APIMart - If using
.envfile, add it to.gitignoreto avoid exposing your API key
2.4 Verify Configuration
Check if environment variables are set correctly: macOS/Linux:Step 3: Start Using Gemini CLI
3.1 Basic Conversation
Start interactive conversation:3.2 Specify Model
Chat with a specific model:Step 4: Using APIMart API with Code
2.1 Using Python SDK
2.2 Using JavaScript/TypeScript
2.3 Using cURL
Step 3: Choose the Right Model
Recommended Models
Gemini Series:| Model Name | Model ID | Features | Use Cases |
|---|---|---|---|
| Gemini 2.0 Flash | gemini-2.0-flash-exp | Fast, multimodal | Quick response, image understanding |
| Gemini 2.5 Pro | gemini-2.5-pro | Powerful performance | Complex tasks, professional analysis |
| Gemini 2.5 Flash | gemini-2.5-flash | High-speed response | Real-time interaction, batch processing |
| Model Name | Model ID | Features | Use Cases |
|---|---|---|---|
| GPT-5 | gpt-5 | Latest and strongest | Complex reasoning, creative writing |
| GPT-4o | gpt-4o | High quality | Daily conversation, content generation |
| GPT-4o Mini | gpt-4o-mini | Cost-effective | Simple tasks, high-frequency use |
| Model Name | Model ID | Features | Use Cases |
|---|---|---|---|
| Claude Sonnet 4.5 | claude-sonnet-4-5-20250929 | Strong reasoning | Code generation, logical analysis |
| Claude Haiku 4.5 | claude-haiku-4-5-20251001 | Extremely fast | Quick Q&A, real-time chat |
Advanced Features
Multimodal Support
Streaming Output
FAQ
Q1: How to verify API configuration?
Q2: Supported Programming Languages?
APIMart API supports all programming languages that can send HTTP requests:- ✅ Python - Recommended with OpenAI SDK
- ✅ JavaScript/TypeScript - Node.js and browser
- ✅ Java - HTTP client
- ✅ Go - Standard library or third-party packages
- ✅ PHP - cURL or Guzzle
- ✅ Ruby - HTTP library
- ✅ C#/.NET - HttpClient
- ✅ Swift - URLSession
- ✅ Other languages - Any language supporting HTTP
Features
Using Google AI Studio + APIMart, you can:- 🤖 Multi-model Support - Access GPT, Claude, Gemini, and more
- 🌍 OpenAI Compatible - Standard OpenAI API format
- ⚡ High Performance - Low latency, high concurrency
- 💰 Transparent Pricing - Clear pay-as-you-go pricing
- 📊 Usage Monitoring - Real-time API call tracking
- 🔒 Secure & Reliable - Enterprise-grade security
- 🚀 Quick Integration - Simple API calls
- 📚 Complete Documentation - Detailed development docs and examples
Support & Help
If you encounter any issues:- 📚 APIMart Documentation
- 📚 Google AI Studio Documentation
- 💬 Discord Community
- 🐦 Twitter @APIMart_
- 📧 Technical Support: zhihong@apimart.ai
Get Started with APIMart
Sign up for APIMart now, get your API key, and use multiple AI models in Google AI Studio!