[GH-ISSUE #157] Incompatible Gemini Stream Format: 'thoughtSignature' merged into text part breaks strict parsers (LiteLLM) #121

Closed
opened 2026-02-27 07:18:06 +03:00 by kerem · 2 comments
Owner

Originally created by @themw123 on GitHub (Jan 3, 2026).
Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/157

Describe the bug

When using the gemini-cli-oauth endpoint with streaming enabled (streamGenerateContent), the API returns a non-standard JSON structure for parts.
Specifically, thoughtSignature is merged into the same object as text. Strict clients (like LiteLLM using the native gemini provider) fail to parse this and return empty content because they expect the official Google API structure.

Current Behavior:

The parts array combines metadata and text:

"parts": [
  {
    "thoughtSignature": "CiIBjz1...",
    "text": "Response content..."
  }
]

Expected Behavior (Official Gemini API):

Text parts should be clean, or metadata should be handled separately/according to protobuf specs:

"parts": [
  {
    "text": "Response content..."
  }
]

Impact

It is currently impossible to use this proxy with LiteLLM's native gemini provider (used by tools like Claude Code), as it results in empty responses.

Originally created by @themw123 on GitHub (Jan 3, 2026). Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/157 ### Describe the bug When using the gemini-cli-oauth endpoint with streaming enabled (streamGenerateContent), the API returns a non-standard JSON structure for parts. Specifically, thoughtSignature is merged into the same object as text. Strict clients (like LiteLLM using the native gemini provider) fail to parse this and return empty content because they expect the official Google API structure. ### Current Behavior: The parts array combines metadata and text: ``` "parts": [ { "thoughtSignature": "CiIBjz1...", "text": "Response content..." } ] ``` ### Expected Behavior (Official Gemini API): Text parts should be clean, or metadata should be handled separately/according to protobuf specs: ``` "parts": [ { "text": "Response content..." } ] ``` ### Impact It is currently impossible to use this proxy with LiteLLM's native gemini provider (used by tools like Claude Code), as it results in empty responses.
kerem closed this issue 2026-02-27 07:18:06 +03:00
Author
Owner

@themw123 commented on GitHub (Jan 3, 2026):

I just noticed that this isn't really the cause. It only adds the thoughtSignature at the very end. The problem is more likely due to the use of SSE; the standard gemini API uses Chunked Transfer Encoding instead of SSE

<!-- gh-comment-id:3707295417 --> @themw123 commented on GitHub (Jan 3, 2026): I just noticed that this isn't really the cause. It only adds the thoughtSignature at the very end. The problem is more likely due to the use of SSE; the standard gemini API uses Chunked Transfer Encoding instead of SSE
Author
Owner

@justlovemaki commented on GitHub (Jan 6, 2026):

Try reporting the issue of being unable to parse SSE to LiteLLM.

<!-- gh-comment-id:3714101012 --> @justlovemaki commented on GitHub (Jan 6, 2026): Try reporting the issue of being unable to parse SSE to LiteLLM.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#121
No description provided.