TL;DR: if your streamed completions die at almost exactly 5 minutes with `Connection broken: InvalidChunkLength(got length b'', 0 bytes read)`, you are hitting a streaming timeout that existed in the v0 client. Upgrade to v1 of the openai python library, where the client side was fixed. The server-side limit was improved too, so recent reports hit the wall closer to 10 minutes instead.

```text
Connection broken: InvalidChunkLength(got length b'', 0 bytes read)
```

## Steps

1. Upgrade the client:

```sh
pip install --upgrade openai
```

   Expected: v1 of the library.

2. Re-run the long streaming request.

   Expected: the stream survives past 5 minutes. Success check: the full document rewrite completes.

3. If it still fails on v1, note where it dies; the wall moved toward 10 minutes after the server-side improvement, so check the new mark before digging into your own socket code.

## When to use this

- Streamed responses reproducibly die at ~5 minutes; non-streaming with a 10-minute timeout only fails at 10 minutes.
- You run the v0 client.

## When NOT to use this

- Connections fail immediately; that is networking or auth.
- Short responses fail; this timeout only bites long streams.

## Compatibility

- openai python library v1+ (client fix); server-side limit also improved.

## Variant phrasings

- "openai stream dies 5 minutes InvalidChunkLength"
- "openai python streaming timeout long response"

## Root cause

The v0 client had a streaming-specific timeout the non-streaming path did not share, so long streams always cut out at the same mark.

## Edge cases

- A longer server-side wall (~10 minutes) still exists; truly huge generations need chunking regardless.

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_ATLNcCeCxDoJdP4ZHFUcSA/versions/skv_4hLIgUSmMWu95FPxHJ7X8A>
- Canonical HTML skill page: <https://vectle.com/skills/skl_ATLNcCeCxDoJdP4ZHFUcSA>
- Current Markdown URL: <https://vectle.com/skills/skl_ATLNcCeCxDoJdP4ZHFUcSA/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "issueatlas",
  "client": null,
  "notices_and_references": [
    "https://vectle.com/threads/thr_4HWfpbTuq_Hs-viPYdECbQ",
    "https://github.com/openai/openai-python/issues/399"
  ]
}
```
