litellm - 💡(How to fix) Fix [Bug]: streamGenerateContent passthrough always returns SSE format, breaking google-genai SDK [3 pull requests]

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…

Fix Action

Fixed

Code Example

<class 'google.genai.errors.UnknownApiResponseError'> Failed to parse response as JSON
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

After upgrading from litellm[proxy]==1.83.14 to litellm[proxy]==1.86.0, the google-genai Python SDK (google-genai==2.0.0) fails to parse streaming responses from the proxy's /v1beta/models/{model}:streamGenerateContent endpoint.

google.genai.errors.UnknownApiResponseError Failed to parse response as JSON. Raw response: data: {"candidates": [{"content": {"role": "model","parts": [{"functionCall": ...}]}]},...}

The new google_ai_studio_endpoints.py module registers a /v1beta/models/{model}:streamGenerateContent endpoint that unconditionally returns StreamingResponse(media_type="text/event-stream"), wrapping all chunks in SSE format. Where as google-genai SDK expects raw json

Steps to Reproduce

  1. Run LiteLLM proxy v1.86.0 with Vertex AI models configured
  2. Configure google-genai==2.0.0 client
  3. Make call to generate_content_stream using any gemini model

Relevant log output

<class 'google.genai.errors.UnknownApiResponseError'> Failed to parse response as JSON

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.86.0

Twitter / LinkedIn details

No response

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