Gemini CLI gateway · live

Run Gemini CLI through WandAPI with two environment variables

WandAPI natively supports the generateContent / streamGenerateContent protocol Gemini CLI uses: 14 Google models, automatic failover when the official endpoint returns 429 or 503. Alipay top-ups, pay as you go, no monthly fee.

First frame forwarded · no buffering14 Google modelsUp to 69% below list price
# ~/.zshrc / ~/.bashrc
export GOOGLE_GEMINI_BASE_URL="https://api.wandapi.com"
export GEMINI_API_KEY="sk-sole-..."

gemini -m gemini-4-argon
✔ Connected to api.wandapi.com · model gemini-4-argon

Why a gateway instead of the official endpoint

Not a replacement for Google — a layer on top: reliability, payment and billing, three things the vendor does not solve for you.

Automatic failover on 5xx / rate limits

Each model has several upstream channels. When Google returns 500, overloaded or rate-limited, the gateway switches to a backup before the first frame, so Gemini CLI never sees the error.

Alipay top-ups, pay as you go

No overseas card, no subscription. 1 Credit = ¥1, billed per use; spend is split per model and per key in the console.

Native protocol, zero-buffer streaming

Gemini generateContent passes straight through with no translation; every SSE frame is forwarded as it arrives, so Gemini CLI streams exactly like a direct connection.

Connect Gemini CLI in three steps

Three steps, no changes to Gemini CLI itself.

STEP 01

Sign up for free credits

Register with an email and receive trial Credits — enough to wire up a real project.

STEP 02

Create an API key

Console → API Keys → New. Give the key a budget, restrict models or channels if you like.

STEP 03

Point at WandAPI and start Gemini CLI

Swap the base URL for WandAPI and the key for the one you just created; everything else stays.

# ~/.zshrc / ~/.bashrc
export GOOGLE_GEMINI_BASE_URL="https://api.wandapi.com"
export GEMINI_API_KEY="sk-sole-..."

gemini -m gemini-4-argon

Models and pricing for Gemini CLI

WandAPI default channel price in Credits (1 Credit = ¥1); struck-through is the list price. Click a model for full pricing, protocols and uptime.

ModelContextInput (prompt) / MOutput (completion) / M7-day uptime
Gemini 3.1 Flash-Lite Imagegemini-3.1-flash-lite-image—$0.250.569% off$1.503—
Gemini 3.5 Flash-Litegemini-3.5-flash-lite1M$0.250.569% off$1.503—
Gemini 2.5 Flash Imagegemini-2.5-flash-image64K$0.30.669% off$2.505—
Gemini 3.1 Flash Imagegemini-3.1-flash-image128K$0.5169% off$3.006—
Gemini 3.8 Flash-Lite TTSgemini-3.8-flash-lite-tts8K$0.5169% off——
Gemini 3.8 Flash TTSgemini-3.8-flash-tts8K$0.5169% off——

Same data as the model catalog, refreshed every 5 minutes. All 14 Google models →

Common Gemini CLI errors and how the gateway handles them

These errors come from the official Google API. Through WandAPI the gateway retries and fails over before the first frame, so Gemini CLI usually never shows them.

429 RESOURCE_EXHAUSTED

Official quota hit

The free tier ran out of requests per minute / day, or a paid project hit its RPM cap. WandAPI: several upstream keys share the quota; when one returns 429 the next takes over.

503 UNAVAILABLE: The model is overloaded

Official overload

Google sheds load at peak times. WandAPI: channels are scheduled by health; an overloaded channel is demoted and requests go to a healthy one.

400 API key not valid

Key does not match the base URL

The base URL points at WandAPI but the key is still from AI Studio, or vice versa. WandAPI: base URL and key come as a pair — api.wandapi.com goes with a key starting with sk-sole-.

Request timed out

No response for too long

The official side never sent the first frame. WandAPI: a timeout before the first frame is retried on another channel; after it, every frame is forwarded as it arrives, unbuffered.

FAQ

Is a Gemini CLI gateway safe? Can anyone see my code?

Keys, emails and other sensitive strings are masked before forwarding; transport is encrypted end to end; your requests are never used to train any model. Keys can be limited to models and budgets and revoked in one click.

How is this different from calling Google directly?

Same protocol (generateContent passed through natively), same models, plus three things: automatic failover when the official API fails, Alipay top-ups with CNY billing, and per-key usage and budget control.

Does it work with Claude Code and Codex too?

Yes. Anthropic Messages and OpenAI Responses are supported as well — point each tool at the WandAPI base URL. All tools share one API key and one balance.

How do I top up, and is there a minimum?

Console → Wallet, Alipay accepted; 1 Credit = ¥1, billed per use, no monthly fee or minimum. You get an email before the balance runs out.

Two environment variables and Gemini CLI runs reliably

Free credits on sign-up, pay as you go, no monthly fee.

Get an API Key