Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
Gemini on an Antigravity subscription: shared keychain token, runtime client-secret extraction, live model discovery.
Extracted from
CLAUDE.md(v7.64.0). Indexed inREADME.md.
Antigravity Provider (ag@) — Gemini via your Antigravity subscription
Two separate Gemini flows, deliberately split:
| Flow | Prefix | Auth | Backend | Billing |
|---|---|---|---|---|
| Direct Gemini API | g@ / google@ |
GEMINI_API_KEY |
generativelanguage.googleapis.com |
pay-per-use |
| Antigravity | ag@ / antigravity@ |
your Antigravity OAuth token (shared with the agy CLI) |
daily-cloudcode-pa.googleapis.com/v1internal |
your Antigravity subscription (free / Pro / Ultra) |
The gemini-codeassist provider was fully REMOVED (v7.36.0) — definition, transport, credential provider, OAuth registration, quota adapter, probe entry, and the --gemini-login/--gemini-logout flags. It could not authenticate for any consumer account, yet it sat FIRST in the gemini-* routing chain, so every bare gemini-* name paid a guaranteed-failing round-trip before falling through to the metered google API — silently billing per-token for a model the user's subscription already covered. A leftover ~/.claudish/gemini-oauth.json no longer reads as a live credential (its oauth-registry.ts entries are gone), which is what kept a dead provider in the config TUI's Test All list.
Bare gemini-* reaches ag@ through a NAMESPACE CLAIM, not a routing table. The hand-written "gemini-*": ["antigravity", "google", "openrouter"] chain was deleted with the rest of default-routing-rules.ts. google/antigravity-subscription sits in the probe map as client_model_selection_required and publishes zero aggregators[] rows — the catalog cannot say what a seat was given — so the provider declares nativeModelPatterns: [{ pattern: /^gemini-/i }] and route-candidates.ts turns that into a dynamic-subscription-tier candidate, which the tier order puts ahead of the metered google hop. The claim deliberately does not win auto-detection (google declares the same pattern and is defined earlier in BUILTIN_PROVIDERS, and getNativeModelPatterns() is first-wins), and it deliberately does NOT cover /^claude-/i even though the backend serves Claude ids: a bare Claude name must never reach route() at all — nativeRouteFor() handles it first.
The Antigravity half of the old auth/gemini-oauth.ts was extracted to auth/antigravity-user.ts (project/tier resolution, retrieveUserQuota, live discovery of the account's dynamic models catalog) before that file was deleted — Antigravity depends on it, so deleting wholesale would have taken ag@ down too. All three calls now share ONE identity (the Antigravity User-Agent). retrieveUserQuota used to keep the gemini-cli UA it was written with; measured 2026-08-18 on a real Ultra account, same token and project, only the UA varying — the gemini-cli UA returned 4 quota buckets (the membership of the retired free Code Assist plan) and the Antigravity UA returned 24. This backend gates its ANSWER on request identity, not just the tier label it displays.
Why not just spoof the identity: the backend has two independent gates. loadCodeAssist gates the visible tier on request identity (User-Agent + metadata.ideType: ANTIGRAVITY), but streamGenerateContent gates generation on the OAuth client that minted the token — headers can't fake it (403 PERMISSION_DENIED). So claudish does not spoof; it reuses the user's own Antigravity token. A third gate sits on top of both: the client VERSION in the User-Agent decides which models exist at all — see The client version gates discovery AND generation.
THE HOST IS NOT cloudcode-pa (v7.66.0)
ag@ was built from the remains of the removed gemini-codeassist provider. The
token was swapped to Antigravity's; the HOST was kept, under a source comment
asserting "the split was never about the URL, it was about which OAuth client
minted the token." That assertion was wrong, and it cost a full debugging
session.
cloudcode-pa.googleapis.com is Code Assist's backend — the product Google
retired for individuals. Antigravity's own backend is
daily-cloudcode-pa.googleapis.com. Present an Antigravity token to the former
and you are answered as Code Assist.
Measured 2026-08-24 — one Google AI Ultra account, same token, same project, same model, only the host varying:
cloudcode-pa.googleapis.com generate gemini-3.6-flash-high -> 429
daily-cloudcode-pa.googleapis.com generate gemini-3.6-flash-high -> 200
On cloudcode-pa that account reads currentTier: free-tier (while paidTier
says g1-ultra-tier), is served a dynamic models catalog of gemini-2.5-* plus editor-internal
chat_*/tab_* ids, reports every quota bucket at 100% forever because
nothing is ever consumed, and can generate with EXACTLY the two tab_*
inline-completion models — free Code Assist's remaining entitlement — while all
28 chat models return a contentless RESOURCE_EXHAUSTED:
{"error":{"code":429,"message":"Resource has been exhausted (e.g. check quota).",
"status":"RESOURCE_EXHAUSTED"}}
No details, no ErrorInfo, no RetryInfo. It is not a rate limit; it is the
wrong product. Those two 200s are what let nine wrong hypotheses survive — an
identity rejected everywhere tells you nothing, but one that succeeds on exactly
the completion models is naming its own tier out loud.
agy 1.1.18 has never called anything else: 2,822 requests across 73 log files
spanning a week, 100% to daily-, 0% to cloudcode-pa. Its log is the primary
source — ~/.gemini/antigravity-cli/cli.log, lines beginning URL:.
AICODE_ENDPOINT_URL overrides the host. It is the same variable agy reads, so
a user on a different release track can point claudish where their own CLI goes.
-tiered means the tier is a PARAMETER, not part of the id
The Antigravity CLI shows "Gemini 3.7 Flash" with a low/medium/high Effort
slider. That is one model, not three: gemini-3.7-flash-high 404s, and the
only served 3.7 id is gemini-3.7-flash-tiered. The response declares it:
"tieredModelIds": {"flashLite":["gemini-3.1-flash-lite"],
"flash":["gemini-3.7-flash-tiered"],
"pro":["gemini-3.1-pro-low"]}
Gemini 3.6 still bakes the tier into the id (-high/-low/-medium); 3.7 moved
to the parameter form. Both shapes are live at once. Effort travels as
generationConfig.thinkingConfig.thinkingLevel (low/medium/high, all
verified 200), which adapters/gemini-api-format.ts already emits for any
gemini-3* id from Claude Code's own effort setting — so claudish has the Effort
slider already. xhigh and max both collapse to high, because Gemini 3 has
nothing above it.
Do not read agy models output as API ids. It is the CLI's DISPLAY
vocabulary. Doing so produced a bug report asking a backend to add five ids that
404 and delete the one that works.
The dynamic models catalog: what the backend declares unselectable
fetchAvailableModels returns the whole editor surface, and states three ways
which of it is not a chat model — all of them read by
getServedAntigravityModels:
| Signal | Shape | Example |
|---|---|---|
isInternal: true |
per-model flag | chat_20706, chat_23310 (both 400) |
| modality role lists | tabModelIds, imageGenerationModelIds, audioTranscriptionModelIds |
gemini-3.1-flash-image |
deprecatedModelIds |
map id → {newModelId} |
gemini-3.1-pro-high → gemini-pro-agent |
The deprecation map is load-bearing: gemini-3.1-pro-high is still present in
models, looks entirely ordinary, carries full capability flags — and answers
400 INVALID_ARGUMENT. The deprecation notice is the only warning given.
NOT excluded: mqueryModelIds / webSearchModelIds / commitMessageModelIds.
Those are role ASSIGNMENTS of an ordinary model — all three name
gemini-3.1-flash-lite, which chats fine. Treating a role as a disqualification
dropped a real model from the picker.
Only tab_* needs a prefix rule; it appears in no list and carries no flag.
The client version gates discovery AND generation (2026-10-14)
claudish sent antigravity/cli/1.1.9 from a hard-coded literal while the
installed agy was 1.3.5. Same token, project and host, only the version in the
User-Agent varying:
| UA version | fetchAvailableModels |
defaultAgentModelId |
streamGenerateContent gemini-4-argon-low |
|---|---|---|---|
| 1.1.9 | 23 ids; no gemini-4*, no gemini-3.8-flash-{high,medium,low} |
claude-opus-5-5-low |
404 |
| 1.3.5 | 29 ids; + gemini-4-argon-{high,medium,low}, + gemini-3.8-flash-{high,medium,low} |
gemini-4-argon-medium |
200 |
So the version is not cosmetic: a pinned one hides every model released after the pin, from the picker AND from generation, with nothing in the response to say so. The earlier claim that the UA "does not gate generation" was true only for models old enough to predate every version claudish ever sent.
The version is read from agy, once per auth session. agy auto-updates, and
claudish already depends on it for the token, so the installed agy's version is
the one value that cannot drift. auth/antigravity-token.ts runs agy --version
(prints 1.3.5, 0.04 s) whenever getValidAntigravityAccessToken or
forceRefreshAntigravityToken hands out an access token that differs from the
one the last read was made for — a new token means agy just ran, which is when it
may have updated. Same token → the cached value, at the cost of a string compare.
The value lives in auth/antigravity-client-version.ts; buildAntigravityUserAgent
reads it.
- A failed read keeps the previous good version. It never demotes a session to the floor, and it is not retried until the token changes.
1.1.9remains only as a floor for when agy cannot be read at all (not installed, broken). It is not a target; nothing ever pins to it again.- The served-models cache is keyed to the version.
getServedAntigravityModelsdrops a cache fetched under another version, because that answer is a different dynamic models catalog, not a stale copy of the same one.
The picker lists agentModelSorts, routing lists models
agy models prints exactly agentModelSorts[*].groups[*].modelIds, in that
order — on the 2026-10-14 account, 13 ids. The models dict carries more: older
generations (gemini-2.5-*, gemini-3-*, gemini-3.5-*) and
gemini-3.8-flash-tiered, which agy does not offer for selection.
getServedAntigravityModels returns that list as agentModelIds (flattened over
every sort and group, order kept, deduplicated). The ag@ picker then lists
exactly those ids that are also served and not declared excluded, in agy's order.
When the field is absent or empty the picker falls back to every selectable served
id, newest first — absent means unknown, not "none".
The narrowing happens in the picker, not in the discovery fetcher.
fetchAntigravityModelsCatalog still returns every selectable id; agy's ids lead
and carry providerOrder (their position), the rest carry none.
buildRowsFromDiscovered keeps only the rows that carry it, in that order. The
fetcher's list is not the picker's alone: providerServesModel — the routing
chain's availability filter — and discoverContextWindow read it too, and a
dynamic models catalog is the one source allowed to answer "not-served", which
REMOVES a hop. Narrowing the fetcher would have routed a bare gemini-2.5-pro
past the subscription to a metered provider.
Routing is unchanged: resolveAntigravityModelId and the transport resolve
against the full servedIds, so a typed [email protected] still works.
The availability check resolves ids the way the transport does (2026-10-21,
ai-docs/reports/model-failures-2026-10-21.md D8). providerServesModel used to
match the requested id exactly against the dynamic models catalog, because
Antigravity has no entry in the resolver registry. On an account serving only
gemini-3.8-flash-tiered, [email protected] therefore read as not served and
--advisor refused it, while the transport would have sent the tiered variant; a
bare gemini-3.8-flash lost its ag@ hop the same way and went to a metered
provider. The transport, the credential and the check now share one function,
resolveAntigravityServedModel (transport/antigravity.ts):
resolveAntigravityModelId with the cloud models catalog's family default
(lookupFamilyDefaultVariant). The check feeds it the transport's own inputs, the
full servedIds and the backend's defaultAgentModelId, from the getServedAntigravityModels cache
the discovery just filled (peekServedAntigravityModels), and then asks whether
the resolved id is in the dynamic models catalog. An id the backend declares
unselectable therefore still reads as not served. With no cache (a fetch that
never succeeded under this client version) it resolves against the dynamic models
catalog's ids with no backend default. Antigravity stays out of the resolver
registry: a resolver there receives neither the full servedIds nor the backend
default.
Ordering: cloud models catalog dates are poison for Antigravity's models
Antigravity rows set ignoreCatalogReleaseDate. compareByReleaseDateDesc sorts
undated rows last, and measured 2026-08-24 only 6 of 19 served ids had a catalog
date — every one of them an OLD base model, while every new variant had none:
dated gemini-2.5-flash 2025-04-17 <- sorted to the TOP
UNDATED gemini-3.7-flash-tiered — <- sorted to the BOTTOM
The catalog dates base models; Antigravity serves variants it does not list. Six dated of nineteen was worse than zero: a partial signal ranked confidently on incomplete evidence. Suppressed, the whole dynamic models catalog falls through to version-parts and orders 3.7 > 3.6 > 3.5 > 3.1 > 3 > 2.5.
That rule now governs only the fallback list. When the backend sends
agentModelSorts, the picker shows agy's own order instead (previous section).
Token lifecycle (auth/antigravity-token.ts, macOS):
- Shared store: the same keychain item the
agyCLI uses —service=gemini, account=antigravity, valuego-keyring-base64:<base64(JSON)>(zalando/go-keyring). claudish reads AND writes it, so both tools reuse one live token. - Refresh is delegated to
agy: when the access token is expired or within 2 minutes of expiry, claudish runsagy models(12 s timeout). That lightweight, authed command makesagymint a fresh token with its OWN current client secret and write it back to the shared store, and claudish then re-reads the store. claudish never handles the Antigravity client secret in any form: no embed, no scrape, no token exchange. The secret is a literal insideagy, andagyauto-updates, so each release rotates it and Google revokes the old one. Any copy claudish held would break within days. The refresh outcome (ran/not-installed/timeout/failed, with agy's stderr) decides the error: a slow or failingagyis retryable, while a missingagyor a session that is still stale after a clean run is terminal. - Degradation: no store (agy not installed / not signed in) or non-macOS → actionable error pointing at
g@+GEMINI_API_KEY.
Model ids — LIVE discovery, no hardcoded map: the Antigravity backend requires a reasoning-tier suffix (bare gemini-3.6-flash → 404), but which variants a subscription serves is per-account and drifts, so claudish never hardcodes a model list. getServedAntigravityModels() fetches the live set from the backend's own v1internal:fetchAvailableModels (body {project}) — the served ids are the response models keys, plus a backend defaultAgentModelId — cached with a TTL. resolveAntigravityModelId(requested, servedIds, defaultId) then resolves against that LIVE set: exact match passes through; a bare family (e.g. gemini-3.6-flash) resolves to the backend's defaultAgentModelId when it's a variant of that family, else to the strongest reasoning tier by a rank rule (high>medium>low>extra-low>tiered — a rule, like rankCodeAssistModel, not pinned ids); anything else passes through to the F1–F7 404 rewrite. The only literals are the tier-rank ordering and endpoint strings — no concrete model ids in source.
Identity strings: User-Agent: antigravity/cli/<ver> (aidev_client; os_type=<platform>; arch=<arch>; auth_method=consumer) + metadata: { ideType: "ANTIGRAVITY" }. The transport keeps all the F1–F7 improvements from the old codeassist path (terminal-error → 400 surfaced inline, the 404 rewrite that checks the dynamic models catalog, rankCodeAssistModel). Full reverse-engineering write-up: ai-docs/sessions/antigravity-refactor-20260803-125333-d0791562/architecture.md (write-up lost — predates the ai-docs tracking fix).
Raw model list for models-index (claudish subscription models antigravity --raw --json)
Why it exists. The models-index catalog publishes no exact connections on route
google/antigravity-subscription, so a bare gemini-4-argon routes to the metered Gemini API.
The models-index wire-probe runner (a nightly macOS LaunchAgent with no TTY and no browser) runs this
command, uploads stdout, and seals the body as evidence for the connections it publishes. Code:
subscription-models-command.ts.
It reuses the ag@ path; it does not copy it.
readAntigravityStoreClassifiedis the bounded keychain read.getValidAntigravityAccessToken(with observed deps) refreshes throughagy modelswhen the token is expired.setupAntigravityUserresolves the project.fetchAntigravityAvailableModelsRawreturns the body BEFORE any processing.getServedAntigravityModelscalls the same function and processes its result: exclusions, displayName,agentModelSorts. There is no cache, so every run is a live fetch.
--raw and --json are both required in v1. Each of these is a usage error:
- a missing flag;
- the
agshortcut in place ofantigravity; - an extra token.
A usage error exits 2, with the fixed usage line on stderr and an internal/usage failure line on
stdout. The bare form is kept free for a later human view.
Schema claudish.subscription-model-list.v1
Every exit, 0 and 1 to 7, prints exactly one JSON object on ONE stdout line, through the awaited
write before process.exit. Keys in this order:
schema, provider? ("antigravity"), claudishVersion,
fetchedAt?, sourceUrl?, clientVersion?, clientVersionSource?,
tokenRefreshed, httpStatus?, failure?, body?
Field-presence rule: a field appears exactly when this run determined it.
| Field | Present when |
|---|---|
provider |
the provider was determined: every exit except a usage error and the index.ts catch |
tokenRefreshed |
always. True when this run asked agy to refresh, even if that refresh failed |
clientVersion, clientVersionSource |
a valid token was obtained. The value is the version in the User-Agent actually sent. "fallback" means the 1.1.9 floor, which hides every gemini-4-argon-* id |
sourceUrl |
fetchAvailableModels was attempted. It is antigravityHost() (honours AICODE_ENDPOINT_URL) with any userinfo stripped |
fetchedAt, httpStatus |
fetchAvailableModels answered with a status |
body |
success only. A STRING: the 2xx response text exactly as res.text() read it, byte for byte, untrimmed |
failure |
{ class, code, httpStatus? }. Each is a fixed string, with no error text; every code matches ^[a-z0-9_.:-]{1,120}$ |
body is the response text, never a re-serialization. models-index seals it as evidence, and
JSON.parse followed by JSON.stringify is not the bytes the backend sent: number spellings,
escapes and whitespace can change. The success test still parses the text (2xx, valid JSON,
models a non-empty plain object); the parse decides success and is never printed.
fetchAntigravityAvailableModelsRaw's json variant carries both text and value;
getServedAntigravityModels reads only value.
A non-2xx fetchAvailableModels answer is not a failure: exit 0, with httpStatus and no body.
Failure taxonomy and exit codes
| Class | code |
Exit |
|---|---|---|
| — (success, or a non-2xx answer) | — | 0 |
credential_missing |
platform_unsupported, keychain_item_absent, token_unparseable |
3 |
keychain_locked |
keychain_locked (security exit 36/51/128), keychain_read_timeout (10 s), keychain_read_failed (any other exit) |
4 |
mint_failed |
agy_missing, agy_refresh_failed, agy_refresh_timeout, agy_refresh_no_valid_token |
5 |
mint_failed |
load_code_assist_4xx (with httpStatus), load_code_assist_no_project, load_code_assist_bad_body |
5 |
network |
load_code_assist_429, load_code_assist_5xx (with httpStatus), load_code_assist_network_error, load_code_assist_timeout (30 s) |
6 |
network |
fetch_available_models_network_error (unreachable, or a 2xx body that could not be read), fetch_available_models_timeout (30 s abort) |
6 |
list_incomplete |
models_absent, models_empty, body_not_json (all 2xx, with httpStatus) |
7 |
internal |
usage |
2 |
internal |
secret_guard, internal_error |
1 |
Class internal keeps the fixed stderr line of each case, and adds the stdout line:
usage:schema,claudishVersion,tokenRefreshed: false,failure. Noprovider: none was determined.secret_guard: every field determined so far, and never abody. That line is checked against the secrets too; on a hit (it holds no body, so it cannot happen) nothing is printed.internal_error:schema,provider,claudishVersion, thetokenRefreshedknown so far, andfailure; nothing else the failed run determined. Theindex.tscatch around the whole command prints the same line withoutproviderand withtokenRefreshed: false. The error text is never printed.
A stdout write that itself fails exits 1 with the stderr line only: a second line after a partial write would leave two objects on stdout.
A loadCodeAssist 429 or 5xx is network, not mint_failed: it is transient
(credential-error.ts).
A refresh failure is classified from what the run OBSERVED, never from message text. The command
records whether runAgyRefresh was called, and its AgyRefreshOutcome:
- No refresh was called:
token_unparseable. not-installed,timeoutorfailed: the matchingagy_*code.ran, but the re-read token is still stale:agy_refresh_no_valid_token.
Keychain lock handling
defaultReadStore maps every security failure to null, so a locked keychain reads as "not signed
in", and it has no deadline. The command uses readAntigravityStoreClassified(10 s) instead.
Step 1, presence. find-generic-password without -w reads no item data.
- Exit 44 is
absent. - It is NOT a lock probe: on a locked temporary keychain it answered exit 0 with the full attribute dump (measured 2026-10-21).
Step 2, the value read (-w). This is the step a locked keychain refuses. Measured on a locked
temporary keychain: exit 128 (errSecUserCanceled), empty stderr, after 1.5 s, and no call left
running. security exits with the low byte of the negated OSStatus:
- 44 (errSecItemNotFound) is measured.
- 36 (errSecInteractionNotAllowed) and 51 (errSecAuthFailed) are derived from the same arithmetic.
All three map to keychain_locked.
Both steps race one 10 s deadline. security is never killed (keychain.md: a killed security
once made macOS restart securityd). A LaunchAgent in the Aqua session may get a real unlock dialog.
Then the deadline reports keychain_read_timeout, the dialog is left to the user, and the command
exits explicitly, because the unkilled child would otherwise keep the event loop alive.
The pre-read value is handed to the token module as its first readStore answer, so that module
never spawns an unbounded read of its own. The one re-read after a refresh uses the default
synchronous read, which has no deadline. This is accepted and recorded as risk R4 of the design.
LaunchAgent PATH
locateAgyBinary() runs which agy, then ~/.local/bin/agy. launchd's default PATH has no
Homebrew prefix. An agy installed only under /opt/homebrew/bin is therefore invisible to a
LaunchAgent, with two effects:
- the version reads as
clientVersionSource: "fallback"; - an expired token fails as
agy_missing.
The plist must set PATH to include the directory agy lives in.
Secret guard
stdout is built only from the typed envelope. An
err.messageis never printed: messages embed vendor text (loadCodeAssistbodies) and agy's stderr.Before writing, the raw body text AND the serialized line are checked for these values, in full. Checking the raw text too means an escaped form in the line cannot hide a credential.
- the access token;
- the raw store value;
- every refresh token read;
- the project id.
A hit exits 1 with the stderr line
[claudish subscription] refused: output contained a credential value, and stdout carries the body-freeinternal/secret_guardline instead.log()writes only to files, and only afterinitLogger, which this command never calls. The project-id log lines inantigravity-user.tstherefore go nowhere.stderr carries only fixed lines.
The write is awaited before process.exit. Measured: an unawaited process.stdout.write of the
200 KB line followed by process.exit reaches a pipe as exactly 65,536 bytes, 3 runs of 3. Awaiting
the write callback delivers all of it.