Skip to content

fix(core): Claude Opus & Sonnet 5.5 return 404/429 loop because upstream Antigravity uses 4.6 thinking models #35

Open

Description

@huseyincig

Summary

In @cortexkit/opencode-antigravity-auth v3.0+, all requests to antigravity-claude-opus-5-5 and antigravity-claude-sonnet-5-5 fail or hang indefinitely in OpenCode. The plugin gets trapped in a 404 -> 429 fallback loop, penalizes every active account in the pool with rate-limit cooldowns, and eventually aborts with 0 tokens.

Meanwhile, official agy CLI works immediately and succeeds in ~6 seconds because the real upstream Google Antigravity backend hosts claude-opus-4-6-thinking and claude-sonnet-4-6, whereas 5-5 models do not exist on the server.


Environment

  • OS: Linux (Ubuntu) / Cross-platform
  • OpenCode: 1.19.0
  • Node.js: v24.21.0
  • Plugin version: @cortexkit/opencode-antigravity-auth 3.0.2 (@cortexkit/antigravity-auth-core 3.0.2)
  • Accounts: 9 active, verified Google accounts with Google AI / Antigravity access

Root Cause Analysis

1. 5-5 Model IDs Return 404 on Upstream Backend

The plugin defines claude-opus-5-5-low/medium/high and vertexModelId: "claude-opus-5-5@default" in model-registry.ts.
When sent to Google Antigravity's primary endpoint (https://daily-cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse):

  • claude-opus-5-5-low -> HTTP 404 (NOT_FOUND: "Requested entity was not found.")
  • claude-opus-5-5@default -> HTTP 404 (NOT_FOUND)
  • claude-sonnet-5-5-low -> HTTP 404 (NOT_FOUND)
  • claude-opus-4-6-thinking -> HTTP 200 (SUCCESS)
  • claude-sonnet-4-6 -> HTTP 200 (SUCCESS)

2. 404 Triggers Faulty Fallback to Prod (429 Loop)

In request-services.ts, ANTIGRAVITY_ENDPOINT_FALLBACKS retries on 404 to https://cloudcode-pa.googleapis.com (prod) with project: aicode-consumers:

timestamp=2026-10-13T13:44:44.550Z level=ERROR message="stream error" providerID=google modelID=antigravity-claude-sonnet-5-5 error.error="AI_RetryError: Failed after 3 attempts. Last error: Resource has been exhausted (e.g. check quota).
[Debug Info]
Requested Model: antigravity-claude-sonnet-5-5
Effective Model: claude-sonnet-5-5-low
Project: aicode-consumers
Endpoint: https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse
Status: 429
Request ID: N/A"

The rotation engine marks the account rate-limited for Claude, switches to the next account, hits 404->429 again, until all accounts in the pool are marked in rateLimitResetTimes and the request aborts.

3. isRetiredAgyModel Prevents Using the Actual Working Models

In model-registry.ts:

export function isRetiredAgyModel(model: string): boolean {
    const route = model.toLowerCase().replace(/^antigravity-/, '').replace(/^gemini-(?=claude-)/, '');
    return (/^claude-(opus|sonnet)-4-6(?:-thinking)?(?:-(?:minimal|low|medium|high))?$/.test(route) && getAgyNativeModel(route) === undefined);
}

If a user tries to configure antigravity-claude-opus-4-6-thinking, the plugin intercepts it with:
412 FAILED_PRECONDITION: This Antigravity model is no longer offered. Choose another model.


Control Test (Official agy CLI)

The official Google agy binary (agy models) lists:

  • claude-opus-4-6-thinking
  • claude-sonnet-4-6

Executing:

agy --model claude-opus-4-6-thinking -p "Say OK"
# Output: OK (completed in 6 seconds)

Inspection of /tmp/agy.log confirms agy hits https://daily-cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse with claude-opus-4-6-thinking and receives a 200 SSE stream with req_vrtx_... response IDs.


Steps to Reproduce in OpenCode

  1. Install @cortexkit/opencode-antigravity-auth@latest (3.0.2).
  2. Configure or run:
    opencode run -m google/antigravity-claude-opus-5-5 "Say OK"
  3. OpenCode hangs for ~4 minutes, rotates through all accounts, logs 429 errors, and aborts with 0 tokens.

Proposed Fix

1. In packages/core/src/model-registry.ts:

  • Remove or disable isRetiredAgyModel rejection:
    export function isRetiredAgyModel(model: string): boolean {
        return false;
    }
  • Ensure claude-opus-4-6-thinking and claude-sonnet-4-6 are registered in AGY_NATIVE_MODEL_DEFINITIONS:
    'claude-opus-4-6-thinking': {
        displayName: 'Claude Opus 4.6 (Thinking)',
        maxTokens: 250000,
        maxOutputTokens: 64000,
        model: 'claude-opus-4-6-thinking',
        thinkingBudget: 1024,
        supportsThinking: true,
        supportsAdaptiveThinking: false,
        vertexModelId: 'claude-opus-4-6-thinking',
    },
    'claude-sonnet-4-6': {
        displayName: 'Claude Sonnet 4.6 (Thinking)',
        maxTokens: 250000,
        maxOutputTokens: 64000,
        model: 'claude-sonnet-4-6',
        thinkingBudget: 1024,
        supportsThinking: true,
        supportsAdaptiveThinking: false,
        vertexModelId: 'claude-sonnet-4-6',
    },

2. In packages/core/src/transform/model-resolver.ts:

Route claude-opus and claude-sonnet (including the 5-5 catalog IDs) to the real wire model names:

if (/^claude-opus/i.test(modelWithoutQuota)) {
    return {
        actualModel: 'claude-opus-4-6-thinking',
        thinkingBudget: 1024,
        isThinkingModel: true,
        tier: tier ?? 'high',
        quotaPreference,
        explicitQuota,
    };
}
if (/^claude-sonnet/i.test(modelWithoutQuota)) {
    return {
        actualModel: 'claude-sonnet-4-6',
        thinkingBudget: 1024,
        isThinkingModel: true,
        tier: tier ?? 'high',
        quotaPreference,
        explicitQuota,
    };
}

Verification of Fix

With this patch applied locally to the runtime:

$ opencode run -m google/antigravity-claude-opus-5-5 "Say OK"
> orchestrator · antigravity-claude-opus-5-5
OK  # Completed in 9s!

$ opencode run -m google/antigravity-claude-opus-5-5 "What is 2+2? Answer in one word."
> orchestrator · antigravity-claude-opus-5-5
Four.  # Completed in 9s!

$ opencode run -m google/antigravity-claude-sonnet-5-5 "Say OK"
> orchestrator · antigravity-claude-sonnet-5-5
OK  # Completed in 8s!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions