/** * OpenAI Provider Adapter * * Implements the unified ILLMProvider interface for OpenAI's API. * Defaults to the Responses API and keeps Chat Completions as an explicit * compatibility surface for older proxies and deployments. * * @version 1.1.0 */ import { BaseLLMAdapter } from '../base-adapter'; import type { AssistantContentBlock, Capabilities, InlineModerationResult, LLMCompletionRequest, LLMCompletionResponse, LLMRequestOptions, LLMMessage, OpenAIProviderConfig, ToolSpec, ToolUseBlock } from '../types'; export declare const OPENAI_MODELS: readonly ["gpt-5.6-sol", "gpt-5.6", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.5", "gpt-5.5-instant", "chat-latest", "gpt-5.4", "gpt-5.4-pro", "gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.3-codex", "gpt-5.3-codex-spark", "gpt-5-codex", "gpt-5.2", "gpt-5", "gpt-4.1", "gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-4", "gpt-3.5-turbo", "gpt-3.5-turbo-16k"]; export type OpenAIModel = (typeof OPENAI_MODELS)[number]; export declare const OPENAI_MODEL_ALIASES: { readonly 'gpt-5.6': "gpt-5.6-sol"; readonly 'chat-latest': "gpt-5.5-instant"; }; export declare function resolveOpenAIModelAlias(model: string): string; type OpenAIResponseInputItem = Record; type OpenAIResponseTool = Record; /** * Translate the provider-neutral HoloScript tool shape to OpenAI Responses * function tools. */ export declare function toolSpecsToOpenAIResponseTools(tools?: ToolSpec[]): OpenAIResponseTool[]; /** * Translate provider-neutral messages to the Responses API input array. * Text turns stay as role/content messages. Prior assistant tool calls and * user tool results are represented as Responses function_call / * function_call_output items so HoloScript tool loops can round-trip. */ export declare function messagesToOpenAIResponsesInput(messages: LLMMessage[]): OpenAIResponseInputItem[]; /** * Parse an OpenAI inline moderation object (from the `moderation` field on * Responses / Chat Completions responses) into the provider-neutral * `InlineModerationResult` shape. * * OpenAI wire format (Responses API, verified 2026-06-08 A-020): * { * "flagged": true, * "results": [{ "categories": { "hate": false, ... }, "category_scores": { ... }, "flagged": true }] * } * * We surface the top-level `flagged` plus the per-category maps from the first * result entry (all content in a generation request is single-item). Callers * that need per-item details can read `raw`. */ export declare function parseOpenAIModerationResult(value: unknown): InlineModerationResult | undefined; /** * Parse an OpenAI Responses API result into the provider-neutral completion * shape. Exported so the wire contract is testable without live API calls. */ export declare function parseOpenAIResponsesResult(response: unknown, fallbackModel: string): LLMCompletionResponse; export declare function resolveOpenAIToolControls(request: LLMCompletionRequest, defaultParallelToolCalls?: boolean): { toolChoice: 'auto' | 'required' | 'none'; parallelToolCalls: boolean; }; export declare function toolSpecsToOpenAIChatCompletionTools(tools?: ToolSpec[]): OpenAIResponseTool[]; export declare function parseOpenAIChatCompletionToolCalls(choice: unknown): { toolUses: ToolUseBlock[]; assistantBlocks: AssistantContentBlock[]; }; /** * OpenAI provider adapter for HoloScript. * * @example * ```typescript * const openai = new OpenAIAdapter({ * apiKey: process.env.OPENAI_API_KEY!, * }); * * const scene = await openai.generateHoloScript({ * prompt: "a floating island with glowing crystals", * }); * console.log(scene.code); * ``` */ /** * Capability manifest sourced from `docs/LLM_CAPABILITIES.md` * § OpenAI. Per OpenAI/Codex self-audit 2026-05-06: Responses API is the * primary surface (default since commit 1eebdf0ed); Chat Completions kept * as compatibility surface. Lineup spans GPT-5.5 / GPT-5.5-instant (1M ctx, * chat-latest alias, ChatGPT default — A-020 2026-06-08) / GPT-5.4 family / * GPT-5.3-codex / o-series / Realtime / Embeddings / GPT Image. * NOTE: Evals platform deprecated 2026-06-03 (evalsFirstParty → false). * * `contextWindow` / `maxOutput` set to 0 (unknown) until /research * task_1778109552044_wstq populates the per-model spec table — F.014 / * W.GOLD.341 forbid pasting training-era stats. `costPerMillion` omitted * for the same reason (varies per model). * * Exported as a constant so the capability-aware router can read it * without instantiating the adapter — single source of truth per W.GOLD.006. */ export declare const OPENAI_CAPABILITIES: Capabilities; export declare class OpenAIAdapter extends BaseLLMAdapter { readonly name: "openai"; readonly models: readonly ["gpt-5.6-sol", "gpt-5.6", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.5", "gpt-5.5-instant", "chat-latest", "gpt-5.4", "gpt-5.4-pro", "gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.3-codex", "gpt-5.3-codex-spark", "gpt-5-codex", "gpt-5.2", "gpt-5", "gpt-4.1", "gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-4", "gpt-3.5-turbo", "gpt-3.5-turbo-16k"]; readonly defaultHoloScriptModel: string; readonly capabilities: Capabilities; private readonly organization?; private readonly apiSurface; private readonly reasoningEffort?; private readonly store?; private readonly parallelToolCalls; constructor(config: OpenAIProviderConfig); protected getDefaultModel(): string; complete(request: LLMCompletionRequest, model?: string, options?: LLMRequestOptions): Promise; private completeWithResponses; private buildResponsesPayload; private completeWithChatCompletions; private mapChatFinishReason; private mapOpenAIError; } export {};