import type { IncomingHttpHeaders } from 'node:http'; /** * HTTP status codes that warrant retrying with the API key. * * 402 — Payment Required ("out of extra usage", subscription credits gone). * 403 — Forbidden (sometimes used for quota exhaustion). * 429 — Rate Limited (5h window cap). * * Intentionally excludes 5xx/529. Retrying a POST after an ambiguous server * failure can duplicate work/cost if the upstream already started processing. */ export declare function isRetryableStatus(code: number | undefined): boolean; /** * Peek the first chunk of an SSE/JSON body to detect an Anthropic error * envelope (`{"type":"error", ...}` or `event: error\ndata: ...`). * * Anthropic sometimes returns HTTP 200 with an SSE stream whose first event * is an error (notably for `out of extra usage`). The proxy must look at * the body to know it's an error, not the status code. */ export declare function looksLikeErrorBody(head: string): boolean; /** Strip `oauth-2025-04-20` from a comma-separated `anthropic-beta` value. */ export declare function stripOauthBeta(value: string): string; /** Headers for a pass-through attempt: forwarded as-is, only `host` dropped. */ export declare function buildPassthroughHeaders(incoming: IncomingHttpHeaders): IncomingHttpHeaders; /** * Headers for an API-key request: replaces OAuth auth with `x-api-key` and * strips `oauth-2025-04-20` from `anthropic-beta` so Anthropic bills credits. */ export declare function buildApiKeyHeaders(incoming: IncomingHttpHeaders, apiKey: string): IncomingHttpHeaders;