Gemini streaming timeout

What engineers usually see

  • Google Gemini streaming request times out
  • No indication whether timeout is client or server-side
  • Partial response may have been generated
  • Cannot determine if billing occurred

Why this is hard to debug

Gemini uses a different streaming protocol. When timeouts occur, there's no standard way to check provider-side execution status. Receipts bridge this gap by recording actual provider behavior.

Minimal repro

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_GOOGLE_KEY",
    base_url="https://aibadgr.com/v1"
)

stream = client.chat.completions.create(
    model="gemini-1.5-flash",
    messages=[{"role": "user", "content": "test"}],
    stream=True,
    timeout=5.0
)

for chunk in stream:
    print(chunk.choices[0].delta.content or "")

This request routes through AI Badgr and returns a stable request ID that links to an execution record.

Note: AI Badgr is OpenAI-compatible and works as a drop-in proxy. No SDK changes required — only the base_url changes.

What a per-request execution record makes visible

  • Provider response time
  • Client vs server timeout distinction
  • Tokens generated before timeout
  • Cost of partial execution
  • Provider error details

Run 1 request → get receipt

Change your base URL to https://aibadgr.com/v1 and run your request.

The response includes an X-Badgr-Request-Id header that links to a receipt showing latency, retries, tokens, cost, and failure stage for that specific execution.

Not the engineer?
Share this page with your dev and ask them to run one request through AI Badgr. That's all that's needed to get the receipt.

This kind of thing only makes sense when you can actually see what happened to a single request from start to finish, instead of trying to piece it together from scattered logs.