Using BeatAPI in Gemini CLI
Using BeatAPI in Gemini CLI
Gemini CLI is a terminal client for the Gemini models. It speaks the native Gemini protocol — POST /v1beta/models/{model}:generateContent — which BeatAPI serves directly, so redirecting it is a base-URL change with no translation layer in between.
The base URL has to speak the native Gemini protocol. An OpenAI-compatible endpoint will not work here, because the CLI addresses models as {base}/v1beta/models/{model}:{action} rather than /chat/completions. https://api.beatapi.io is the native address; use it exactly, with no path suffix.
Prerequisites
- Node.js and npm — v16 or newer.
- A BeatAPI API key — create one in Dashboard → API Keys.
Step 1: Install Gemini CLI
Confirm the install:
If the command is not found, restart the terminal or check your npm global PATH.
Step 2: Point it at BeatAPI
Two variables do the whole job.
Persistent (recommended)
macOS (zsh)
Linux (bash)
Windows (PowerShell)
One terminal only
From a .env file
Add .env to .gitignore so the key is never committed.
Verify the values landed
Step 3: Use it
Interactive session:
One-shot prompt:
Pick a model explicitly:
Name the model explicitly rather than relying on whatever default the CLI ships with. A default that is not on your account produces a not_found, and pinning it also stops a CLI upgrade from silently moving you onto a different rate.
Models
Rates are on the pricing page; the Gemini API page documents the request shape.
Calling the same models from code
The Gemini-compatible endpoint is one of four formats BeatAPI serves, so you are not restricted to the native shape once you leave the CLI.
FAQ
Authentication errors
-
Confirm both variables are set in the terminal you launched
geminifrom: -
Confirm the key is active in Dashboard → API Keys.
404 on every request
GEMINI_BASE_URL must be https://api.beatapi.io — no /v1, no /v1beta, no trailing slash. The CLI appends the rest of the path itself; adding it yourself produces /v1/v1beta/models/..., which does not exist.
The model list is empty
Name the model with --model instead of picking from a list. The account’s models are also available from GET /v1/models and on the pricing page.
402 insufficient_credits
The balance is exhausted. Add credits from the dashboard.
429 rate_limit_exceeded
The key exceeded its request rate. Honour Retry-After. The per-minute allowance rises with lifetime top-ups and is shown on the dashboard.
Connection failures
Check general connectivity, then re-check GEMINI_BASE_URL for a typo. Behind a corporate proxy, allow api.beatapi.io.
Support
Open a support ticket from the dashboard and include the request_id from the failing response.

