How to use Gemini CLI with a 5abeer API key
Install Gemini CLI, put the 5abeer base URL, your key and a model in ~/.gemini/.env, pick API key sign-in and run it on Gemini models from your balance.
On this page
- What you get
- Before you start
- With a subscription: the 5abeer AI app
- Manual setup
- Install Gemini CLI
- Add the settings
- Sign in with the API key
- Run it
- Pick a model
- If you get an error
- Questions
- Do I need a Google account?
- Why does Gemini CLI still ask me to sign in?
- Can I use Claude or GPT models in Gemini CLI?
- How is a request billed?
To use Gemini CLI with 5abeer, install Gemini CLI, then put three variables in ~/.gemini/.env: the 5abeer base URL, your 5abeer API key and a model. Choose API key sign-in, run gemini in your project and ask for anything. Every request is paid from your 5abeer balance. With a subscription, the 5abeer AI app does this setup for you.
What you get#
- Gemini CLI exactly as it ships, with its commands and settings.
- The Gemini models that support the Gemini format at 5abeer, below their official price.
- Usage and cost per key in your dashboard.
Before you start#
- A terminal on macOS, Linux or Windows.
Node.js20 or newer, if you install Gemini CLI withnpm.- An API key for Gemini models (create one).
With a subscription: the 5abeer AI app#
If you have a 5abeer subscription that includes Gemini, the 5abeer AI app sets Gemini CLI up on your subscription in one click, with no API key and no files to edit. The app runs on Mac, Windows and Linux; the steps are in How a subscription works. With an API key, follow the manual setup below.
Manual setup#
Install Gemini CLI#
npm install -g @google/gemini-cliAdd the settings#
Gemini CLI reads three variables from
~/.gemini/.env:GOOGLE_GEMINI_BASE_URLfor the base URL,GEMINI_API_KEYfor your key, andGEMINI_MODELfor the model. Put these values in it, replacingYOUR_5ABEER_API_KEYwith your key:GOOGLE_GEMINI_BASE_URL=https://api.5abeer.ai GEMINI_API_KEY=YOUR_5ABEER_API_KEY GEMINI_MODEL=gemini-4-argon~/.gemini/.env
Sign in with the API key#
Set the sign-in method to the API key in
~/.gemini/settings.json, or choose "Use Gemini API Key" when Gemini CLI asks on its first run:~/.gemini/settings.json{ "security": { "auth": { "selectedType": "gemini-api-key" } } }Run it#
Terminalcd your-project geminiOn the first run in a new folder, Gemini CLI may ask whether you trust it; agree so it reads the settings. Then ask for anything: if a reply comes back, you're set.
Pick a model#
Every model that supports the Gemini format at 5abeer runs in Gemini CLI. Each model's page in the models list shows the formats it supports; put the model id in GEMINI_MODEL.
If you get an error#
INVALID_API_KEY: the key is wrong or was copied only in part.MODEL_PLATFORM_NOT_ALLOWED: the key belongs to a provider other than Gemini.INSUFFICIENT_BALANCE: your balance doesn't cover this request.
Every code and what it means is in Errors and fixes.
Questions#
Do I need a Google account?#
No. With API key sign-in, Gemini CLI sends your 5abeer key from GEMINI_API_KEY to the 5abeer base URL, so you don't sign in with Google.
Why does Gemini CLI still ask me to sign in?#
The sign-in method isn't set to the API key yet. Add the settings.json block above, or choose "Use Gemini API Key" in the prompt, then run gemini again.
Can I use Claude or GPT models in Gemini CLI?#
No. Gemini CLI speaks only the Gemini format, so it runs the models that support that format at 5abeer, with a key for Gemini models.
How is a request billed?#
Each request is paid from your balance by the tokens it uses, at the model's 5abeer price. Details in Pricing and balance.
Was this page helpful?