gemini-cli - 💡(How to fix) Fix Support for Vertex AI Partner Models (Anthropic Claude) via synchronous fallback or corrected streaming payload [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25579Fetched 2026-04-18 05:57:47
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×1subscribed ×1unsubscribed ×1

Error Message

✕ [API Error: {"error":{"message":"{\n "error": {\n "code": 400,\n "message": "claude-opus-4-7 is not supported in the streamGenerateContent API.",\n "status": "FAILED_PRECONDITION"\n }\n}\n","code":400,"status":"Bad Request"}}]

Root Cause

The Gemini CLI's React Ink-based TUI relies exclusively on the AgentSession event stream to render its interface. Because there is no configuration exposed to fallback to a synchronous generateContent call, the CLI inherently incompatible with Vertex AI Partner Models that do not support the standard Google GenAI streaming spec.

Code Example

[API Error: {"error":{"message":"{\n  \"error\": {\n    \"code\": 400,\n    \"message\":
  \"claude-opus-4-7 is not supported in the streamGenerateContent API.\",\n    \"status\":
  \"FAILED_PRECONDITION\"\n  }\n}\n","code":400,"status":"Bad Request"}}]

---

> /about
About Gemini CLI
CLI Version                         0.38.1
Git Commit                          7f5580034
Model                               publishers/anthropic/models/claude-opus-4-7
Sandbox                             no sandbox
OS                                  linux 
Auth Method                         vertex-ai
GCP Project                         XXXXXXXX
RAW_BUFFERClick to expand / collapse

What happened?

Summary:

The Gemini CLI's React Ink-based TUI relies exclusively on the AgentSession event stream to render its interface. Because there is no configuration exposed to fallback to a synchronous generateContent call, the CLI inherently incompatible with Vertex AI Partner Models that do not support the standard Google GenAI streaming spec.

Details:

The UI Architecture: The Gemini CLI's interactive Terminal UI (TUI) is built using the React Ink framework. It relies on an event-driven architecture called AgentSession (introduced a few weeks ago). The CLI does not wait for a single, large string to return; it processes a constant stream of "agent events" to render tool execution spinners, typing text, and intermediate thoughts.

The Configuration Reference (reference/configuration.md & cli/generation-settings.md): The documentation defines the ModelConfigService, which exposes parameters like temperature, topP, and maxOutputTokens. However, there is no exposed configuration flag (e.g., stream: false) that the core engine respects to switch from streamGenerateContent to a synchronous generateContent call.

As a result, an attempt to use a Partner Model leads to errors like:

✕ [API Error: {"error":{"message":"{\n  \"error\": {\n    \"code\": 400,\n    \"message\":
  \"claude-opus-4-7 is not supported in the streamGenerateContent API.\",\n    \"status\":
  \"FAILED_PRECONDITION\"\n  }\n}\n","code":400,"status":"Bad Request"}}]

and there is no way correct the configuration.

What did you expect to happen?

An ability to use partner models (i.e. Claude) through Vertex AI.

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
│ About Gemini CLI
│ CLI Version                         0.38.1
│ Git Commit                          7f5580034
│ Model                               publishers/anthropic/models/claude-opus-4-7
│ Sandbox                             no sandbox
│ OS                                  linux 
│ Auth Method                         vertex-ai
│ GCP Project                         XXXXXXXX
</details>

Login information

Vertex AI through a GCP project configuration

Anything else we need to know?

No response

extent analysis

TL;DR

The Gemini CLI's incompatibility with Vertex AI Partner Models can be addressed by adding a configuration flag to fallback to a synchronous generateContent call when the standard Google GenAI streaming spec is not supported.

Guidance

  • The error message indicates that the claude-opus-4-7 model does not support the streamGenerateContent API, suggesting that a synchronous generateContent call is needed.
  • To resolve this, consider adding a configuration flag (e.g., stream: false) to the ModelConfigService that allows the CLI to switch to a synchronous generateContent call when necessary.
  • Verify that the Partner Model documentation or Vertex AI API supports a synchronous generateContent call and determine the required configuration or API changes.
  • Investigate the ModelConfigService implementation to understand how to add the proposed configuration flag and ensure it is respected by the core engine.

Example

No code snippet is provided as the issue does not contain sufficient implementation details.

Notes

The solution relies on the assumption that adding a configuration flag to fallback to a synchronous generateContent call is feasible and compatible with the Vertex AI API and Partner Models.

Recommendation

Apply a workaround by adding a configuration flag to the ModelConfigService to enable synchronous generateContent calls for Partner Models that do not support the standard Google GenAI streaming spec, as this appears to be the most direct solution to address the incompatibility issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - 💡(How to fix) Fix Support for Vertex AI Partner Models (Anthropic Claude) via synchronous fallback or corrected streaming payload [1 participants]