import type { IncomingMessage, ServerResponse } from "node:http"; import type { Config } from "../config.js"; import { type OpenAiFrontProtocol } from "../backend.js"; import type { ToolUseValidator } from "../validator.js"; import type { Reshaper } from "../reshaper.js"; import type { MetadataLogger } from "../log.js"; import type { CircuitBreaker } from "../circuit-breaker.js"; import { CredentialWalk } from "../credential-select.js"; import type { RequestAccountingState } from "../accounting-state.js"; import type { ResolvedAttempt } from "../resolved-attempt.js"; import type { ModelLimits } from "../catalog.js"; import { CredentialAttemptTrace, type CandidateRunnerHandlers, type StickyRequestContext } from "../candidate-runner.js"; export declare function detectOpenAiFrontProtocol(method: string | undefined, pathname: string): OpenAiFrontProtocol | null; export interface OpenAiFrontHandlers extends CandidateRunnerHandlers { validator: ToolUseValidator; logger: MetadataLogger; breaker: CircuitBreaker; isDestructive: (name: string) => boolean; resolveReshaper: (attempt: ResolvedAttempt) => Reshaper | undefined; withRepairAccounting: (reshaper: Reshaper, accounting: RequestAccountingState | null) => Reshaper; catalog: { cachedLimits: (provider: string, model: string) => ModelLimits | null | undefined; }; } export interface OpenAiFrontContext { reqJson: unknown; wantsStream: boolean; protocol: OpenAiFrontProtocol; inboundHeaders: IncomingMessage["headers"]; started: number; path: string; hadTools: boolean; req?: IncomingMessage; addressedPool?: string | null; degradedSpecs?: Set | null; sticky?: StickyRequestContext | null; cfg?: Config; accounting: RequestAccountingState | null; quotaDemotedFirst?: string | null; latencyDemotedFirst?: string | null; pacedFirst?: string | null; /** * The relay's own chars/4 estimate of this request's INPUT size (`estimateRequestTokens` in * `metadata.ts`) — the sibling of `AnthropicCtx`'s field in `routes/messages.ts`, threaded rather * than re-estimated so the hedge floor and the context guardrail read the same number. */ estimatedInputTokens: number; } export declare function openAiFrontPath(res: ServerResponse, credentialWalk: CredentialWalk, credentialTrace: CredentialAttemptTrace, ctx: OpenAiFrontContext, h: OpenAiFrontHandlers): Promise;