createInBandProviderError (error/body-error.ts)

oh-my-pi · packages/ai/src/error/body-error.ts · typescript · MIT
auth

* In-band provider failures: upstream 429/5xx payloads that arrive inside an HTTP 200 response body, or mid-stream after the SSE headers were already sent. Providers that front a retry/queue layer — Azure OpenAI, LiteLLM-style aggregators, Bedrock-compatible shims — answer a thro

// Source: https://github.com/can1357/oh-my-pi | License: MIT | Copyright 2025 Mario Zechner
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * In-band provider failures: upstream 429/5xx payloads that arrive inside an
 * HTTP 200 response body, or mid-stream after the SSE headers were already sent.
 *
 * Providers that front a retry/queue layer — Azure OpenAI, LiteLLM-style
 * aggregators, Bedrock-compatible shims — answer a throttled request with
 * `200 OK` + `text/event-stream` and put the real status in the payload:
 * `data: {"error":{"type":"rate_limit_error"}}`, `data: {"code":429}`, or a bare
 * non-JSON frame such as `data: 429 Too Many Requests` / an nginx throttle page.
 * Those bodies used to be either dropped silently (the stream then looked like a
 * suc

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key