import type { ReasoningMode } from "./config-types.js"; /** * The Responses front's LAST-RESORT `max_tokens` for an `anthropic`-kind target when the caller * stated no `max_output_tokens` and this deployment has taught the relay no ceiling of its own * (`context-limits.ts`'s learned `max-output` fact) and the catalog publishes none either. * `backend.ts`'s `resolveAnthropicResponsesMaxTokens` is the one place this constant is read — * an `openai`-kind target never reaches it, because `openai-request.ts` omits `max_tokens` * entirely when the caller stated none and the provider applies its own ceiling. * * A TUNABLE DEFAULT, never a provider figure — the provenance invariant this whole module already * follows. Until 2026-09-09 this module substituted llm-bridge's flat 1024 here UNCONDITIONALLY, * even for an `openai`-kind target's outbound Chat body, where the field is genuinely optional. * Measured against DeepSeek (docs/history/deepseek-responses-truncation-2026-09-09.md): 20 of 68 captured * upstream answers ended `finish_reason: "length"` at EXACTLY `completion_tokens: 1024` — the * relay's own invented cap, not anything the caller or the provider asked for — and every one of * the 44 emitted `response.completed` events still carried `"status":"completed"`, so a cap * landing mid tool-call-argument JSON reached the caller looking like a finished answer. 8192 is * 8x that figure and is still just a guess bounding an `anthropic`-kind passthrough, which * REQUIRES the field. */ export declare const DEFAULT_RESPONSES_MAX_TOKENS = 8192; export interface ResponsesToAnthropicOptions { /** * The RESOLVED reasoning-mapping mode for the target this Anthropic-shaped intermediate will * reach (`config.ts` `resolveReasoningMode`) — the same value `openai-request.ts`'s * `AnthropicToOpenAiOptions.reasoning` carries, since an `openai`-kind target's request is built * FROM this function's own output (see `fetchTranslatedOpenAiFront` in `backend.ts`). Absent ⇒ * `"none"` ⇒ a Responses `reasoning` item is dropped exactly as it was before this option * existed — every target but a `"deepseek"` one is unaffected. Never a provider name: this * module is handed a decision, it does not make one (the `openai-request.ts` precedent). */ reasoning?: ReasoningMode | undefined; } /** * Translate one OpenAI Responses request body into an Anthropic Messages request body. * * Turn order is preserved exactly; only CONSECUTIVE same-role items merge. Unknown top-level * fields are not forwarded — this is a translation between two contracts, not a passthrough. * * @throws {RequestMappingError} for an item, part or declaration that cannot be represented. */ export declare function openaiResponsesRequestToAnthropic(reqJson: unknown, opts?: ResponsesToAnthropicOptions): Record;