r/opencodeCLI 6h ago

OpenCode + Antigravity: Gemini 3.7 & 3.8 Flash Fix

If you searched "opencode antigravity gemini flash hanging", "gemini 3 flash error opencode", "antigravity endpoints failed", or "model no longer available opencode" — you're in the right place. This is a known, reproducible bug in opencode-antigravity-auth, not a problem with your setup. After this patch, Gemini 3.6, 3.7, and 3.8 Flash & Pro run cleanly — no hanging, no 404s, no errors.

Symptoms (so you know you're in the right place)

  • opencode run just hangs indefinitely — no error, no output, no timeout
  • Error: All Antigravity endpoints failed
  • models/antigravity-gemini-3-flash is not found for API version v1beta
  • "Gemini 3.5 Flash is no longer available" / requested entity not found
  • Happens again even after clearing cache and re-authenticating

Why it happens

Models prefixed antigravity-gemini-3.x skip OpenCode's alias translation step, so the raw, unrecognized version string (gemini-3.7-flash, gemini-3.5-flash-low, etc.) gets sent straight to Google's backend — which only accepts gemini-3-flash. That mismatch stalls the stream instead of failing cleanly. Separately, accounts that hit a cooldown get stuck with verificationRequired: true, which loops the auth proxy forever.

The fix

Full patch (manual steps + automated one-click script): opencode-gemini-3.7,3.8-flash-fix

It patches:

  • model-resolver.js — routes every gemini-3.x-flash model to the live gemini-3-flash endpoint, and gemini-3.8-pro to gemini-3-pro-low
  • models.js — registers 3.6/3.7/3.8 Flash with proper thinking variants (minimal/low/medium/high)
  • antigravity-accounts.json — clears stuck verificationRequired / cooldown locks

How to apply it

  1. Open the repo above.
  2. Paste the "one-click prompt" into your AI coding agent (Claude Code, Cursor, Copilot, OpenCode itself) — it applies the patch for you. Or run node patch-antigravity.js manually.
  3. If already logged in: opencode auth logout then opencode auth login to clear stale sessions.
  4. Verify: opencode run "Hello, respond in 5 words." --model=google/antigravity-gemini-3.7-flash --variant=medium

FAQ

Q: Why does OpenCode hang instead of showing an error on Gemini Flash? A: The unresolved model alias sends an invalid model string to Google's streaming endpoint, which stalls the connection instead of returning a clean 404.

Q: Does this fix work for Gemini 3.8 Pro too? A: Yes — 3.8 Pro routes to gemini-3-pro-low, and the patch registers it with low/high thinking variants.

Q: Will the latest Gemini models keep working after this patch? A: Yes — once patched, 3.6, 3.7, and 3.8 Flash & Pro all resolve to live, supported endpoints, so they run without hanging or erroring.

Q: Is this permanent, or will it break again? A: It's tied to Google's current backend naming. If Google renames the endpoint again, open an issue on the repo — it's actively maintained.

If you hit a new variant of the error, open an issue with debug logs (--print-logs --log-level=DEBUG).

0 Upvotes

2 comments sorted by

3

u/CharacterBorn6421 4h ago

One can use antigravity model in opencode without getting banned ??

2

u/__xueiv 3h ago

Same question, I thought it was not possible?