/** * Zod schemas for the OpenAI Responses API request shape we accept on the * gateway. Mirrors https://platform.openai.com/docs/api-reference/responses. * * Unsupported / opaque controls (background/include/metadata/prompt/…) are * accepted as `z.unknown().optional()` so we silently ignore rather than 400. * Real clients (OpenAI code backend, openai-python, llm-git) routinely send these and a 400 * is a worse outcome than dropping them on the floor. */ import type { EasyInputMessage, ResponseCreateParams, ResponseFunctionToolCall, ResponseInputContent, ResponseInputItem, ResponseOutputMessage, ResponseReasoningItem, Tool as ResponsesTool } from "openai/resources/responses/responses"; import * as z from "zod/v4"; declare const inputImageBlockSchema: z.ZodObject<{ type: z.ZodLiteral<"input_image">; detail: z.ZodOptional>; image_url: z.ZodOptional; file_id: z.ZodOptional; }, z.core.$strip>; declare const inputFileBlockSchema: z.ZodObject<{ type: z.ZodLiteral<"input_file">; file_id: z.ZodOptional; filename: z.ZodOptional; file_data: z.ZodOptional; }, z.core.$strip>; declare const outputRefusalSchema: z.ZodObject<{ type: z.ZodLiteral<"refusal">; refusal: z.ZodString; }, z.core.$strip>; declare const customToolCallItemSchema: z.ZodObject<{ type: z.ZodLiteral<"custom_tool_call">; id: z.ZodOptional; call_id: z.ZodString; name: z.ZodString; input: z.ZodString; }, z.core.$strip>; declare const customToolCallOutputItemSchema: z.ZodObject<{ type: z.ZodLiteral<"custom_tool_call_output">; call_id: z.ZodString; output: z.ZodString; }, z.core.$strip>; /** * An input item is one of the union members below. The convenience shape * `{role, content}` (no `type`) is mapped to "message" before validation in * the walker — schemas here only handle the canonical {type, ...} forms. */ export declare const inputItemSchema: z.ZodUnion>; role: z.ZodUnion, z.ZodLiteral<"developer">]>; content: z.ZodOptional; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"input_image">; detail: z.ZodOptional>; image_url: z.ZodOptional; file_id: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"input_file">; file_id: z.ZodOptional; filename: z.ZodOptional; file_data: z.ZodOptional; }, z.core.$strip>]>>]>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodOptional>; role: z.ZodLiteral<"system">; content: z.ZodOptional; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"input_image">; detail: z.ZodOptional>; image_url: z.ZodOptional; file_id: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"input_file">; file_id: z.ZodOptional; filename: z.ZodOptional; file_data: z.ZodOptional; }, z.core.$strip>]>>]>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodOptional>; role: z.ZodLiteral<"assistant">; content: z.ZodOptional; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"refusal">; refusal: z.ZodString; }, z.core.$strip>]>>]>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"reasoning">; id: z.ZodOptional; summary: z.ZodOptional; text: z.ZodString; }, z.core.$strip>>>; content: z.ZodOptional; text: z.ZodString; }, z.core.$strip>>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"function_call">; id: z.ZodOptional; call_id: z.ZodString; name: z.ZodString; arguments: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"function_call_output">; call_id: z.ZodString; output: z.ZodOptional; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"refusal">; refusal: z.ZodString; }, z.core.$strip>]>>]>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"custom_tool_call">; id: z.ZodOptional; call_id: z.ZodString; name: z.ZodString; input: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"custom_tool_call_output">; call_id: z.ZodString; output: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodString; }, z.core.$loose>]>; export type OpenAIResponsesUserItem = EasyInputMessage | ResponseInputItem.Message; export type OpenAIResponsesSystemItem = EasyInputMessage | ResponseInputItem.Message; export type OpenAIResponsesAssistantItem = EasyInputMessage | ResponseOutputMessage; export type OpenAIResponsesReasoningItem = ResponseReasoningItem; export type OpenAIResponsesFunctionCallItem = ResponseFunctionToolCall; export type OpenAIResponsesFunctionCallOutputItem = ResponseInputItem.FunctionCallOutput; /** Inferred shape of the custom tool call input item (no canonical SDK alias). */ export type OpenAIResponsesCustomToolCallItem = z.infer; export type OpenAIResponsesCustomToolCallOutputItem = z.infer; export type OpenAIResponsesInputImageBlock = z.infer; export type OpenAIResponsesInputFileBlock = z.infer; export type OpenAIResponsesOutputRefusalBlock = z.infer; export declare const toolSchema: z.ZodObject<{ type: z.ZodLiteral<"function">; name: z.ZodString; description: z.ZodOptional; parameters: z.ZodOptional>; strict: z.ZodOptional; }, z.core.$strip>; export declare const toolChoiceSchema: z.ZodUnion, z.ZodLiteral<"none">, z.ZodLiteral<"required">, z.ZodObject<{ type: z.ZodLiteral<"function">; name: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"custom">; name: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodEnum<{ code_interpreter: "code_interpreter"; computer_use_preview: "computer_use_preview"; file_search: "file_search"; image_generation: "image_generation"; mcp: "mcp"; web_search_preview: "web_search_preview"; }>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"allowed_tools">; mode: z.ZodEnum<{ auto: "auto"; required: "required"; }>; tools: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>]>; export declare const reasoningConfigSchema: z.ZodObject<{ effort: z.ZodOptional; summary: z.ZodOptional>; }, z.core.$strip>; export declare const stopSchema: z.ZodUnion, z.ZodNull]>; export declare const openaiResponsesRequestSchema: z.ZodObject<{ model: z.ZodString; input: z.ZodOptional>; role: z.ZodUnion, z.ZodLiteral<"developer">]>; content: z.ZodOptional; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"input_image">; detail: z.ZodOptional>; image_url: z.ZodOptional; file_id: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"input_file">; file_id: z.ZodOptional; filename: z.ZodOptional; file_data: z.ZodOptional; }, z.core.$strip>]>>]>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodOptional>; role: z.ZodLiteral<"system">; content: z.ZodOptional; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"input_image">; detail: z.ZodOptional>; image_url: z.ZodOptional; file_id: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"input_file">; file_id: z.ZodOptional; filename: z.ZodOptional; file_data: z.ZodOptional; }, z.core.$strip>]>>]>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodOptional>; role: z.ZodLiteral<"assistant">; content: z.ZodOptional; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"refusal">; refusal: z.ZodString; }, z.core.$strip>]>>]>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"reasoning">; id: z.ZodOptional; summary: z.ZodOptional; text: z.ZodString; }, z.core.$strip>>>; content: z.ZodOptional; text: z.ZodString; }, z.core.$strip>>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"function_call">; id: z.ZodOptional; call_id: z.ZodString; name: z.ZodString; arguments: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"function_call_output">; call_id: z.ZodString; output: z.ZodOptional; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"refusal">; refusal: z.ZodString; }, z.core.$strip>]>>]>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"custom_tool_call">; id: z.ZodOptional; call_id: z.ZodString; name: z.ZodString; input: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"custom_tool_call_output">; call_id: z.ZodString; output: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodString; }, z.core.$loose>]>>]>>; instructions: z.ZodOptional>; tools: z.ZodOptional; name: z.ZodString; description: z.ZodOptional; parameters: z.ZodOptional>; strict: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodString; }, z.core.$loose>]>>>; tool_choice: z.ZodOptional, z.ZodLiteral<"none">, z.ZodLiteral<"required">, z.ZodObject<{ type: z.ZodLiteral<"function">; name: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"custom">; name: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodEnum<{ code_interpreter: "code_interpreter"; computer_use_preview: "computer_use_preview"; file_search: "file_search"; image_generation: "image_generation"; mcp: "mcp"; web_search_preview: "web_search_preview"; }>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"allowed_tools">; mode: z.ZodEnum<{ auto: "auto"; required: "required"; }>; tools: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>]>>; max_output_tokens: z.ZodOptional; temperature: z.ZodOptional; top_p: z.ZodOptional; stop: z.ZodOptional, z.ZodNull]>>; stream: z.ZodOptional; reasoning: z.ZodOptional; summary: z.ZodOptional>; }, z.core.$strip>>; store: z.ZodOptional; previous_response_id: z.ZodOptional; parallel_tool_calls: z.ZodOptional; prompt_cache_key: z.ZodOptional; metadata: z.ZodOptional; user: z.ZodOptional; service_tier: z.ZodOptional; presence_penalty: z.ZodOptional; frequency_penalty: z.ZodOptional; background: z.ZodOptional; include: z.ZodOptional; prompt: z.ZodOptional; safety_identifier: z.ZodOptional; text: z.ZodOptional; top_logprobs: z.ZodOptional; truncation: z.ZodOptional; }, z.core.$strip>; /** * Public types are sourced from the OpenAI SDK so the gateway stays in * lock-step with the canonical API surface; the schemas above are runtime * validators for the subset we actually accept. */ export type OpenAIResponsesRequest = ResponseCreateParams; export type OpenAIResponsesInputItem = ResponseInputItem; export type OpenAIResponsesTool = ResponsesTool; export type OpenAIResponsesToolChoice = NonNullable; export type OpenAIResponsesInputContent = ResponseInputContent; export type OpenAIResponsesOutputContent = ResponseOutputMessage["content"][number]; export {};