Gemini CLI Compatibility Note for CodeGateway

(Unofficial)

This guide is independently community-maintained. It is not affiliated with, endorsed by, or sponsored by the vendor of the third-party tool it covers. All third-party trademarks are the property of their respective owners.

Gemini CLI only speaks the Gemini-native protocol; here is why it cannot connect and two alternatives.

Bottom line

Gemini CLI cannot connect to CodeGateway directly.

Gemini CLI (Google's official open-source terminal agent, verified against 0.58.0) supports a custom upstream URL, but only the Gemini-native API protocol (e.g. generateContent endpoints). CodeGateway surfaces are Anthropic Messages and OpenAI-compatible protocols — there is no Gemini-native surface — so a direct connection is not possible.

Why

  • Gemini CLI's endpoint override is the env var GOOGLE_GEMINI_BASE_URL (with GEMINI_API_KEY), and the official config docs require the URL to serve the Gemini API protocol.

  • CodeGateway's surfaces: Anthropic Messages (/v1/messages), OpenAI Chat Completions (/v1/chat/completions), OpenAI Responses (/v1/responses). There is no :generateContent-style endpoint (verified: 404).

  • Important distinction: Gemini models in CodeGateway's catalog (e.g. gemini-3.8-flash) are usable — but through tools that speak the Anthropic Messages protocol (see below).

Alternative 1: You still want Gemini models

Use Claude Code against CodeGateway and switch the model to a Gemini-series one (gemini-3.8-flash is verified working on the Anthropic Messages protocol):

bash
export ANTHROPIC_BASE_URL="https://api.codegateway.dev"
export ANTHROPIC_AUTH_TOKEN="sk-cg-your-key"
# In ~/.claude/settings.json, set model to gemini-3.8-flash

Full steps: Claude Code one-line setup.

Alternative 2: You want a terminal coding agent

Pick a mainstream OpenAI-compatible tool and use CodeGateway's DeepSeek / Kimi / GLM / Qwen models:

Possible future changes

If CodeGateway adds a Gemini-native surface (or Gemini CLI adds an OpenAI/Anthropic-compatible provider mode), this page will be updated immediately.

FAQ

Q: Can I use Gemini models on CodeGateway? Yes. Gemini-series models work on the Anthropic Messages protocol (gemini-3.8-flash recommended) — just not via Gemini CLI itself.

Q: What happens if I point GOOGLE_GEMINI_BASE_URL at api.codegateway.dev? Requests hit a non-existent Gemini-native endpoint and fail (404 or protocol mismatch). Please don't.

Q: Are there community relay workarounds? Some communities reverse-proxy the Gemini protocol; the supported paths are the two alternatives above — they use CodeGateway's official surfaces with billing and troubleshooting in one place.

Q: Will Gemini CLI ever support OpenAI compatibility? No official statement so far. Watch this page for updates.

References

Turn this doc into a real API call

Lacking an official key or facing overseas card payment issues? Create an sk-cg- key after signing up, point your base URL at CodeGateway, and keep your existing SDK or CLI unchanged. Pay per token; binding a card adds free credit.

Sign up free
Author:CodeGateway Team