Commit 0ace38a
fix(usage): detect SSE stream when upstream omits Content-Type header
The chatgpt backend returns SSE responses without a Content-Type header.
This caused isEventStream to be false, skipping the tee/inspection pump
entirely — so usage was never extracted from the response.completed event
and all entries showed usageStatus: "unreported" with tokens=0.
Fall back to treating a 200 response with a body as SSE when the caller
requested streaming and no Content-Type is present. Also ensure the
downstream response has text/event-stream set so clients detect SSE
correctly.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b0571c9 commit 0ace38a
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
465 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
466 | 470 | | |
467 | 471 | | |
468 | 472 | | |
| |||
522 | 526 | | |
523 | 527 | | |
524 | 528 | | |
| 529 | + | |
525 | 530 | | |
526 | 531 | | |
527 | 532 | | |
| |||
0 commit comments