| name | antigravity-python-prompt |
| description | Send prompts directly to Google Antigravity (Gemini + Claude) via Python using OAuth refresh tokens, without OpenCode; includes correct headers, model ID normalization, endpoint selection, SSE streaming, and 429 backoff. |
Antigravity Python Prompt
[Created by Codex: 019ba92d-c995-77c0-b090-e9109492f53b]
Overview
Send prompts directly to Antigravity using Python (no OpenCode), with correct request envelope, headers, model naming, and streaming SSE parsing.
Quick Start
- Run the bundled script:
scripts/antigravity_prompt.py.
- Prefer
--quota gemini-cli for Gemini if Antigravity is 429, but Claude only works on Antigravity.
Copy/paste:
python ~/.codex/skills/antigravity-python-prompt/scripts/antigravity_prompt.py \
"Write a short story about programmers (~500 words)" \
--model gemini-3-pro --thinking high --quota gemini-cli
Workflow
1) Load credentials
- Read refresh tokens from
~/.config/opencode/antigravity-accounts.json (default), or pass --accounts-file.
- Select account with
--account-index (default 0).
2) Normalize model IDs
- Strip prefixes (
google/…, antigravity-…).
- Map common versioned Claude names (e.g.
claude-opus-4-20250514) to Antigravity model IDs.
3) Choose quota bucket + endpoints
- For Gemini:
--quota antigravity uses Antigravity header style and sandbox endpoints (may 429).
--quota gemini-cli uses Gemini CLI header style and production endpoint (often a separate quota pool).
--quota auto tries Antigravity first, then Gemini CLI.
- For Claude/GPT: only
--quota antigravity is valid.
4) Send request
- Build Antigravity request envelope:
- Top-level:
{ project, model, request, requestType, userAgent, requestId }
request.contents uses Gemini-style {role: "user"|"model", parts:[{text:"…"}]}.
- Inject
request.systemInstruction with Antigravity system instruction when using Antigravity header style (this matches OpenCode plugin behavior and avoids flaky Claude throttling).
5) Stream SSE
- Parse
data: {json} lines and print text deltas from candidates[].content.parts[].text.
6) Handle throttling
- On HTTP
429, apply exponential backoff (script supports --retry-on-429 and --max-backoff-seconds).
- No reliable “remaining quota” header exists; treat 429 as the signal.
Examples
Gemini 3 Pro (streaming, use Gemini CLI quota)
python ~/.codex/skills/antigravity-python-prompt/scripts/antigravity_prompt.py \
"Summarize this repo's purpose in 3 bullets." \
--model gemini-3-pro --thinking high --quota gemini-cli
Claude Opus (streaming, Antigravity only)
python ~/.codex/skills/antigravity-python-prompt/scripts/antigravity_prompt.py \
"Explain the difference between rate limit and capacity." \
--model claude-opus-4-20250514 --retry-on-429 12
Notes
- Avoid asking the model to run tools: this script is a raw LLM call, not an agent runtime.
- Prefer
--quota gemini-cli for Gemini workloads when Antigravity sandbox returns 429.