Gemini CLI

Use Gemini CLI through Aiduct.

Gemini CLI and the @google/genai SDK send Gemini generateContent requests to the base URL you set. Aiduct answers them at /v1beta with the same API key you use everywhere else.

GEMINI CLI ENV
export GOOGLE_GEMINI_BASE_URL=https://api.aiduct.ai
export GEMINI_API_KEY=sk-aiduct-...

gemini --model gemini-3.7-flash

ENV VAR

GOOGLE_GEMINI_BASE_URL

PROTOCOL

generateContent

ENDPOINT

/v1beta

The base URL is the gateway root

The Gemini SDK adds the /v1beta path itself, so set the root URL without a version path.

Any catalog model, not only Gemini

Gemini models are served natively. Other models are translated to and from generateContent, with function calls and thinking kept.

FAQ

Should GOOGLE_GEMINI_BASE_URL include /v1beta?+

No. Use https://api.aiduct.ai; the Gemini SDK adds /v1beta itself.

How does Gemini CLI send the Aiduct key?+

As the x-goog-api-key header, which Aiduct accepts like a bearer token.

Does Gemini's countTokens work?+

Yes. A model served natively is counted by its upstream; any other count is an estimate, marked by the x-aiduct-token-count: estimated header.