Skip to content

Antigravity CLI: gateway legs reach models agy lists only through its model gateway - #95

Merged
Thykof merged 1 commit into
mainfrom
feat/agy-gateway
Nov 12, 2026
Merged

Thykof merged 1 commit into
mainfrom
feat/agy-gateway

Conversation

@Thykof

@Thykof Thykof commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

What

A new per-leg key, gateway: true, for antigravity-cli legs only.

  • Why it's needed: on the Gemini API-key route, agy checks --model against a list built into the CLI, and that list lags Google's. Gemini 4 Carbon is refused at launch with not recognized as a known model (agy 1.5.2 and 1.5.5).
  • What gateway mode changes: agy takes its model list from the gateway's GET /v1beta/models, and sends no credential of its own.
  • The relay: synth_lib/benchmark/agy_gateway.py is a stdlib-only relay, provisioned to ~/.agy-gateway.py in the leg's HOME.
    • The launch and resume commands start it on 127.0.0.1:4100, then exec agy: sh -c 'python3 "$HOME/.agy-gateway.py" && exec "$@"'. The prompt is passed as an argument, never inside the shell string.
    • It listens on localhost because agy accepts a plain-http gateway only there.
    • It adds the leg's virtual key as x-goog-api-key and streams each request to the proxy's /gemini passthrough, so spend stays metered per leg.
    • It passes upstream errors through, and answers 502 when the proxy can't be reached.
    • It logs non-200 requests only, to ~/.agy-gateway.log.
  • Validation: gateway on any other CLI is rejected at load.
  • Unchanged: legs without the key launch exactly as before.

Tested

  • pytest tests/benchmark: 244 passed. New tests cover:
    • the relay: key added, path and body kept, upstream 400 passed through, 502 when the proxy is down;
    • the adapter's command, env and provisioned files;
    • the campaign key.
  • End to end, run with the sandbox image against a LiteLLM proxy: the adapter's exact launch command with --model gemini-4-carbon --effort high exits 0. The answer comes from modelVersion: gemini-4-carbon, the request is metered under the leg's key, and nothing extra appears on stdout.

Note

Gateway mode exposes Google's whole model list, so agy's own sub-agents may pick a model other than the leg's. Any model they use needs a price in the proxy, or it meters at $0.

🤖 Generated with Claude Code

https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh

… model gateway

On the Gemini API-key route agy validates --model against a built-in list,
which lags Google's: a newer model (Gemini 4 Carbon) is refused at launch.
In model-gateway mode (AGY_LLM_GATEWAY_URL) agy takes its list from the
gateway's GET /v1beta/models instead, and sends no credential of its own.

A leg with `gateway: true` (antigravity-cli only) gets agy_gateway, a
stdlib relay written to ~/.agy-gateway.py. The launch and resume commands
start it on 127.0.0.1:4100 before exec'ing agy (agy accepts a plain-http
gateway only on localhost). It adds the leg's virtual key as
x-goog-api-key and streams each request to the proxy's /gemini
passthrough, so spend stays metered per leg; an unreachable proxy answers
502. Legs without the key are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@Thykof
Thykof merged commit 11fded2 into main Nov 12, 2026
4 checks passed
Thykof added a commit to synthdataco/autoquant that referenced this pull request Nov 12, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant