Developer Tools
Gemini CLI Usage Guide
Forward Gemini CLI native requests to Magick API via environment variables and set the default model
Gemini CLI uses the native Gemini protocol. When connecting to Magick API, the key is to configure the Gemini CLI gateway address, API Key, and default model in environment variables.
Option 1 (Recommended): Set environment variables directly
Currently, it is recommended to connect Gemini CLI directly via environment variables, and usually no additional configuration file editing is required.
Mac/Linux
export GOOGLE_GEMINI_BASE_URL="https://api.magickapi.com"
export GEMINI_API_KEY="API key generated from the dashboard"
export GEMINI_MODEL="gemini-3.1-pro-preview"Windows CMD
set GOOGLE_GEMINI_BASE_URL=https://api.magickapi.com
set GEMINI_API_KEY=API key generated from the dashboard
set GEMINI_MODEL=gemini-3.1-pro-previewPowerShell
$env:GOOGLE_GEMINI_BASE_URL="https://api.magickapi.com"
$env:GEMINI_API_KEY="API key generated from the dashboard"
$env:GEMINI_MODEL="gemini-3.1-pro-preview"Starting Gemini CLI
After executing the above three commands, navigate to your project directory and simply run:
geminiNotes
GEMINI_API_KEYshould be filled with the API key generated from the Magick API dashboardGOOGLE_GEMINI_BASE_URLis fixed tohttps://api.magickapi.comGEMINI_MODELcan serve as the default model for Gemini CLI; the example value provided here isgemini-3.1-pro-preview- If you need to view the request path and request body format of the Gemini native API, you can continue to refer to "General Models / Gemini Native Format"
Last updated on