Skip to content

fix: Google backend model mapping and Claude tool schema translations#391

Merged
su-kaka merged 4 commits into
su-kaka:masterfrom
kushaldotdev:fix-antigravity-model-mappings-and-tools
Jul 8, 2026
Merged

fix: Google backend model mapping and Claude tool schema translations#391
su-kaka merged 4 commits into
su-kaka:masterfrom
kushaldotdev:fix-antigravity-model-mappings-and-tools

Conversation

@kushaldotdev

@kushaldotdev kushaldotdev commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This PR fixes two critical issues occurring on Google's internal Antigravity backend (used in Vertex mode / antigravity endpoints) and GeminiCLI mode.

1. Model Mapping Fix (INVALID_ARGUMENT)

Google's backend deprecated the gemini-3.1-pro-high model and replaced it with gemini-pro-agent.

  • Added map_antigravity_gemini_model to accurately map client-requested models to Google's backend.
  • Explicitly mapped gemini-3.1-pro-high to gemini-pro-agent to resolve the INVALID_ARGUMENT (400) errors users were seeing.
  • Removed the automatic silent fallback of gemini-3.5-flash-high to -low. If a user explicitly requests the -high version (which doesn't exist on the backend for 3.5 flash), they will now receive a native 404 NOT_FOUND error instead of experiencing silent performance degradation.

2. Tool Formatting Fix (must not be set when parameters is set & Field required)

Google's internal REST API translators have highly specific schema requirements depending on whether the underlying model is Gemini or Claude. The previous upstream logic incorrectly assumed Claude models needed custom blocks or behaved identically to Gemini.

  • For Gemini Models: Google's internal API strictly forbids passing parametersJsonSchema. We now strip it and exclusively populate the standard parameters field.
  • For Claude Models (All Modes): The Google backend translator (in both geminicli and antigravity/Vertex AI channels) strictly requires functionDeclarations using the parametersJsonSchema field. Sending parameters causes the translator to miss the schema entirely, crashing with tools.0.custom.input_schema: Field required. Sending custom in geminicli mode crashes with Unknown name "custom".
  • Refactored _ensure_empty_tool_schema_for_claude to dynamically output the exact tool format expected by Google's backend translators based on the model family.

…nd Claude

- **Model mapping**: Added `map_antigravity_gemini_model` to accurately map client-requested models to Google's backend. Notably, `gemini-3.1-pro-high` is explicitly mapped to `gemini-pro-agent` since the original identifier was deprecated and returns an `INVALID_ARGUMENT` (400) error.
- **Tool formatting fix**: Google's internal REST API strictly forbids passing both `parameters` and `parametersJsonSchema` inside `functionDeclarations`. Refactored `_ensure_empty_tool_schema_for_claude` to exclusively use the `parameters` field and drop `parametersJsonSchema` to resolve `INVALID_ARGUMENT` tool schema errors.
@kushaldotdev

Copy link
Copy Markdown
Contributor Author

Now all the enpoints in antigravity works, claude and gemini 3.1 pro , gemini 3.5 flash

…-antigravity-model-mappings-and-tools

Conflicts resolved by unifying the tool schema normalization logic for both Gemini and Claude across different modes.
@kushaldotdev kushaldotdev force-pushed the fix-antigravity-model-mappings-and-tools branch 2 times, most recently from d7ee3bf to 60b138e Compare July 8, 2026 16:18
@kushaldotdev kushaldotdev force-pushed the fix-antigravity-model-mappings-and-tools branch from 60b138e to 5a4f77d Compare July 8, 2026 16:27
@kushaldotdev kushaldotdev changed the title This PR fixes two critical issues occurring on Google's internal Antigravity backend (used in Vertex mode / antigravity endpoints). fix: Google backend model mapping and Claude tool schema translations Jul 8, 2026
@su-kaka su-kaka merged commit 479fe43 into su-kaka:master Jul 8, 2026
1 check passed
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.

2 participants