diff --git a/packages/ai/anthropic/src/Generated.ts b/packages/ai/anthropic/src/Generated.ts index b1c471491..6013a46d6 100644 --- a/packages/ai/anthropic/src/Generated.ts +++ b/packages/ai/anthropic/src/Generated.ts @@ -17,6 +17,14 @@ export const APIError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Internal server error" }), "type": Schema.Literal("api_error").annotate({ "title": "Type", "default": "api_error" }) }).annotate({ "title": "APIError" }) +export type AllowedCaller = "direct" | "code_execution_20250825" | "code_execution_20260120" +export const AllowedCaller = Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"]).annotate( + { + "title": "AllowedCaller", + "description": + "Specifies who can invoke a tool.\n\nValues:\n direct: The model can call this tool directly.\n code_execution_20250825: The tool can be called from the code execution environment (v1).\n code_execution_20260120: The tool can be called from the code execution environment (v2 with persistence)." + } +) export type AuthenticationError = { readonly "message": string; readonly "type": "authentication_error" } export const AuthenticationError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Authentication error" }), @@ -65,6 +73,13 @@ export const BetaAPIError = Schema.Struct({ export type BetaAllThinkingTurns = { readonly "type": "all" } export const BetaAllThinkingTurns = Schema.Struct({ "type": Schema.Literal("all").annotate({ "title": "Type" }) }) .annotate({ "title": "AllThinkingTurns" }) +export type BetaAllowedCaller = "direct" | "code_execution_20250825" | "code_execution_20260120" +export const BetaAllowedCaller = Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"]) + .annotate({ + "title": "AllowedCaller", + "description": + "Specifies who can invoke a tool.\n\nValues:\n direct: The model can call this tool directly.\n code_execution_20250825: The tool can be called from the code execution environment (v1).\n code_execution_20260120: The tool can be called from the code execution environment (v2 with persistence)." + }) export type BetaAuthenticationError = { readonly "message": string; readonly "type": "authentication_error" } export const BetaAuthenticationError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Authentication error" }), @@ -173,6 +188,13 @@ export type BetaCanceledResult = { readonly "type": "canceled" } export const BetaCanceledResult = Schema.Struct({ "type": Schema.Literal("canceled").annotate({ "title": "Type", "default": "canceled" }) }).annotate({ "title": "CanceledResult" }) +export type BetaCapabilitySupport = { readonly "supported": boolean } +export const BetaCapabilitySupport = Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) +}).annotate({ "title": "CapabilitySupport", "description": "Indicates whether a capability is supported." }) export type BetaCodeExecutionToolResultErrorCode = | "invalid_tool_input" | "unavailable" @@ -635,30 +657,6 @@ export type BetaMessageStopEvent = { readonly "type": "message_stop" } export const BetaMessageStopEvent = Schema.Struct({ "type": Schema.Literal("message_stop").annotate({ "title": "Type", "default": "message_stop" }) }).annotate({ "title": "MessageStopEvent" }) -export type BetaModelInfo = { - readonly "created_at": string - readonly "display_name": string - readonly "id": string - readonly "type": "model" -} -export const BetaModelInfo = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": - "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.", - "format": "date-time" - }), - "display_name": Schema.String.annotate({ - "title": "Display Name", - "description": "A human-readable name for the model." - }), - "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }), - "type": Schema.Literal("model").annotate({ - "title": "Type", - "description": "Object type.\n\nFor Models, this is always `\"model\"`.", - "default": "model" - }) -}).annotate({ "title": "ModelInfo" }) export type BetaNotFoundError = { readonly "message": string; readonly "type": "not_found_error" } export const BetaNotFoundError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Not found" }), @@ -1338,33 +1336,48 @@ export const BetaTextEditorCodeExecutionToolResultErrorCode = Schema.Literals([ "execution_time_exceeded", "file_not_found" ]).annotate({ "title": "TextEditorCodeExecutionToolResultErrorCode" }) -export type BetaThinkingConfigAdaptive = { readonly "type": "adaptive" } -export const BetaThinkingConfigAdaptive = Schema.Struct({ - "type": Schema.Literal("adaptive").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigAdaptive" }) export type BetaThinkingConfigDisabled = { readonly "type": "disabled" } export const BetaThinkingConfigDisabled = Schema.Struct({ "type": Schema.Literal("disabled").annotate({ "title": "Type" }) }).annotate({ "title": "ThinkingConfigDisabled" }) -export type BetaThinkingConfigEnabled = { readonly "budget_tokens": number; readonly "type": "enabled" } -export const BetaThinkingConfigEnabled = Schema.Struct({ - "budget_tokens": Schema.Number.annotate({ - "title": "Budget Tokens", - "description": - "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)), - "type": Schema.Literal("enabled").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigEnabled" }) export type BetaThinkingContentBlockDelta = { readonly "thinking": string; readonly "type": "thinking_delta" } export const BetaThinkingContentBlockDelta = Schema.Struct({ "thinking": Schema.String.annotate({ "title": "Thinking" }), "type": Schema.Literal("thinking_delta").annotate({ "title": "Type", "default": "thinking_delta" }) }).annotate({ "title": "ThinkingContentBlockDelta" }) +export type BetaThinkingDisplayMode = "summarized" | "omitted" +export const BetaThinkingDisplayMode = Schema.Literals(["summarized", "omitted"]).annotate({ + "title": "ThinkingDisplayMode" +}) export type BetaThinkingTurns = { readonly "type": "thinking_turns"; readonly "value": number } export const BetaThinkingTurns = Schema.Struct({ "type": Schema.Literal("thinking_turns").annotate({ "title": "Type" }), "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)) }).annotate({ "title": "ThinkingTurns" }) +export type BetaThinkingTypes = { + readonly "adaptive": { readonly "supported": boolean } + readonly "enabled": { readonly "supported": boolean } +} +export const BetaThinkingTypes = Schema.Struct({ + "adaptive": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports thinking with type 'adaptive' (auto)." + }), + "enabled": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports thinking with type 'enabled'." + }) +}).annotate({ "title": "ThinkingTypes", "description": "Supported thinking type configurations." }) export type BetaToolChoiceAny = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "any" } export const BetaToolChoiceAny = Schema.Struct({ "disable_parallel_tool_use": Schema.optionalKey( @@ -1619,6 +1632,13 @@ export type CanceledResult = { readonly "type": "canceled" } export const CanceledResult = Schema.Struct({ "type": Schema.Literal("canceled").annotate({ "title": "Type", "default": "canceled" }) }).annotate({ "title": "CanceledResult" }) +export type CapabilitySupport = { readonly "supported": boolean } +export const CapabilitySupport = Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) +}).annotate({ "title": "CapabilitySupport", "description": "Indicates whether a capability is supported." }) export type CodeExecutionToolResultErrorCode = | "invalid_tool_input" | "unavailable" @@ -2065,30 +2085,6 @@ export type MessageStopEvent = { readonly "type": "message_stop" } export const MessageStopEvent = Schema.Struct({ "type": Schema.Literal("message_stop").annotate({ "title": "Type", "default": "message_stop" }) }).annotate({ "title": "MessageStopEvent" }) -export type ModelInfo = { - readonly "created_at": string - readonly "display_name": string - readonly "id": string - readonly "type": "model" -} -export const ModelInfo = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": - "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.", - "format": "date-time" - }), - "display_name": Schema.String.annotate({ - "title": "Display Name", - "description": "A human-readable name for the model." - }), - "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }), - "type": Schema.Literal("model").annotate({ - "title": "Type", - "description": "Object type.\n\nFor Models, this is always `\"model\"`.", - "default": "model" - }) -}).annotate({ "title": "ModelInfo" }) export type NotFoundError = { readonly "message": string; readonly "type": "not_found_error" } export const NotFoundError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Not found" }), @@ -2686,28 +2682,43 @@ export const TextEditorCodeExecutionToolResultErrorCode = Schema.Literals([ "execution_time_exceeded", "file_not_found" ]).annotate({ "title": "TextEditorCodeExecutionToolResultErrorCode" }) -export type ThinkingConfigAdaptive = { readonly "type": "adaptive" } -export const ThinkingConfigAdaptive = Schema.Struct({ - "type": Schema.Literal("adaptive").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigAdaptive" }) export type ThinkingConfigDisabled = { readonly "type": "disabled" } export const ThinkingConfigDisabled = Schema.Struct({ "type": Schema.Literal("disabled").annotate({ "title": "Type" }) }).annotate({ "title": "ThinkingConfigDisabled" }) -export type ThinkingConfigEnabled = { readonly "budget_tokens": number; readonly "type": "enabled" } -export const ThinkingConfigEnabled = Schema.Struct({ - "budget_tokens": Schema.Number.annotate({ - "title": "Budget Tokens", - "description": - "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)), - "type": Schema.Literal("enabled").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigEnabled" }) export type ThinkingContentBlockDelta = { readonly "thinking": string; readonly "type": "thinking_delta" } export const ThinkingContentBlockDelta = Schema.Struct({ "thinking": Schema.String.annotate({ "title": "Thinking" }), "type": Schema.Literal("thinking_delta").annotate({ "title": "Type", "default": "thinking_delta" }) }).annotate({ "title": "ThinkingContentBlockDelta" }) +export type ThinkingDisplayMode = "summarized" | "omitted" +export const ThinkingDisplayMode = Schema.Literals(["summarized", "omitted"]).annotate({ + "title": "ThinkingDisplayMode" +}) +export type ThinkingTypes = { + readonly "adaptive": { readonly "supported": boolean } + readonly "enabled": { readonly "supported": boolean } +} +export const ThinkingTypes = Schema.Struct({ + "adaptive": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports thinking with type 'adaptive' (auto)." + }), + "enabled": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports thinking with type 'enabled'." + }) +}).annotate({ "title": "ThinkingTypes", "description": "Supported thinking type configurations." }) export type ToolChoiceAny = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "any" } export const ToolChoiceAny = Schema.Struct({ "disable_parallel_tool_use": Schema.optionalKey( @@ -2874,48 +2885,34 @@ export const BetaStopReason = Schema.Literals([ export type Model = | "claude-opus-4-6" | "claude-sonnet-4-6" - | "claude-opus-4-5-20251101" - | "claude-opus-4-5" - | "claude-3-7-sonnet-latest" - | "claude-3-7-sonnet-20250219" - | "claude-3-5-haiku-latest" - | "claude-3-5-haiku-20241022" | "claude-haiku-4-5" | "claude-haiku-4-5-20251001" - | "claude-sonnet-4-20250514" - | "claude-sonnet-4-0" - | "claude-4-sonnet-20250514" + | "claude-opus-4-5" + | "claude-opus-4-5-20251101" | "claude-sonnet-4-5" | "claude-sonnet-4-5-20250929" + | "claude-opus-4-1" + | "claude-opus-4-1-20250805" | "claude-opus-4-0" | "claude-opus-4-20250514" - | "claude-4-opus-20250514" - | "claude-opus-4-1-20250805" - | "claude-3-opus-latest" - | "claude-3-opus-20240229" + | "claude-sonnet-4-0" + | "claude-sonnet-4-20250514" | "claude-3-haiku-20240307" export const Model = Schema.Literals([ "claude-opus-4-6", "claude-sonnet-4-6", - "claude-opus-4-5-20251101", - "claude-opus-4-5", - "claude-3-7-sonnet-latest", - "claude-3-7-sonnet-20250219", - "claude-3-5-haiku-latest", - "claude-3-5-haiku-20241022", "claude-haiku-4-5", "claude-haiku-4-5-20251001", - "claude-sonnet-4-20250514", - "claude-sonnet-4-0", - "claude-4-sonnet-20250514", + "claude-opus-4-5", + "claude-opus-4-5-20251101", "claude-sonnet-4-5", "claude-sonnet-4-5-20250929", + "claude-opus-4-1", + "claude-opus-4-1-20250805", "claude-opus-4-0", "claude-opus-4-20250514", - "claude-4-opus-20250514", - "claude-opus-4-1-20250805", - "claude-3-opus-latest", - "claude-3-opus-20240229", + "claude-sonnet-4-0", + "claude-sonnet-4-20250514", "claude-3-haiku-20240307" ]).annotate({ "title": "Model", @@ -3029,7 +3026,7 @@ export const BetaResponseBashCodeExecutionToolResultError = Schema.Struct({ }) }).annotate({ "title": "ResponseBashCodeExecutionToolResultError" }) export type BetaCodeExecutionTool_20250522 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "code_execution" @@ -3037,11 +3034,7 @@ export type BetaCodeExecutionTool_20250522 = { readonly "type": "code_execution_20250522" } export const BetaCodeExecutionTool_20250522 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3068,7 +3061,7 @@ export const BetaCodeExecutionTool_20250522 = Schema.Struct({ "type": Schema.Literal("code_execution_20250522").annotate({ "title": "Type" }) }).annotate({ "title": "CodeExecutionTool_20250522" }) export type BetaCodeExecutionTool_20250825 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "code_execution" @@ -3076,11 +3069,7 @@ export type BetaCodeExecutionTool_20250825 = { readonly "type": "code_execution_20250825" } export const BetaCodeExecutionTool_20250825 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3107,7 +3096,7 @@ export const BetaCodeExecutionTool_20250825 = Schema.Struct({ "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) }).annotate({ "title": "CodeExecutionTool_20250825" }) export type BetaCodeExecutionTool_20260120 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "code_execution" @@ -3115,11 +3104,7 @@ export type BetaCodeExecutionTool_20260120 = { readonly "type": "code_execution_20260120" } export const BetaCodeExecutionTool_20260120 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3231,7 +3216,7 @@ export const BetaRequestToolReferenceBlock = Schema.Struct({ "description": "Tool reference block that can be included in tool_result content." }) export type BetaToolSearchToolBM25_20251119 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "tool_search_tool_bm25" @@ -3239,11 +3224,7 @@ export type BetaToolSearchToolBM25_20251119 = { readonly "type": "tool_search_tool_bm25_20251119" | "tool_search_tool_bm25" } export const BetaToolSearchToolBM25_20251119 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3270,7 +3251,7 @@ export const BetaToolSearchToolBM25_20251119 = Schema.Struct({ "type": Schema.Literals(["tool_search_tool_bm25_20251119", "tool_search_tool_bm25"]).annotate({ "title": "Type" }) }).annotate({ "title": "ToolSearchToolBM25_20251119" }) export type BetaToolSearchToolRegex_20251119 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "tool_search_tool_regex" @@ -3278,11 +3259,7 @@ export type BetaToolSearchToolRegex_20251119 = { readonly "type": "tool_search_tool_regex_20251119" | "tool_search_tool_regex" } export const BetaToolSearchToolRegex_20251119 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3475,7 +3452,7 @@ export const BetaCompact20260112 = Schema.Struct({ "description": "Automatically compact older context when reaching the configured trigger threshold." }) export type BetaBashTool_20241022 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> @@ -3484,11 +3461,7 @@ export type BetaBashTool_20241022 = { readonly "type": "bash_20241022" } export const BetaBashTool_20241022 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3518,7 +3491,7 @@ export const BetaBashTool_20241022 = Schema.Struct({ "type": Schema.Literal("bash_20241022").annotate({ "title": "Type" }) }).annotate({ "title": "BashTool_20241022" }) export type BetaBashTool_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> @@ -3527,11 +3500,7 @@ export type BetaBashTool_20250124 = { readonly "type": "bash_20250124" } export const BetaBashTool_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3561,7 +3530,7 @@ export const BetaBashTool_20250124 = Schema.Struct({ "type": Schema.Literal("bash_20250124").annotate({ "title": "Type" }) }).annotate({ "title": "BashTool_20250124" }) export type BetaComputerUseTool_20241022 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "display_height_px": number @@ -3573,11 +3542,7 @@ export type BetaComputerUseTool_20241022 = { readonly "type": "computer_20241022" } export const BetaComputerUseTool_20241022 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3621,7 +3586,7 @@ export const BetaComputerUseTool_20241022 = Schema.Struct({ "type": Schema.Literal("computer_20241022").annotate({ "title": "Type" }) }).annotate({ "title": "ComputerUseTool_20241022" }) export type BetaComputerUseTool_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "display_height_px": number @@ -3633,11 +3598,7 @@ export type BetaComputerUseTool_20250124 = { readonly "type": "computer_20250124" } export const BetaComputerUseTool_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3681,7 +3642,7 @@ export const BetaComputerUseTool_20250124 = Schema.Struct({ "type": Schema.Literal("computer_20250124").annotate({ "title": "Type" }) }).annotate({ "title": "ComputerUseTool_20250124" }) export type BetaComputerUseTool_20251124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "display_height_px": number @@ -3694,11 +3655,7 @@ export type BetaComputerUseTool_20251124 = { readonly "type": "computer_20251124" } export const BetaComputerUseTool_20251124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3748,7 +3705,7 @@ export const BetaComputerUseTool_20251124 = Schema.Struct({ "type": Schema.Literal("computer_20251124").annotate({ "title": "Type" }) }).annotate({ "title": "ComputerUseTool_20251124" }) export type BetaMemoryTool_20250818 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> @@ -3757,11 +3714,7 @@ export type BetaMemoryTool_20250818 = { readonly "type": "memory_20250818" } export const BetaMemoryTool_20250818 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3791,7 +3744,7 @@ export const BetaMemoryTool_20250818 = Schema.Struct({ "type": Schema.Literal("memory_20250818").annotate({ "title": "Type" }) }).annotate({ "title": "MemoryTool_20250818" }) export type BetaTextEditor_20241022 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> @@ -3800,11 +3753,7 @@ export type BetaTextEditor_20241022 = { readonly "type": "text_editor_20241022" } export const BetaTextEditor_20241022 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3834,7 +3783,7 @@ export const BetaTextEditor_20241022 = Schema.Struct({ "type": Schema.Literal("text_editor_20241022").annotate({ "title": "Type" }) }).annotate({ "title": "TextEditor_20241022" }) export type BetaTextEditor_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> @@ -3843,11 +3792,7 @@ export type BetaTextEditor_20250124 = { readonly "type": "text_editor_20250124" } export const BetaTextEditor_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3877,7 +3822,7 @@ export const BetaTextEditor_20250124 = Schema.Struct({ "type": Schema.Literal("text_editor_20250124").annotate({ "title": "Type" }) }).annotate({ "title": "TextEditor_20250124" }) export type BetaTextEditor_20250429 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> @@ -3886,11 +3831,7 @@ export type BetaTextEditor_20250429 = { readonly "type": "text_editor_20250429" } export const BetaTextEditor_20250429 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3920,7 +3861,7 @@ export const BetaTextEditor_20250429 = Schema.Struct({ "type": Schema.Literal("text_editor_20250429").annotate({ "title": "Type" }) }).annotate({ "title": "TextEditor_20250429" }) export type BetaTextEditor_20250728 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> @@ -3930,11 +3871,7 @@ export type BetaTextEditor_20250728 = { readonly "type": "text_editor_20250728" } export const BetaTextEditor_20250728 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3983,7 +3920,7 @@ export type BetaTool = { readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "strict"?: boolean readonly "eager_input_streaming"?: boolean | null - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> } @@ -4035,11 +3972,7 @@ export const BetaTool = Schema.Struct({ "Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers." }) ), - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ "title": "Defer Loading", @@ -4111,27 +4044,6 @@ export const BetaListResponse_MessageBatch_ = Schema.Struct({ "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." }) }).annotate({ "title": "ListResponse[MessageBatch]" }) -export type BetaListResponse_ModelInfo_ = { - readonly "data": ReadonlyArray - readonly "first_id": string | null - readonly "has_more": boolean - readonly "last_id": string | null -} -export const BetaListResponse_ModelInfo_ = Schema.Struct({ - "data": Schema.Array(BetaModelInfo).annotate({ "title": "Data" }), - "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }), - "has_more": Schema.Boolean.annotate({ - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }), - "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." - }) -}).annotate({ "title": "ListResponse[ModelInfo]" }) export type BetaErrorResponse = { readonly "error": | BetaInvalidRequestError @@ -4176,7 +4088,7 @@ export const BetaRequestBashCodeExecutionResultBlock = Schema.Struct({ "type": Schema.Literal("bash_code_execution_result").annotate({ "title": "Type" }) }).annotate({ "title": "RequestBashCodeExecutionResultBlock" }) export type BetaWebFetchTool_20250910 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: BetaCacheControlEphemeral | null @@ -4189,11 +4101,7 @@ export type BetaWebFetchTool_20250910 = { readonly "type": "web_fetch_20250910" } export const BetaWebFetchTool_20250910 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", @@ -4250,7 +4158,7 @@ export const BetaWebFetchTool_20250910 = Schema.Struct({ "type": Schema.Literal("web_fetch_20250910").annotate({ "title": "Type" }) }).annotate({ "title": "WebFetchTool_20250910" }) export type BetaWebFetchTool_20260209 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: BetaCacheControlEphemeral | null @@ -4263,11 +4171,7 @@ export type BetaWebFetchTool_20260209 = { readonly "type": "web_fetch_20260209" } export const BetaWebFetchTool_20260209 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", @@ -4323,6 +4227,87 @@ export const BetaWebFetchTool_20260209 = Schema.Struct({ ), "type": Schema.Literal("web_fetch_20260209").annotate({ "title": "Type" }) }).annotate({ "title": "WebFetchTool_20260209" }) +export type BetaWebFetchTool_20260309 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: BetaRequestCitationsConfig | null + readonly "defer_loading"?: boolean + readonly "max_content_tokens"?: number | null + readonly "max_uses"?: number | null + readonly "name": "web_fetch" + readonly "strict"?: boolean + readonly "type": "web_fetch_20260309" + readonly "use_cache"?: boolean +} +export const BetaWebFetchTool_20260309 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": "List of domains to allow fetching from" + }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": "List of domains to block fetching from" + }) + ), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "citations": Schema.optionalKey( + Schema.Union([BetaRequestCitationsConfig, Schema.Null]).annotate({ + "description": "Citations configuration for fetched documents. Citations are disabled by default." + }) + ), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) + ), + "max_content_tokens": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Content Tokens", + "description": + "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + }) + ), + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "name": Schema.Literal("web_fetch").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("web_fetch_20260309").annotate({ "title": "Type" }), + "use_cache": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Use Cache", + "description": + "Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources." + }) + ) +}).annotate({ + "title": "WebFetchTool_20260309", + "description": "Web fetch tool with use_cache parameter for bypassing cached content." +}) export type BetaRequestCodeExecutionResultBlock = { readonly "content": ReadonlyArray readonly "return_code": number @@ -4845,25 +4830,44 @@ export const BetaResponseTextEditorCodeExecutionToolResultError = Schema.Struct( "default": "text_editor_code_execution_tool_result_error" }) }).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultError" }) -export type BetaThinkingConfigParam = - | BetaThinkingConfigEnabled - | BetaThinkingConfigDisabled - | BetaThinkingConfigAdaptive -export const BetaThinkingConfigParam = Schema.Union([ - BetaThinkingConfigEnabled, - BetaThinkingConfigDisabled, - BetaThinkingConfigAdaptive -], { mode: "oneOf" }).annotate({ - "title": "Thinking", - "description": - "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." -}) -export type BetaClearThinking20251015 = { - readonly "keep"?: BetaThinkingTurns | BetaAllThinkingTurns | "all" - readonly "type": "clear_thinking_20251015" +export type BetaThinkingConfigAdaptive = { + readonly "display"?: BetaThinkingDisplayMode | null + readonly "type": "adaptive" } -export const BetaClearThinking20251015 = Schema.Struct({ - "keep": Schema.optionalKey( +export const BetaThinkingConfigAdaptive = Schema.Struct({ + "display": Schema.optionalKey( + Schema.Union([BetaThinkingDisplayMode, Schema.Null]).annotate({ + "description": + "Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`." + }) + ), + "type": Schema.Literal("adaptive").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigAdaptive" }) +export type BetaThinkingConfigEnabled = { + readonly "budget_tokens": number + readonly "display"?: BetaThinkingDisplayMode | null + readonly "type": "enabled" +} +export const BetaThinkingConfigEnabled = Schema.Struct({ + "budget_tokens": Schema.Number.annotate({ + "title": "Budget Tokens", + "description": + "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)), + "display": Schema.optionalKey( + Schema.Union([BetaThinkingDisplayMode, Schema.Null]).annotate({ + "description": + "Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`." + }) + ), + "type": Schema.Literal("enabled").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigEnabled" }) +export type BetaClearThinking20251015 = { + readonly "keep"?: BetaThinkingTurns | BetaAllThinkingTurns | "all" + readonly "type": "clear_thinking_20251015" +} +export const BetaClearThinking20251015 = Schema.Struct({ + "keep": Schema.optionalKey( Schema.Union([Schema.Union([BetaThinkingTurns, BetaAllThinkingTurns], { mode: "oneOf" }), Schema.Literal("all")]) .annotate({ "title": "Keep", @@ -4873,6 +4877,130 @@ export const BetaClearThinking20251015 = Schema.Struct({ ), "type": Schema.Literal("clear_thinking_20251015").annotate({ "title": "Type" }) }).annotate({ "title": "ClearThinking20251015" }) +export type BetaModelCapabilities = { + readonly "batch": { readonly "supported": boolean } + readonly "citations": { readonly "supported": boolean } + readonly "code_execution": { readonly "supported": boolean } + readonly "context_management": { + readonly "clear_thinking_20251015": BetaCapabilitySupport | null + readonly "clear_tool_uses_20250919": BetaCapabilitySupport | null + readonly "compact_20260112": BetaCapabilitySupport | null + readonly "supported": boolean + } + readonly "effort": { + readonly "high": { readonly "supported": boolean } + readonly "low": { readonly "supported": boolean } + readonly "max": { readonly "supported": boolean } + readonly "medium": { readonly "supported": boolean } + readonly "supported": boolean + } + readonly "image_input": { readonly "supported": boolean } + readonly "pdf_input": { readonly "supported": boolean } + readonly "structured_outputs": { readonly "supported": boolean } + readonly "thinking": { readonly "supported": boolean; readonly "types": BetaThinkingTypes } +} +export const BetaModelCapabilities = Schema.Struct({ + "batch": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports the Batch API." }), + "citations": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports citation generation." }), + "code_execution": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports code execution tools." }), + "context_management": Schema.Struct({ + "clear_thinking_20251015": Schema.Union([BetaCapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the clear_thinking_20251015 strategy is supported." + }), + "clear_tool_uses_20250919": Schema.Union([BetaCapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the clear_tool_uses_20250919 strategy is supported." + }), + "compact_20260112": Schema.Union([BetaCapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the compact_20260112 strategy is supported." + }), + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "ContextManagementCapability", + "description": "Context management support and available strategies." + }), + "effort": Schema.Struct({ + "high": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports high effort level." }), + "low": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports low effort level." }), + "max": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports max effort level." }), + "medium": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports medium effort level." }), + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "EffortCapability", + "description": "Effort (reasoning_effort) support and available levels." + }), + "image_input": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model accepts image content blocks." }), + "pdf_input": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model accepts PDF content blocks." }), + "structured_outputs": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports structured output / JSON mode / strict tool schemas." + }), + "thinking": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }), + "types": BetaThinkingTypes + }).annotate({ + "title": "ThinkingCapability", + "description": "Thinking capability and supported type configurations." + }) +}).annotate({ "title": "ModelCapabilities", "description": "Model capability information." }) export type BetaToolChoice = BetaToolChoiceAuto | BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceNone export const BetaToolChoice = Schema.Union([ BetaToolChoiceAuto, @@ -4964,7 +5092,7 @@ export const BetaRequestImageBlock = Schema.Struct({ "type": Schema.Literal("image").annotate({ "title": "Type" }) }).annotate({ "title": "RequestImageBlock" }) export type BetaWebSearchTool_20250305 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: BetaCacheControlEphemeral | null @@ -4976,11 +5104,7 @@ export type BetaWebSearchTool_20250305 = { readonly "user_location"?: BetaUserLocation | null } export const BetaWebSearchTool_20250305 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", @@ -5032,7 +5156,7 @@ export const BetaWebSearchTool_20250305 = Schema.Struct({ ) }).annotate({ "title": "WebSearchTool_20250305" }) export type BetaWebSearchTool_20260209 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: BetaCacheControlEphemeral | null @@ -5044,11 +5168,7 @@ export type BetaWebSearchTool_20260209 = { readonly "user_location"?: BetaUserLocation | null } export const BetaWebSearchTool_20260209 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", @@ -5156,7 +5276,7 @@ export const BetaListSkillsResponse = Schema.Struct({ }) }).annotate({ "title": "ListSkillsResponse" }) export type CodeExecutionTool_20250522 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "code_execution" @@ -5164,11 +5284,7 @@ export type CodeExecutionTool_20250522 = { readonly "type": "code_execution_20250522" } export const CodeExecutionTool_20250522 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5195,7 +5311,7 @@ export const CodeExecutionTool_20250522 = Schema.Struct({ "type": Schema.Literal("code_execution_20250522").annotate({ "title": "Type" }) }).annotate({ "title": "CodeExecutionTool_20250522" }) export type CodeExecutionTool_20250825 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "code_execution" @@ -5203,11 +5319,7 @@ export type CodeExecutionTool_20250825 = { readonly "type": "code_execution_20250825" } export const CodeExecutionTool_20250825 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5234,7 +5346,7 @@ export const CodeExecutionTool_20250825 = Schema.Struct({ "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) }).annotate({ "title": "CodeExecutionTool_20250825" }) export type CodeExecutionTool_20260120 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "code_execution" @@ -5242,11 +5354,7 @@ export type CodeExecutionTool_20260120 = { readonly "type": "code_execution_20260120" } export const CodeExecutionTool_20260120 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5315,7 +5423,7 @@ export const RequestToolReferenceBlock = Schema.Struct({ "description": "Tool reference block that can be included in tool_result content." }) export type ToolSearchToolBM25_20251119 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "tool_search_tool_bm25" @@ -5323,11 +5431,7 @@ export type ToolSearchToolBM25_20251119 = { readonly "type": "tool_search_tool_bm25_20251119" | "tool_search_tool_bm25" } export const ToolSearchToolBM25_20251119 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5354,7 +5458,7 @@ export const ToolSearchToolBM25_20251119 = Schema.Struct({ "type": Schema.Literals(["tool_search_tool_bm25_20251119", "tool_search_tool_bm25"]).annotate({ "title": "Type" }) }).annotate({ "title": "ToolSearchToolBM25_20251119" }) export type ToolSearchToolRegex_20251119 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "name": "tool_search_tool_regex" @@ -5362,11 +5466,7 @@ export type ToolSearchToolRegex_20251119 = { readonly "type": "tool_search_tool_regex_20251119" | "tool_search_tool_regex" } export const ToolSearchToolRegex_20251119 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5443,7 +5543,7 @@ export const FileListResponse = Schema.Struct({ ) }).annotate({ "title": "FileListResponse" }) export type BashTool_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> @@ -5452,11 +5552,7 @@ export type BashTool_20250124 = { readonly "type": "bash_20250124" } export const BashTool_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5486,7 +5582,7 @@ export const BashTool_20250124 = Schema.Struct({ "type": Schema.Literal("bash_20250124").annotate({ "title": "Type" }) }).annotate({ "title": "BashTool_20250124" }) export type MemoryTool_20250818 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> @@ -5495,11 +5591,7 @@ export type MemoryTool_20250818 = { readonly "type": "memory_20250818" } export const MemoryTool_20250818 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5529,7 +5621,7 @@ export const MemoryTool_20250818 = Schema.Struct({ "type": Schema.Literal("memory_20250818").annotate({ "title": "Type" }) }).annotate({ "title": "MemoryTool_20250818" }) export type TextEditor_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> @@ -5538,11 +5630,7 @@ export type TextEditor_20250124 = { readonly "type": "text_editor_20250124" } export const TextEditor_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5572,7 +5660,7 @@ export const TextEditor_20250124 = Schema.Struct({ "type": Schema.Literal("text_editor_20250124").annotate({ "title": "Type" }) }).annotate({ "title": "TextEditor_20250124" }) export type TextEditor_20250429 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> @@ -5581,11 +5669,7 @@ export type TextEditor_20250429 = { readonly "type": "text_editor_20250429" } export const TextEditor_20250429 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5615,7 +5699,7 @@ export const TextEditor_20250429 = Schema.Struct({ "type": Schema.Literal("text_editor_20250429").annotate({ "title": "Type" }) }).annotate({ "title": "TextEditor_20250429" }) export type TextEditor_20250728 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> @@ -5625,11 +5709,7 @@ export type TextEditor_20250728 = { readonly "type": "text_editor_20250728" } export const TextEditor_20250728 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -5678,7 +5758,7 @@ export type Tool = { readonly "cache_control"?: CacheControlEphemeral | null readonly "strict"?: boolean readonly "eager_input_streaming"?: boolean | null - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> } @@ -5730,11 +5810,7 @@ export const Tool = Schema.Struct({ "Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers." }) ), - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ "title": "Defer Loading", @@ -5767,27 +5843,6 @@ export const ListResponse_MessageBatch_ = Schema.Struct({ "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." }) }).annotate({ "title": "ListResponse[MessageBatch]" }) -export type ListResponse_ModelInfo_ = { - readonly "data": ReadonlyArray - readonly "first_id": string | null - readonly "has_more": boolean - readonly "last_id": string | null -} -export const ListResponse_ModelInfo_ = Schema.Struct({ - "data": Schema.Array(ModelInfo).annotate({ "title": "Data" }), - "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }), - "has_more": Schema.Boolean.annotate({ - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }), - "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." - }) -}).annotate({ "title": "ListResponse[ModelInfo]" }) export type ErrorResponse = { readonly "error": | InvalidRequestError @@ -5832,7 +5887,7 @@ export const RequestBashCodeExecutionResultBlock = Schema.Struct({ "type": Schema.Literal("bash_code_execution_result").annotate({ "title": "Type" }) }).annotate({ "title": "RequestBashCodeExecutionResultBlock" }) export type WebFetchTool_20250910 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: CacheControlEphemeral | null @@ -5845,11 +5900,7 @@ export type WebFetchTool_20250910 = { readonly "type": "web_fetch_20250910" } export const WebFetchTool_20250910 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", @@ -5906,7 +5957,7 @@ export const WebFetchTool_20250910 = Schema.Struct({ "type": Schema.Literal("web_fetch_20250910").annotate({ "title": "Type" }) }).annotate({ "title": "WebFetchTool_20250910" }) export type WebFetchTool_20260209 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: CacheControlEphemeral | null @@ -5919,11 +5970,7 @@ export type WebFetchTool_20260209 = { readonly "type": "web_fetch_20260209" } export const WebFetchTool_20260209 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", @@ -5979,6 +6026,87 @@ export const WebFetchTool_20260209 = Schema.Struct({ ), "type": Schema.Literal("web_fetch_20260209").annotate({ "title": "Type" }) }).annotate({ "title": "WebFetchTool_20260209" }) +export type WebFetchTool_20260309 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null + readonly "cache_control"?: CacheControlEphemeral | null + readonly "citations"?: RequestCitationsConfig | null + readonly "defer_loading"?: boolean + readonly "max_content_tokens"?: number | null + readonly "max_uses"?: number | null + readonly "name": "web_fetch" + readonly "strict"?: boolean + readonly "type": "web_fetch_20260309" + readonly "use_cache"?: boolean +} +export const WebFetchTool_20260309 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": "List of domains to allow fetching from" + }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": "List of domains to block fetching from" + }) + ), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "citations": Schema.optionalKey( + Schema.Union([RequestCitationsConfig, Schema.Null]).annotate({ + "description": "Citations configuration for fetched documents. Citations are disabled by default." + }) + ), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) + ), + "max_content_tokens": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Content Tokens", + "description": + "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + }) + ), + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "name": Schema.Literal("web_fetch").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("web_fetch_20260309").annotate({ "title": "Type" }), + "use_cache": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Use Cache", + "description": + "Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources." + }) + ) +}).annotate({ + "title": "WebFetchTool_20260309", + "description": "Web fetch tool with use_cache parameter for bypassing cached content." +}) export type RequestCodeExecutionResultBlock = { readonly "content": ReadonlyArray readonly "return_code": number @@ -6332,15 +6460,159 @@ export const ResponseTextEditorCodeExecutionToolResultError = Schema.Struct({ "default": "text_editor_code_execution_tool_result_error" }) }).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultError" }) -export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive -export const ThinkingConfigParam = Schema.Union( - [ThinkingConfigEnabled, ThinkingConfigDisabled, ThinkingConfigAdaptive], - { mode: "oneOf" } -).annotate({ - "title": "Thinking", - "description": - "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." -}) +export type ThinkingConfigAdaptive = { readonly "display"?: ThinkingDisplayMode | null; readonly "type": "adaptive" } +export const ThinkingConfigAdaptive = Schema.Struct({ + "display": Schema.optionalKey( + Schema.Union([ThinkingDisplayMode, Schema.Null]).annotate({ + "description": + "Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`." + }) + ), + "type": Schema.Literal("adaptive").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigAdaptive" }) +export type ThinkingConfigEnabled = { + readonly "budget_tokens": number + readonly "display"?: ThinkingDisplayMode | null + readonly "type": "enabled" +} +export const ThinkingConfigEnabled = Schema.Struct({ + "budget_tokens": Schema.Number.annotate({ + "title": "Budget Tokens", + "description": + "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)), + "display": Schema.optionalKey( + Schema.Union([ThinkingDisplayMode, Schema.Null]).annotate({ + "description": + "Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`." + }) + ), + "type": Schema.Literal("enabled").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigEnabled" }) +export type ModelCapabilities = { + readonly "batch": { readonly "supported": boolean } + readonly "citations": { readonly "supported": boolean } + readonly "code_execution": { readonly "supported": boolean } + readonly "context_management": { + readonly "clear_thinking_20251015": CapabilitySupport | null + readonly "clear_tool_uses_20250919": CapabilitySupport | null + readonly "compact_20260112": CapabilitySupport | null + readonly "supported": boolean + } + readonly "effort": { + readonly "high": { readonly "supported": boolean } + readonly "low": { readonly "supported": boolean } + readonly "max": { readonly "supported": boolean } + readonly "medium": { readonly "supported": boolean } + readonly "supported": boolean + } + readonly "image_input": { readonly "supported": boolean } + readonly "pdf_input": { readonly "supported": boolean } + readonly "structured_outputs": { readonly "supported": boolean } + readonly "thinking": { readonly "supported": boolean; readonly "types": ThinkingTypes } +} +export const ModelCapabilities = Schema.Struct({ + "batch": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports the Batch API." }), + "citations": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports citation generation." }), + "code_execution": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports code execution tools." }), + "context_management": Schema.Struct({ + "clear_thinking_20251015": Schema.Union([CapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the clear_thinking_20251015 strategy is supported." + }), + "clear_tool_uses_20250919": Schema.Union([CapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the clear_tool_uses_20250919 strategy is supported." + }), + "compact_20260112": Schema.Union([CapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the compact_20260112 strategy is supported." + }), + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "ContextManagementCapability", + "description": "Context management support and available strategies." + }), + "effort": Schema.Struct({ + "high": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports high effort level." }), + "low": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports low effort level." }), + "max": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports max effort level." }), + "medium": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports medium effort level." }), + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "EffortCapability", + "description": "Effort (reasoning_effort) support and available levels." + }), + "image_input": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model accepts image content blocks." }), + "pdf_input": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model accepts PDF content blocks." }), + "structured_outputs": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports structured output / JSON mode / strict tool schemas." + }), + "thinking": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }), + "types": ThinkingTypes + }).annotate({ + "title": "ThinkingCapability", + "description": "Thinking capability and supported type configurations." + }) +}).annotate({ "title": "ModelCapabilities", "description": "Model capability information." }) export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone export const ToolChoice = Schema.Union([ToolChoiceAuto, ToolChoiceAny, ToolChoiceTool, ToolChoiceNone], { mode: "oneOf" @@ -6386,7 +6658,7 @@ export const RequestImageBlock = Schema.Struct({ "type": Schema.Literal("image").annotate({ "title": "Type" }) }).annotate({ "title": "RequestImageBlock" }) export type WebSearchTool_20250305 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: CacheControlEphemeral | null @@ -6398,11 +6670,7 @@ export type WebSearchTool_20250305 = { readonly "user_location"?: UserLocation | null } export const WebSearchTool_20250305 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", @@ -6454,7 +6722,7 @@ export const WebSearchTool_20250305 = Schema.Struct({ ) }).annotate({ "title": "WebSearchTool_20250305" }) export type WebSearchTool_20260209 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: CacheControlEphemeral | null @@ -6466,11 +6734,7 @@ export type WebSearchTool_20260209 = { readonly "user_location"?: UserLocation | null } export const WebSearchTool_20260209 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", @@ -6627,7 +6891,7 @@ export const CompletionRequest = Schema.Struct({ "metadata": Schema.optionalKey( Schema.Struct({ "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "User Id", "description": "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." @@ -6681,7 +6945,7 @@ export const BetaRequestToolSearchToolSearchResultBlock = Schema.Struct({ }).annotate({ "title": "RequestToolSearchToolSearchResultBlock" }) export type BetaIterationsUsage = ReadonlyArray | null export const BetaIterationsUsage = Schema.Union([ - Schema.Array(Schema.Union([BetaMessageIterationUsage, BetaCompactionIterationUsage])), + Schema.Array(Schema.Union([BetaMessageIterationUsage, BetaCompactionIterationUsage], { mode: "oneOf" })), Schema.Null ]).annotate({ "title": "Iterations", @@ -6906,6 +7170,58 @@ export const BetaResponseTextEditorCodeExecutionToolResultBlock = Schema.Struct( "default": "text_editor_code_execution_tool_result" }) }).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultBlock" }) +export type BetaThinkingConfigParam = + | BetaThinkingConfigEnabled + | BetaThinkingConfigDisabled + | BetaThinkingConfigAdaptive +export const BetaThinkingConfigParam = Schema.Union([ + BetaThinkingConfigEnabled, + BetaThinkingConfigDisabled, + BetaThinkingConfigAdaptive +], { mode: "oneOf" }).annotate({ + "title": "Thinking", + "description": + "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." +}) +export type BetaModelInfo = { + readonly "capabilities": BetaModelCapabilities | null + readonly "created_at": string + readonly "display_name": string + readonly "id": string + readonly "max_input_tokens": number | null + readonly "max_tokens": number | null + readonly "type": "model" +} +export const BetaModelInfo = Schema.Struct({ + "capabilities": Schema.Union([BetaModelCapabilities, Schema.Null]).annotate({ + "description": + "Object mapping capability names to their support details. Keys are always present for all known capabilities." + }), + "created_at": Schema.String.annotate({ + "title": "Created At", + "description": + "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.", + "format": "date-time" + }), + "display_name": Schema.String.annotate({ + "title": "Display Name", + "description": "A human-readable name for the model." + }), + "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }), + "max_input_tokens": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Max Input Tokens", + "description": "Maximum input context window size in tokens for this model." + }), + "max_tokens": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Max Tokens", + "description": "Maximum value for the `max_tokens` parameter when using this model." + }), + "type": Schema.Literal("model").annotate({ + "title": "Type", + "description": "Object type.\n\nFor Models, this is always `\"model\"`.", + "default": "model" + }) +}).annotate({ "title": "ModelInfo" }) export type BetaResponseToolSearchToolResultBlock = { readonly "content": BetaResponseToolSearchToolResultError | BetaResponseToolSearchToolSearchResultBlock readonly "tool_use_id": string @@ -7202,6 +7518,54 @@ export const ResponseTextEditorCodeExecutionToolResultBlock = Schema.Struct({ "default": "text_editor_code_execution_tool_result" }) }).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultBlock" }) +export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive +export const ThinkingConfigParam = Schema.Union( + [ThinkingConfigEnabled, ThinkingConfigDisabled, ThinkingConfigAdaptive], + { mode: "oneOf" } +).annotate({ + "title": "Thinking", + "description": + "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." +}) +export type ModelInfo = { + readonly "capabilities": ModelCapabilities | null + readonly "created_at": string + readonly "display_name": string + readonly "id": string + readonly "max_input_tokens": number | null + readonly "max_tokens": number | null + readonly "type": "model" +} +export const ModelInfo = Schema.Struct({ + "capabilities": Schema.Union([ModelCapabilities, Schema.Null]).annotate({ + "description": + "Object mapping capability names to their support details. Keys are always present for all known capabilities." + }), + "created_at": Schema.String.annotate({ + "title": "Created At", + "description": + "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.", + "format": "date-time" + }), + "display_name": Schema.String.annotate({ + "title": "Display Name", + "description": "A human-readable name for the model." + }), + "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }), + "max_input_tokens": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Max Input Tokens", + "description": "Maximum input context window size in tokens for this model." + }), + "max_tokens": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Max Tokens", + "description": "Maximum value for the `max_tokens` parameter when using this model." + }), + "type": Schema.Literal("model").annotate({ + "title": "Type", + "description": "Object type.\n\nFor Models, this is always `\"model\"`.", + "default": "model" + }) +}).annotate({ "title": "ModelInfo" }) export type ResponseToolSearchToolResultBlock = { readonly "content": ResponseToolSearchToolResultError | ResponseToolSearchToolSearchResultBlock readonly "tool_use_id": string @@ -7438,6 +7802,27 @@ export const BetaMessageDeltaEvent = Schema.Struct({ "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`." }) }).annotate({ "title": "MessageDeltaEvent" }) +export type BetaListResponse_ModelInfo_ = { + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "has_more": boolean + readonly "last_id": string | null +} +export const BetaListResponse_ModelInfo_ = Schema.Struct({ + "data": Schema.Array(BetaModelInfo).annotate({ "title": "Data" }), + "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "First Id", + "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." + }), + "has_more": Schema.Boolean.annotate({ + "title": "Has More", + "description": "Indicates if there are more results in the requested page direction." + }), + "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Last Id", + "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." + }) +}).annotate({ "title": "ListResponse[ModelInfo]" }) export type BetaRequestDocumentBlock = { readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "citations"?: BetaRequestCitationsConfig | null @@ -7516,6 +7901,27 @@ export const ResponseWebFetchToolResultBlock = Schema.Struct({ ), "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type", "default": "web_fetch_tool_result" }) }).annotate({ "title": "ResponseWebFetchToolResultBlock" }) +export type ListResponse_ModelInfo_ = { + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "has_more": boolean + readonly "last_id": string | null +} +export const ListResponse_ModelInfo_ = Schema.Struct({ + "data": Schema.Array(ModelInfo).annotate({ "title": "Data" }), + "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "First Id", + "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." + }), + "has_more": Schema.Boolean.annotate({ + "title": "Has More", + "description": "Indicates if there are more results in the requested page direction." + }), + "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Last Id", + "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." + }) +}).annotate({ "title": "ListResponse[ModelInfo]" }) export type RequestDocumentBlock = { readonly "cache_control"?: CacheControlEphemeral | null readonly "citations"?: RequestCitationsConfig | null @@ -8518,6 +8924,7 @@ export type BetaCountMessageTokensParams = { | BetaWebFetchTool_20250910 | BetaWebSearchTool_20260209 | BetaWebFetchTool_20260209 + | BetaWebFetchTool_20260309 | BetaToolSearchToolBM25_20251119 | BetaToolSearchToolRegex_20251119 | BetaMCPToolset @@ -8610,6 +9017,7 @@ export const BetaCountMessageTokensParams = Schema.Struct({ BetaWebFetchTool_20250910, BetaWebSearchTool_20260209, BetaWebFetchTool_20260209, + BetaWebFetchTool_20260309, BetaToolSearchToolBM25_20251119, BetaToolSearchToolRegex_20251119, BetaMCPToolset @@ -8663,6 +9071,7 @@ export type BetaCreateMessageParams = { | BetaWebFetchTool_20250910 | BetaWebSearchTool_20260209 | BetaWebFetchTool_20260209 + | BetaWebFetchTool_20260309 | BetaToolSearchToolBM25_20251119 | BetaToolSearchToolRegex_20251119 | BetaMCPToolset @@ -8717,7 +9126,7 @@ export const BetaCreateMessageParams = Schema.Struct({ "metadata": Schema.optionalKey( Schema.Struct({ "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "User Id", "description": "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." @@ -8814,6 +9223,7 @@ export const BetaCreateMessageParams = Schema.Struct({ BetaWebFetchTool_20250910, BetaWebSearchTool_20260209, BetaWebFetchTool_20260209, + BetaWebFetchTool_20260309, BetaToolSearchToolBM25_20251119, BetaToolSearchToolRegex_20251119, BetaMCPToolset @@ -8883,6 +9293,7 @@ export type BetaMessageBatchIndividualRequestParams = { | BetaWebFetchTool_20250910 | BetaWebSearchTool_20260209 | BetaWebFetchTool_20260209 + | BetaWebFetchTool_20260309 | BetaToolSearchToolBM25_20251119 | BetaToolSearchToolRegex_20251119 | BetaMCPToolset @@ -8946,7 +9357,7 @@ export const BetaMessageBatchIndividualRequestParams = Schema.Struct({ "metadata": Schema.optionalKey( Schema.Struct({ "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "User Id", "description": "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." @@ -9043,6 +9454,7 @@ export const BetaMessageBatchIndividualRequestParams = Schema.Struct({ BetaWebFetchTool_20250910, BetaWebSearchTool_20260209, BetaWebFetchTool_20260209, + BetaWebFetchTool_20260309, BetaToolSearchToolBM25_20251119, BetaToolSearchToolRegex_20251119, BetaMCPToolset @@ -9095,6 +9507,7 @@ export type CountMessageTokensParams = { | WebFetchTool_20250910 | WebSearchTool_20260209 | WebFetchTool_20260209 + | WebFetchTool_20260309 | ToolSearchToolBM25_20251119 | ToolSearchToolRegex_20251119 > @@ -9157,6 +9570,7 @@ export const CountMessageTokensParams = Schema.Struct({ WebFetchTool_20250910, WebSearchTool_20260209, WebFetchTool_20260209, + WebFetchTool_20260309, ToolSearchToolBM25_20251119, ToolSearchToolRegex_20251119 ], { mode: "oneOf" }) @@ -9197,6 +9611,7 @@ export type CreateMessageParams = { | WebFetchTool_20250910 | WebSearchTool_20260209 | WebFetchTool_20260209 + | WebFetchTool_20260309 | ToolSearchToolBM25_20251119 | ToolSearchToolRegex_20251119 > @@ -9238,7 +9653,7 @@ export const CreateMessageParams = Schema.Struct({ "metadata": Schema.optionalKey( Schema.Struct({ "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "User Id", "description": "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." @@ -9318,6 +9733,7 @@ export const CreateMessageParams = Schema.Struct({ WebFetchTool_20250910, WebSearchTool_20260209, WebFetchTool_20260209, + WebFetchTool_20260309, ToolSearchToolBM25_20251119, ToolSearchToolRegex_20251119 ], { mode: "oneOf" }) @@ -9374,6 +9790,7 @@ export type MessageBatchIndividualRequestParams = { | WebFetchTool_20250910 | WebSearchTool_20260209 | WebFetchTool_20260209 + | WebFetchTool_20260309 | ToolSearchToolBM25_20251119 | ToolSearchToolRegex_20251119 > @@ -9424,7 +9841,7 @@ export const MessageBatchIndividualRequestParams = Schema.Struct({ "metadata": Schema.optionalKey( Schema.Struct({ "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "User Id", "description": "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." @@ -9504,6 +9921,7 @@ export const MessageBatchIndividualRequestParams = Schema.Struct({ WebFetchTool_20250910, WebSearchTool_20260209, WebFetchTool_20260209, + WebFetchTool_20260309, ToolSearchToolBM25_20251119, ToolSearchToolRegex_20251119 ], { mode: "oneOf" }) diff --git a/packages/ai/openai/src/Generated.ts b/packages/ai/openai/src/Generated.ts index 482868dc4..3a8b70b8f 100644 --- a/packages/ai/openai/src/Generated.ts +++ b/packages/ai/openai/src/Generated.ts @@ -655,12 +655,12 @@ export const ChatCompletionTokenLogprob = Schema.Struct({ }) }) export type ComparisonFilter = { - readonly "type": "eq" | "ne" | "gt" | "gte" | "lt" | "lte" + readonly "type": "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "nin" readonly "key": string readonly "value": string | number | boolean | ReadonlyArray } export const ComparisonFilter = Schema.Struct({ - "type": Schema.Literals(["eq", "ne", "gt", "gte", "lt", "lte"]).annotate({ + "type": Schema.Literals(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]).annotate({ "description": "Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\n- `eq`: equals\n- `ne`: not equal\n- `gt`: greater than\n- `gte`: greater than or equal\n- `lt`: less than\n- `lte`: less than or equal\n- `in`: in\n- `nin`: not in\n" }), @@ -1275,73 +1275,6 @@ export const CreateModerationResponse = Schema.Struct({ }).annotate({ "description": "A list of the categories along with the input type(s) that the score applies to." }) })).annotate({ "description": "A list of moderation objects." }) }).annotate({ "description": "Represents if a given text input is potentially harmful." }) -export type CreateSpeechRequest = { - readonly "model": string | "tts-1" | "tts-1-hd" | "gpt-4o-mini-tts" | "gpt-4o-mini-tts-2025-12-15" - readonly "input": string - readonly "instructions"?: string - readonly "voice": - | string - | "alloy" - | "ash" - | "ballad" - | "coral" - | "echo" - | "sage" - | "shimmer" - | "verse" - | "marin" - | "cedar" - | { readonly "id": string } - readonly "response_format"?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm" - readonly "speed"?: number - readonly "stream_format"?: "sse" | "audio" -} -export const CreateSpeechRequest = Schema.Struct({ - "model": Schema.Union([ - Schema.String, - Schema.Literals(["tts-1", "tts-1-hd", "gpt-4o-mini-tts", "gpt-4o-mini-tts-2025-12-15"]) - ]).annotate({ - "description": - "One of the available [TTS models](/docs/models#tts): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.\n" - }), - "input": Schema.String.annotate({ - "description": "The text to generate audio for. The maximum length is 4096 characters." - }).check(Schema.isMaxLength(4096)), - "instructions": Schema.optionalKey( - Schema.String.annotate({ - "description": - "Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`." - }).check(Schema.isMaxLength(4096)) - ), - "voice": Schema.Union([ - Schema.Union([ - Schema.String, - Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"]) - ]), - Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) }) - .annotate({ "description": "Custom voice reference." }) - ]).annotate({ - "title": "Voice", - "description": - "The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ \"id\": \"voice_1234\" }`. Previews of the voices are available in the [Text to speech guide](/docs/guides/text-to-speech#voice-options)." - }), - "response_format": Schema.optionalKey( - Schema.Literals(["mp3", "opus", "aac", "flac", "wav", "pcm"]).annotate({ - "description": "The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`." - }) - ), - "speed": Schema.optionalKey( - Schema.Number.annotate({ - "description": "The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0.25)).check(Schema.isLessThanOrEqualTo(4)) - ), - "stream_format": Schema.optionalKey( - Schema.Literals(["sse", "audio"]).annotate({ - "description": - "The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`." - }) - ) -}) export type CreateTranscriptionResponseJson = { readonly "text": string readonly "logprobs"?: ReadonlyArray< @@ -1493,6 +1426,7 @@ export type CustomToolCall = { readonly "type": "custom_tool_call" readonly "id"?: string readonly "call_id": string + readonly "namespace"?: string readonly "name": string readonly "input": string } @@ -1506,6 +1440,9 @@ export const CustomToolCall = Schema.Struct({ "call_id": Schema.String.annotate({ "description": "An identifier used to map this custom tool call to a tool call output.\n" }), + "namespace": Schema.optionalKey( + Schema.String.annotate({ "description": "The namespace of the custom tool being called.\n" }) + ), "name": Schema.String.annotate({ "description": "The name of the custom tool being called.\n" }), "input": Schema.String.annotate({ "description": "The input for the custom tool call generated by the model.\n" }) }).annotate({ "title": "Custom tool call", "description": "A call to a custom tool created by the model.\n" }) @@ -2267,6 +2204,7 @@ export type FunctionToolCall = { readonly "id"?: string readonly "type": "function_call" readonly "call_id": string + readonly "namespace"?: string readonly "name": string readonly "arguments": string readonly "status"?: "in_progress" | "completed" | "incomplete" @@ -2279,6 +2217,7 @@ export const FunctionToolCall = Schema.Struct({ "call_id": Schema.String.annotate({ "description": "The unique ID of the function tool call generated by the model.\n" }), + "namespace": Schema.optionalKey(Schema.String.annotate({ "description": "The namespace of the function to run.\n" })), "name": Schema.String.annotate({ "description": "The name of the function to run.\n" }), "arguments": Schema.String.annotate({ "description": "A JSON string of the arguments to pass to the function.\n" }), "status": Schema.optionalKey( @@ -2296,6 +2235,7 @@ export type FunctionToolCallResource = { readonly "id": string readonly "type": "function_call" readonly "call_id": string + readonly "namespace"?: string readonly "name": string readonly "arguments": string readonly "status"?: "in_progress" | "completed" | "incomplete" @@ -2308,6 +2248,7 @@ export const FunctionToolCallResource = Schema.Struct({ "call_id": Schema.String.annotate({ "description": "The unique ID of the function tool call generated by the model.\n" }), + "namespace": Schema.optionalKey(Schema.String.annotate({ "description": "The namespace of the function to run.\n" })), "name": Schema.String.annotate({ "description": "The name of the function to run.\n" }), "arguments": Schema.String.annotate({ "description": "A JSON string of the arguments to pass to the function.\n" }), "status": Schema.optionalKey( @@ -3092,6 +3033,11 @@ export const MessageDeltaContentTextAnnotationsFilePathObject = Schema.Struct({ "description": "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file." }) +export type MessagePhase = "commentary" | "final_answer" +export const MessagePhase = Schema.Literals(["commentary", "final_answer"]).annotate({ + "description": + "Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`).\nFor models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend\nphase on all assistant messages — dropping it can degrade performance. Not used for user messages.\n" +}) export type MessageRequestContentTextObject = { readonly "type": "text"; readonly "text": string } export const MessageRequestContentTextObject = Schema.Struct({ "type": Schema.Literal("text").annotate({ "description": "Always `text`." }), @@ -3126,6 +3072,12 @@ export const Model = Schema.StructWithRest( ).annotate({ "title": "Model", "description": "Describes an OpenAI model offering that can be used with the API." }) export type ModelIdsShared = | string + | "gpt-5.4" + | "gpt-5.4-mini" + | "gpt-5.4-nano" + | "gpt-5.4-mini-2026-03-17" + | "gpt-5.4-nano-2026-03-17" + | "gpt-5.3-chat-latest" | "gpt-5.2" | "gpt-5.2-2025-12-11" | "gpt-5.2-chat-latest" @@ -3201,6 +3153,12 @@ export type ModelIdsShared = export const ModelIdsShared = Schema.Union([ Schema.String, Schema.Literals([ + "gpt-5.4", + "gpt-5.4-mini", + "gpt-5.4-nano", + "gpt-5.4-mini-2026-03-17", + "gpt-5.4-nano-2026-03-17", + "gpt-5.3-chat-latest", "gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", @@ -6704,7 +6662,9 @@ export type ToolChoiceTypes = { readonly "type": | "file_search" | "web_search_preview" + | "computer" | "computer_use_preview" + | "computer_use" | "web_search_preview_2025_03_11" | "image_generation" | "code_interpreter" @@ -6713,13 +6673,15 @@ export const ToolChoiceTypes = Schema.Struct({ "type": Schema.Literals([ "file_search", "web_search_preview", + "computer", "computer_use_preview", + "computer_use", "web_search_preview_2025_03_11", "image_generation", "code_interpreter" ]).annotate({ "description": - "The type of hosted tool the model should to use. Learn more about\n[built-in tools](/docs/guides/tools).\n\nAllowed values are:\n- `file_search`\n- `web_search_preview`\n- `computer_use_preview`\n- `code_interpreter`\n- `image_generation`\n" + "The type of hosted tool the model should to use. Learn more about\n[built-in tools](/docs/guides/tools).\n\nAllowed values are:\n- `file_search`\n- `web_search_preview`\n- `computer`\n- `computer_use_preview`\n- `computer_use`\n- `code_interpreter`\n- `image_generation`\n" }) }).annotate({ "title": "Hosted tool", @@ -7954,7 +7916,7 @@ export type InputImageContent = { readonly "type": "input_image" readonly "image_url"?: string | null readonly "file_id"?: string | null - readonly "detail": "low" | "high" | "auto" + readonly "detail": "low" | "high" | "auto" | "original" } export const InputImageContent = Schema.Struct({ "type": Schema.Literal("input_image").annotate({ @@ -7975,9 +7937,9 @@ export const InputImageContent = Schema.Struct({ Schema.Null ]) ), - "detail": Schema.Literals(["low", "high", "auto"]).annotate({ + "detail": Schema.Literals(["low", "high", "auto", "original"]).annotate({ "description": - "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`." + "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." }) }).annotate({ "title": "Input image", @@ -7987,6 +7949,7 @@ export type ComputerScreenshotContent = { readonly "type": "computer_screenshot" readonly "image_url": string | null readonly "file_id": string | null + readonly "detail": "low" | "high" | "auto" | "original" } export const ComputerScreenshotContent = Schema.Struct({ "type": Schema.Literal("computer_screenshot").annotate({ @@ -8000,14 +7963,18 @@ export const ComputerScreenshotContent = Schema.Struct({ "file_id": Schema.Union([ Schema.String.annotate({ "description": "The identifier of an uploaded file that contains the screenshot." }), Schema.Null - ]) + ]), + "detail": Schema.Literals(["low", "high", "auto", "original"]).annotate({ + "description": + "The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." + }) }).annotate({ "title": "Computer screenshot", "description": "A screenshot of a computer." }) export type InputFileContent = { readonly "type": "input_file" readonly "file_id"?: string | null readonly "filename"?: string - readonly "file_url"?: string readonly "file_data"?: string + readonly "file_url"?: string } export const InputFileContent = Schema.Struct({ "type": Schema.Literal("input_file").annotate({ "description": "The type of the input item. Always `input_file`." }), @@ -8020,11 +7987,11 @@ export const InputFileContent = Schema.Struct({ "filename": Schema.optionalKey( Schema.String.annotate({ "description": "The name of the file to be sent to the model." }) ), - "file_url": Schema.optionalKey( - Schema.String.annotate({ "description": "The URL of the file to be sent to the model." }) - ), "file_data": Schema.optionalKey( Schema.String.annotate({ "description": "The content of the file to be sent to the model.\n" }) + ), + "file_url": Schema.optionalKey( + Schema.String.annotate({ "description": "The URL of the file to be sent to the model." }) ) }).annotate({ "title": "Input file", "description": "A file input to the model." }) export type ClickParam = { @@ -8130,6 +8097,188 @@ export const ComputerCallSafetyCheckParam = Schema.Struct({ Schema.Union([Schema.String.annotate({ "description": "Details about the pending safety check." }), Schema.Null]) ) }).annotate({ "description": "A pending safety check for the computer call." }) +export type ToolSearchCall = { + readonly "type": "tool_search_call" + readonly "id": string + readonly "call_id": string | null + readonly "execution": "server" | "client" + readonly "arguments": unknown + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "created_by"?: string +} +export const ToolSearchCall = Schema.Struct({ + "type": Schema.Literal("tool_search_call").annotate({ + "description": "The type of the item. Always `tool_search_call`." + }), + "id": Schema.String.annotate({ "description": "The unique ID of the tool search call item." }), + "call_id": Schema.Union([ + Schema.String.annotate({ "description": "The unique ID of the tool search call generated by the model." }), + Schema.Null + ]), + "execution": Schema.Literals(["server", "client"]).annotate({ + "description": "Whether tool search was executed by the server or by the client." + }), + "arguments": Schema.Unknown.annotate({ "description": "Arguments used for the tool search call." }), + "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ + "description": "The status of the tool search call item that was recorded." + }), + "created_by": Schema.optionalKey( + Schema.String.annotate({ "description": "The identifier of the actor that created the item." }) + ) +}) +export type FunctionTool = { + readonly "type": "function" + readonly "name": string + readonly "description"?: string | null + readonly "parameters": {} | null + readonly "strict": boolean | null + readonly "defer_loading"?: boolean +} +export const FunctionTool = Schema.Struct({ + "type": Schema.Literal("function").annotate({ "description": "The type of the function tool. Always `function`." }), + "name": Schema.String.annotate({ "description": "The name of the function to call." }), + "description": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": + "A description of the function. Used by the model to determine whether or not to call the function." + }), + Schema.Null + ]) + ), + "parameters": Schema.Union([ + Schema.Struct({}).annotate({ "description": "A JSON schema object describing the parameters of the function." }), + Schema.Null + ]), + "strict": Schema.Union([ + Schema.Boolean.annotate({ "description": "Whether to enforce strict parameter validation. Default `true`." }), + Schema.Null + ]), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether this function is deferred and loaded via tool search." }) + ) +}).annotate({ + "title": "Function", + "description": + "Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling)." +}) +export type ComputerTool = { readonly "type": "computer" } +export const ComputerTool = Schema.Struct({ + "type": Schema.Literal("computer").annotate({ "description": "The type of the computer tool. Always `computer`." }) +}).annotate({ + "title": "Computer", + "description": + "A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use)." +}) +export type ComputerUsePreviewTool = { + readonly "type": "computer_use_preview" + readonly "environment": "windows" | "mac" | "linux" | "ubuntu" | "browser" + readonly "display_width": number + readonly "display_height": number +} +export const ComputerUsePreviewTool = Schema.Struct({ + "type": Schema.Literal("computer_use_preview").annotate({ + "description": "The type of the computer use tool. Always `computer_use_preview`." + }), + "environment": Schema.Literals(["windows", "mac", "linux", "ubuntu", "browser"]).annotate({ + "description": "The type of computer environment to control." + }), + "display_width": Schema.Number.annotate({ "description": "The width of the computer display." }).check( + Schema.isInt() + ), + "display_height": Schema.Number.annotate({ "description": "The height of the computer display." }).check( + Schema.isInt() + ) +}).annotate({ + "title": "Computer use preview", + "description": + "A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use)." +}) +export type InputFidelity = "high" | "low" +export const InputFidelity = Schema.Literals(["high", "low"]).annotate({ + "description": + "Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`." +}) +export type LocalShellToolParam = { readonly "type": "local_shell" } +export const LocalShellToolParam = Schema.Struct({ + "type": Schema.Literal("local_shell").annotate({ + "description": "The type of the local shell tool. Always `local_shell`." + }) +}).annotate({ + "title": "Local shell tool", + "description": "A tool that allows the model to execute shell commands in a local environment." +}) +export type LocalSkillParam = { readonly "name": string; readonly "description": string; readonly "path": string } +export const LocalSkillParam = Schema.Struct({ + "name": Schema.String.annotate({ "description": "The name of the skill." }), + "description": Schema.String.annotate({ "description": "The description of the skill." }), + "path": Schema.String.annotate({ "description": "The path to the directory containing the skill." }) +}) +export type ContainerReferenceParam = { readonly "type": "container_reference"; readonly "container_id": string } +export const ContainerReferenceParam = Schema.Struct({ + "type": Schema.Literal("container_reference").annotate({ + "description": "References a container created with the /v1/containers endpoint" + }), + "container_id": Schema.String.annotate({ "description": "The ID of the referenced container." }) +}) +export type CustomTextFormatParam = { readonly "type": "text" } +export const CustomTextFormatParam = Schema.Struct({ + "type": Schema.Literal("text").annotate({ "description": "Unconstrained text format. Always `text`." }) +}).annotate({ "title": "Text format", "description": "Unconstrained free-form text." }) +export type CustomGrammarFormatParam = { + readonly "type": "grammar" + readonly "syntax": "lark" | "regex" + readonly "definition": string +} +export const CustomGrammarFormatParam = Schema.Struct({ + "type": Schema.Literal("grammar").annotate({ "description": "Grammar format. Always `grammar`." }), + "syntax": Schema.Literals(["lark", "regex"]).annotate({ + "description": "The syntax of the grammar definition. One of `lark` or `regex`." + }), + "definition": Schema.String.annotate({ "description": "The grammar definition." }) +}).annotate({ "title": "Grammar format", "description": "A grammar defined by the user." }) +export type EmptyModelParam = {} +export const EmptyModelParam = Schema.Struct({}) +export type ToolSearchToolParam = { + readonly "type": "tool_search" + readonly "execution"?: "server" | "client" + readonly "description"?: string | null + readonly "parameters"?: {} | null +} +export const ToolSearchToolParam = Schema.Struct({ + "type": Schema.Literal("tool_search").annotate({ "description": "The type of the tool. Always `tool_search`." }), + "execution": Schema.optionalKey( + Schema.Literals(["server", "client"]).annotate({ + "description": "Whether tool search is executed by the server or by the client." + }) + ), + "description": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": "Description shown to the model for a client-executed tool search tool." + }), + Schema.Null + ]) + ), + "parameters": Schema.optionalKey( + Schema.Union([ + Schema.Struct({}).annotate({ "description": "Parameter schema for a client-executed tool search tool." }), + Schema.Null + ]) + ) +}).annotate({ + "title": "Tool search tool", + "description": "Hosted or BYOT tool search configuration for deferred tools." +}) +export type SearchContentType = "text" | "image" +export const SearchContentType = Schema.Literals(["text", "image"]) +export type ApplyPatchToolParam = { readonly "type": "apply_patch" } +export const ApplyPatchToolParam = Schema.Struct({ + "type": Schema.Literal("apply_patch").annotate({ "description": "The type of the tool. Always `apply_patch`." }) +}).annotate({ + "title": "Apply patch tool", + "description": "Allows the assistant to create, delete, or update files using unified diffs." +}) export type CodeInterpreterOutputLogs = { readonly "type": "logs"; readonly "logs": string } export const CodeInterpreterOutputLogs = Schema.Struct({ "type": Schema.Literal("logs").annotate({ "description": "The type of the output. Always `logs`." }), @@ -8276,7 +8425,7 @@ export type InputImageContentParamAutoParam = { readonly "type": "input_image" readonly "image_url"?: string | null readonly "file_id"?: string | null - readonly "detail"?: "low" | "high" | "auto" | null + readonly "detail"?: "low" | "high" | "auto" | "original" | null } export const InputImageContentParamAutoParam = Schema.Struct({ "type": Schema.Literal("input_image").annotate({ @@ -8299,9 +8448,9 @@ export const InputImageContentParamAutoParam = Schema.Struct({ ), "detail": Schema.optionalKey( Schema.Union([ - Schema.Literals(["low", "high", "auto"]).annotate({ + Schema.Literals(["low", "high", "auto", "original"]).annotate({ "description": - "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`." + "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`." }), Schema.Null ]) @@ -8346,6 +8495,42 @@ export const InputFileContentParam = Schema.Struct({ ]) ) }).annotate({ "title": "Input file", "description": "A file input to the model." }) +export type ToolSearchCallItemParam = { + readonly "id"?: string | null + readonly "call_id"?: string | null + readonly "type": "tool_search_call" + readonly "execution"?: "server" | "client" + readonly "arguments": {} + readonly "status"?: "in_progress" | "completed" | "incomplete" | null +} +export const ToolSearchCallItemParam = Schema.Struct({ + "id": Schema.optionalKey( + Schema.Union([Schema.String.annotate({ "description": "The unique ID of this tool search call." }), Schema.Null]) + ), + "call_id": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ "description": "The unique ID of the tool search call generated by the model." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(64)), + Schema.Null + ]) + ), + "type": Schema.Literal("tool_search_call").annotate({ "description": "The item type. Always `tool_search_call`." }), + "execution": Schema.optionalKey( + Schema.Literals(["server", "client"]).annotate({ + "description": "Whether tool search was executed by the server or by the client." + }) + ), + "arguments": Schema.Struct({}).annotate({ "description": "The arguments supplied to the tool search call." }), + "status": Schema.optionalKey( + Schema.Union([ + Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ + "description": "The status of the tool search call." + }), + Schema.Null + ]) + ) +}) export type CompactionSummaryItemParam = { readonly "id"?: string | null readonly "type": "compaction" @@ -8363,19 +8548,6 @@ export const CompactionSummaryItemParam = Schema.Struct({ "description": "A compaction item generated by the [`v1/responses/compact` API](/docs/api-reference/responses/compact)." }) -export type LocalSkillParam = { readonly "name": string; readonly "description": string; readonly "path": string } -export const LocalSkillParam = Schema.Struct({ - "name": Schema.String.annotate({ "description": "The name of the skill." }), - "description": Schema.String.annotate({ "description": "The description of the skill." }), - "path": Schema.String.annotate({ "description": "The path to the directory containing the skill." }) -}) -export type ContainerReferenceParam = { readonly "type": "container_reference"; readonly "container_id": string } -export const ContainerReferenceParam = Schema.Struct({ - "type": Schema.Literal("container_reference").annotate({ - "description": "References a container created with the /v1/containers endpoint" - }), - "container_id": Schema.String.annotate({ "description": "The ID of the referenced container." }) -}) export type FunctionShellCallOutputTimeoutOutcomeParam = { readonly "type": "timeout" } export const FunctionShellCallOutputTimeoutOutcomeParam = Schema.Struct({ "type": Schema.Literal("timeout").annotate({ "description": "The outcome type. Always `timeout`." }) @@ -8507,163 +8679,6 @@ export const ConversationResource = Schema.Struct({ "description": "The time at which the conversation was created, measured in seconds since the Unix epoch." }).check(Schema.isInt()) }) -export type FunctionTool = { - readonly "type": "function" - readonly "name": string - readonly "description"?: string | null - readonly "parameters": {} | null - readonly "strict": boolean | null -} -export const FunctionTool = Schema.Struct({ - "type": Schema.Literal("function").annotate({ "description": "The type of the function tool. Always `function`." }), - "name": Schema.String.annotate({ "description": "The name of the function to call." }), - "description": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": - "A description of the function. Used by the model to determine whether or not to call the function." - }), - Schema.Null - ]) - ), - "parameters": Schema.Union([ - Schema.Struct({}).annotate({ "description": "A JSON schema object describing the parameters of the function." }), - Schema.Null - ]), - "strict": Schema.Union([ - Schema.Boolean.annotate({ "description": "Whether to enforce strict parameter validation. Default `true`." }), - Schema.Null - ]) -}).annotate({ - "title": "Function", - "description": - "Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling)." -}) -export type ComputerUsePreviewTool = { - readonly "type": "computer_use_preview" - readonly "environment": "windows" | "mac" | "linux" | "ubuntu" | "browser" - readonly "display_width": number - readonly "display_height": number -} -export const ComputerUsePreviewTool = Schema.Struct({ - "type": Schema.Literal("computer_use_preview").annotate({ - "description": "The type of the computer use tool. Always `computer_use_preview`." - }), - "environment": Schema.Literals(["windows", "mac", "linux", "ubuntu", "browser"]).annotate({ - "description": "The type of computer environment to control." - }), - "display_width": Schema.Number.annotate({ "description": "The width of the computer display." }).check( - Schema.isInt() - ), - "display_height": Schema.Number.annotate({ "description": "The height of the computer display." }).check( - Schema.isInt() - ) -}).annotate({ - "title": "Computer use preview", - "description": - "A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use)." -}) -export type InputFidelity = "high" | "low" -export const InputFidelity = Schema.Literals(["high", "low"]).annotate({ - "description": - "Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`." -}) -export type LocalShellToolParam = { readonly "type": "local_shell" } -export const LocalShellToolParam = Schema.Struct({ - "type": Schema.Literal("local_shell").annotate({ - "description": "The type of the local shell tool. Always `local_shell`." - }) -}).annotate({ - "title": "Local shell tool", - "description": "A tool that allows the model to execute shell commands in a local environment." -}) -export type CustomTextFormatParam = { readonly "type": "text" } -export const CustomTextFormatParam = Schema.Struct({ - "type": Schema.Literal("text").annotate({ "description": "Unconstrained text format. Always `text`." }) -}).annotate({ "title": "Text format", "description": "Unconstrained free-form text." }) -export type CustomGrammarFormatParam = { - readonly "type": "grammar" - readonly "syntax": "lark" | "regex" - readonly "definition": string -} -export const CustomGrammarFormatParam = Schema.Struct({ - "type": Schema.Literal("grammar").annotate({ "description": "Grammar format. Always `grammar`." }), - "syntax": Schema.Literals(["lark", "regex"]).annotate({ - "description": "The syntax of the grammar definition. One of `lark` or `regex`." - }), - "definition": Schema.String.annotate({ "description": "The grammar definition." }) -}).annotate({ "title": "Grammar format", "description": "A grammar defined by the user." }) -export type WebSearchPreviewTool = { - readonly "type": "web_search_preview" | "web_search_preview_2025_03_11" - readonly "user_location"?: { - readonly "type": "approximate" - readonly "country"?: string | null - readonly "region"?: string | null - readonly "city"?: string | null - readonly "timezone"?: string | null - } | null - readonly "search_context_size"?: "low" | "medium" | "high" -} -export const WebSearchPreviewTool = Schema.Struct({ - "type": Schema.Literals(["web_search_preview", "web_search_preview_2025_03_11"]).annotate({ - "description": "The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`." - }), - "user_location": Schema.optionalKey(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("approximate").annotate({ - "description": "The type of location approximation. Always `approximate`." - }), - "country": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": - "The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`." - }), - Schema.Null - ]) - ), - "region": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ "description": "Free text input for the region of the user, e.g. `California`." }), - Schema.Null - ]) - ), - "city": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ "description": "Free text input for the city of the user, e.g. `San Francisco`." }), - Schema.Null - ]) - ), - "timezone": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": - "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`." - }), - Schema.Null - ]) - ) - }).annotate({ "description": "The user's location." }), - Schema.Null - ])), - "search_context_size": Schema.optionalKey( - Schema.Literals(["low", "medium", "high"]).annotate({ - "description": - "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default." - }) - ) -}).annotate({ - "title": "Web search preview", - "description": - "This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search)." -}) -export type ApplyPatchToolParam = { readonly "type": "apply_patch" } -export const ApplyPatchToolParam = Schema.Struct({ - "type": Schema.Literal("apply_patch").annotate({ "description": "The type of the tool. Always `apply_patch`." }) -}).annotate({ - "title": "Apply patch tool", - "description": "Allows the assistant to create, delete, or update files using unified diffs." -}) export type ImageGenOutputTokensDetails = { readonly "image_tokens": number; readonly "text_tokens": number } export const ImageGenOutputTokensDetails = Schema.Struct({ "image_tokens": Schema.Number.annotate({ "description": "The number of image output tokens generated by the model." }) @@ -8790,7 +8805,7 @@ export type VideoResource = { readonly "expires_at": number | null readonly "prompt": string | null readonly "size": "720x1280" | "1280x720" | "1024x1792" | "1792x1024" - readonly "seconds": "4" | "8" | "12" + readonly "seconds": string readonly "remixed_from_video_id": string | null readonly "error": { readonly "code": string; readonly "message": string } | null } @@ -8826,8 +8841,8 @@ export const VideoResource = Schema.Struct({ "size": Schema.Literals(["720x1280", "1280x720", "1024x1792", "1792x1024"]).annotate({ "description": "The resolution of the generated video." }), - "seconds": Schema.Literals(["4", "8", "12"]).annotate({ - "description": "Duration of the generated clip in seconds." + "seconds": Schema.String.annotate({ + "description": "Duration of the generated clip in seconds. For extensions, this is the stitched total duration." }), "remixed_from_video_id": Schema.Union([ Schema.String.annotate({ "description": "Identifier of the source video if this video is a remix." }), @@ -8846,7 +8861,16 @@ export const VideoResource = Schema.Struct({ Schema.Null ]) }).annotate({ "title": "Video job", "description": "Structured information describing a generated video job." }) -export type CreateVideoBody = { +export type ImageRefParam_2 = { readonly "image_url"?: string; readonly "file_id"?: string } +export const ImageRefParam_2 = Schema.Struct({ + "image_url": Schema.optionalKey( + Schema.String.annotate({ "description": "A fully qualified URL or base64-encoded data URL." }).check( + Schema.isMaxLength(20971520) + ) + ), + "file_id": Schema.optionalKey(Schema.String) +}) +export type CreateVideoJsonBody = { readonly "model"?: | string | "sora-2" @@ -8855,11 +8879,11 @@ export type CreateVideoBody = { | "sora-2-pro-2025-10-06" | "sora-2-2025-12-08" readonly "prompt": string - readonly "input_reference"?: string + readonly "input_reference"?: { readonly "image_url"?: string; readonly "file_id"?: string } readonly "seconds"?: "4" | "8" | "12" readonly "size"?: "720x1280" | "1280x720" | "1024x1792" | "1792x1024" } -export const CreateVideoBody = Schema.Struct({ +export const CreateVideoJsonBody = Schema.Struct({ "model": Schema.optionalKey( Schema.Union([ Schema.String, @@ -8872,7 +8896,17 @@ export const CreateVideoBody = Schema.Struct({ Schema.isMinLength(1) ).check(Schema.isMaxLength(32000)), "input_reference": Schema.optionalKey( - Schema.String.annotate({ "description": "Optional image reference that guides generation.", "format": "binary" }) + Schema.Struct({ + "image_url": Schema.optionalKey( + Schema.String.annotate({ "description": "A fully qualified URL or base64-encoded data URL." }).check( + Schema.isMaxLength(20971520) + ) + ), + "file_id": Schema.optionalKey(Schema.String) + }).annotate({ + "description": + "Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`." + }) ), "seconds": Schema.optionalKey( Schema.Literals(["4", "8", "12"]).annotate({ @@ -8885,7 +8919,65 @@ export const CreateVideoBody = Schema.Struct({ "Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280." }) ) -}).annotate({ "title": "Create video request", "description": "Parameters for creating a new video generation job." }) +}).annotate({ + "title": "Create video JSON request", + "description": "JSON parameters for creating a new video generation job." +}) +export type CreateVideoCharacterBody = { readonly "video": string; readonly "name": string } +export const CreateVideoCharacterBody = Schema.Struct({ + "video": Schema.String.annotate({ "description": "Video file used to create a character.", "format": "binary" }), + "name": Schema.String.annotate({ "description": "Display name for this API character." }).check(Schema.isMinLength(1)) + .check(Schema.isMaxLength(80)) +}).annotate({ + "title": "Create character request", + "description": "Parameters for creating a character from an uploaded video." +}) +export type VideoCharacterResource = { + readonly "id": string | null + readonly "name": string | null + readonly "created_at": number +} +export const VideoCharacterResource = Schema.Struct({ + "id": Schema.Union([ + Schema.String.annotate({ "description": "Identifier for the character creation cameo." }), + Schema.Null + ]), + "name": Schema.Union([Schema.String.annotate({ "description": "Display name for the character." }), Schema.Null]), + "created_at": Schema.Number.annotate({ "description": "Unix timestamp (in seconds) when the character was created." }) + .check(Schema.isInt()) +}) +export type VideoReferenceInputParam = { readonly "id": string } +export const VideoReferenceInputParam = Schema.Struct({ + "id": Schema.String.annotate({ "description": "The identifier of the completed video." }) +}).annotate({ "description": "Reference to the completed video." }) +export type CreateVideoEditJsonBody = { readonly "video": { readonly "id": string }; readonly "prompt": string } +export const CreateVideoEditJsonBody = Schema.Struct({ + "video": Schema.Struct({ "id": Schema.String.annotate({ "description": "The identifier of the completed video." }) }) + .annotate({ "description": "Reference to the completed video to edit." }), + "prompt": Schema.String.annotate({ "description": "Text prompt that describes how to edit the source video." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(32000)) +}).annotate({ + "title": "Create video edit JSON request", + "description": "JSON parameters for editing an existing generated video." +}) +export type CreateVideoExtendJsonBody = { + readonly "video": { readonly "id": string } + readonly "prompt": string + readonly "seconds": "4" | "8" | "12" +} +export const CreateVideoExtendJsonBody = Schema.Struct({ + "video": Schema.Struct({ "id": Schema.String.annotate({ "description": "The identifier of the completed video." }) }) + .annotate({ "description": "Reference to the completed video to extend." }), + "prompt": Schema.String.annotate({ "description": "Updated text prompt that directs the extension generation." }) + .check(Schema.isMinLength(1)).check(Schema.isMaxLength(32000)), + "seconds": Schema.Literals(["4", "8", "12"]).annotate({ + "description": "Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20)." + }) +}).annotate({ + "title": "Create video extension JSON request", + "description": "JSON parameters for extending an existing generated video." +}) export type DeletedVideoResource = { readonly "object": "video.deleted" readonly "deleted": boolean @@ -9455,6 +9547,15 @@ export const DeletedThreadResource = Schema.Struct({ }), "deleted": Schema.Boolean.annotate({ "description": "Indicates that the thread has been deleted." }) }).annotate({ "title": "Deleted thread", "description": "Confirmation payload returned after deleting a thread." }) +export type ResponseKeepAliveEvent = { readonly "type": "keepalive"; readonly "sequence_number": number } +export const ResponseKeepAliveEvent = Schema.Struct({ + "type": Schema.Literal("keepalive").annotate({ + "description": "The type of the keepalive event. Always `keepalive`." + }), + "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this keepalive event." }).check( + Schema.isInt() + ) +}).annotate({ "title": "Keep alive", "description": "A keepalive event emitted during long-running response streams." }) export type ResponseApplyPatchCallOperationDiffDeltaEvent = { readonly "type": "response.apply_patch_call_operation_diff.delta" readonly "sequence_number": number @@ -10368,6 +10469,7 @@ export type MCPTool = { | "always" | "never" | null + readonly "defer_loading"?: boolean } export const MCPTool = Schema.Struct({ "type": Schema.Literal("mcp").annotate({ "description": "The type of the MCP tool. Always `mcp`." }), @@ -10440,6 +10542,9 @@ export const MCPTool = Schema.Struct({ ], { mode: "oneOf" }).annotate({ "description": "Specify which of the MCP server's tools require approval." }), Schema.Null ]) + ), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether this MCP tool is deferred and discovered via tool search.\n" }) ) }).annotate({ "title": "MCP tool", @@ -12545,6 +12650,58 @@ export const VoiceConsentListResource = Schema.Struct({ "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), "has_more": Schema.Boolean }) +export type CreateSpeechRequest = { + readonly "model": string | "tts-1" | "tts-1-hd" | "gpt-4o-mini-tts" | "gpt-4o-mini-tts-2025-12-15" + readonly "input": string + readonly "instructions"?: string + readonly "voice": VoiceIdsShared | { readonly "id": string } + readonly "response_format"?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm" + readonly "speed"?: number + readonly "stream_format"?: "sse" | "audio" +} +export const CreateSpeechRequest = Schema.Struct({ + "model": Schema.Union([ + Schema.String, + Schema.Literals(["tts-1", "tts-1-hd", "gpt-4o-mini-tts", "gpt-4o-mini-tts-2025-12-15"]) + ]).annotate({ + "description": + "One of the available [TTS models](/docs/models#tts): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.\n" + }), + "input": Schema.String.annotate({ + "description": "The text to generate audio for. The maximum length is 4096 characters." + }).check(Schema.isMaxLength(4096)), + "instructions": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`." + }).check(Schema.isMaxLength(4096)) + ), + "voice": Schema.Union([ + VoiceIdsShared, + Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) }) + .annotate({ "description": "Custom voice reference." }) + ]).annotate({ + "title": "Voice", + "description": + "The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ \"id\": \"voice_1234\" }`. Previews of the voices are available in the [Text to speech guide](/docs/guides/text-to-speech#voice-options)." + }), + "response_format": Schema.optionalKey( + Schema.Literals(["mp3", "opus", "aac", "flac", "wav", "pcm"]).annotate({ + "description": "The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`." + }) + ), + "speed": Schema.optionalKey( + Schema.Number.annotate({ + "description": "The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0.25)).check(Schema.isLessThanOrEqualTo(4)) + ), + "stream_format": Schema.optionalKey( + Schema.Literals(["sse", "audio"]).annotate({ + "description": + "The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`." + }) + ) +}) export type RealtimeSessionCreateResponse = { readonly "id"?: string readonly "object"?: string @@ -12986,350 +13143,76 @@ export const ComputerCallOutputItemParam = Schema.Struct({ ]) ) }).annotate({ "title": "Computer tool call output", "description": "The output of a computer tool call." }) -export type CodeInterpreterToolCall = { - readonly "type": "code_interpreter_call" - readonly "id": string - readonly "status": "in_progress" | "completed" | "incomplete" | "interpreting" | "failed" - readonly "container_id": string - readonly "code": string | null - readonly "outputs": ReadonlyArray | null -} -export const CodeInterpreterToolCall = Schema.Struct({ - "type": Schema.Literal("code_interpreter_call").annotate({ - "description": "The type of the code interpreter tool call. Always `code_interpreter_call`.\n" - }), - "id": Schema.String.annotate({ "description": "The unique ID of the code interpreter tool call.\n" }), - "status": Schema.Literals(["in_progress", "completed", "incomplete", "interpreting", "failed"]).annotate({ - "description": - "The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n" - }), - "container_id": Schema.String.annotate({ "description": "The ID of the container used to run the code.\n" }), - "code": Schema.Union([ - Schema.String.annotate({ "description": "The code to run, or null if not available.\n" }), - Schema.Null - ]), - "outputs": Schema.Union([ - Schema.Array(Schema.Union([CodeInterpreterOutputLogs, CodeInterpreterOutputImage], { mode: "oneOf" })).annotate({ - "description": - "The outputs generated by the code interpreter, such as logs or images.\nCan be null if no outputs are available.\n" - }), - Schema.Null - ]) -}).annotate({ "title": "Code interpreter tool call", "description": "A tool call to run code.\n" }) -export type LocalShellToolCall = { - readonly "type": "local_shell_call" - readonly "id": string - readonly "call_id": string - readonly "action": LocalShellExecAction - readonly "status": "in_progress" | "completed" | "incomplete" -} -export const LocalShellToolCall = Schema.Struct({ - "type": Schema.Literal("local_shell_call").annotate({ - "description": "The type of the local shell call. Always `local_shell_call`.\n" - }), - "id": Schema.String.annotate({ "description": "The unique ID of the local shell call.\n" }), - "call_id": Schema.String.annotate({ - "description": "The unique ID of the local shell tool call generated by the model.\n" - }), - "action": LocalShellExecAction, - "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ - "description": "The status of the local shell call.\n" - }) -}).annotate({ "title": "Local shell call", "description": "A tool call to run a command on the local shell.\n" }) -export type FunctionShellCall = { - readonly "type": "shell_call" - readonly "id": string - readonly "call_id": string - readonly "action": { - readonly "commands": ReadonlyArray - readonly "timeout_ms": number | null - readonly "max_output_length": number | null - } - readonly "status": "in_progress" | "completed" | "incomplete" - readonly "environment": LocalEnvironmentResource | ContainerReferenceResource | null - readonly "created_by"?: string -} -export const FunctionShellCall = Schema.Struct({ - "type": Schema.Literal("shell_call").annotate({ "description": "The type of the item. Always `shell_call`." }), - "id": Schema.String.annotate({ - "description": "The unique ID of the shell tool call. Populated when this item is returned via API." - }), - "call_id": Schema.String.annotate({ "description": "The unique ID of the shell tool call generated by the model." }), - "action": Schema.Struct({ - "commands": Schema.Array(Schema.String.annotate({ "description": "A list of commands to run." })), - "timeout_ms": Schema.Union([ - Schema.Number.annotate({ "description": "Optional timeout in milliseconds for the commands." }).check( - Schema.isInt() - ), - Schema.Null - ]), - "max_output_length": Schema.Union([ - Schema.Number.annotate({ "description": "Optional maximum number of characters to return from each command." }) - .check(Schema.isInt()), - Schema.Null - ]) - }).annotate({ - "title": "Shell exec action", - "description": "The shell commands and limits that describe how to run the tool call." - }), - "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ - "description": "The status of the shell call. One of `in_progress`, `completed`, or `incomplete`." - }), - "environment": Schema.Union([ - Schema.Union([LocalEnvironmentResource, ContainerReferenceResource], { mode: "oneOf" }), - Schema.Null - ]), - "created_by": Schema.optionalKey( - Schema.String.annotate({ "description": "The ID of the entity that created this tool call." }) - ) -}).annotate({ - "title": "Shell tool call", - "description": "A tool call that executes one or more shell commands in a managed environment." -}) -export type FunctionShellCallOutputContent = { - readonly "stdout": string - readonly "stderr": string - readonly "outcome": FunctionShellCallOutputTimeoutOutcome | FunctionShellCallOutputExitOutcome - readonly "created_by"?: string +export type CreateImageEditRequest = { + readonly "image": string | ReadonlyArray + readonly "prompt": string + readonly "mask"?: string + readonly "background"?: "transparent" | "opaque" | "auto" | null + readonly "model"?: + | string + | "gpt-image-1.5" + | "dall-e-2" + | "gpt-image-1" + | "gpt-image-1-mini" + | "chatgpt-image-latest" + | null + readonly "n"?: number | null + readonly "size"?: "256x256" | "512x512" | "1024x1024" | "1536x1024" | "1024x1536" | "auto" | null + readonly "response_format"?: "url" | "b64_json" | null + readonly "output_format"?: "png" | "jpeg" | "webp" | null + readonly "output_compression"?: number | null + readonly "user"?: string + readonly "input_fidelity"?: InputFidelity | null + readonly "stream"?: boolean | null + readonly "partial_images"?: PartialImages + readonly "quality"?: "standard" | "low" | "medium" | "high" | "auto" | null } -export const FunctionShellCallOutputContent = Schema.Struct({ - "stdout": Schema.String.annotate({ "description": "The standard output that was captured." }), - "stderr": Schema.String.annotate({ "description": "The standard error output that was captured." }), - "outcome": Schema.Union([FunctionShellCallOutputTimeoutOutcome, FunctionShellCallOutputExitOutcome], { - mode: "oneOf" - }).annotate({ - "title": "Shell call outcome", +export const CreateImageEditRequest = Schema.Struct({ + "image": Schema.Union([ + Schema.String.annotate({ "format": "binary" }), + Schema.Array(Schema.String.annotate({ "format": "binary" })).check(Schema.isMaxLength(16)) + ]).annotate({ "description": - "Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk." - }), - "created_by": Schema.optionalKey( - Schema.String.annotate({ "description": "The identifier of the actor that created the item." }) - ) -}).annotate({ - "title": "Shell call output content", - "description": "The content of a shell tool call output that was emitted." -}) -export type ApplyPatchToolCall = { - readonly "type": "apply_patch_call" - readonly "id": string - readonly "call_id": string - readonly "status": "in_progress" | "completed" - readonly "operation": ApplyPatchCreateFileOperation | ApplyPatchDeleteFileOperation | ApplyPatchUpdateFileOperation - readonly "created_by"?: string -} -export const ApplyPatchToolCall = Schema.Struct({ - "type": Schema.Literal("apply_patch_call").annotate({ - "description": "The type of the item. Always `apply_patch_call`." - }), - "id": Schema.String.annotate({ - "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API." - }), - "call_id": Schema.String.annotate({ - "description": "The unique ID of the apply patch tool call generated by the model." - }), - "status": Schema.Literals(["in_progress", "completed"]).annotate({ - "description": "The status of the apply patch tool call. One of `in_progress` or `completed`." + "The image(s) to edit. Must be a supported image file or an array of images.\n\nFor the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`\nfile less than 50MB. You can provide up to 16 images.\n`chatgpt-image-latest` follows the same input constraints as GPT image models.\n\nFor `dall-e-2`, you can only provide one image, and it should be a square\n`png` file less than 4MB.\n" }), - "operation": Schema.Union([ - ApplyPatchCreateFileOperation, - ApplyPatchDeleteFileOperation, - ApplyPatchUpdateFileOperation - ], { mode: "oneOf" }).annotate({ - "title": "Apply patch operation", - "description": "One of the create_file, delete_file, or update_file operations applied via apply_patch." + "prompt": Schema.String.annotate({ + "description": + "A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models." }), - "created_by": Schema.optionalKey( - Schema.String.annotate({ "description": "The ID of the entity that created this tool call." }) - ) -}).annotate({ - "title": "Apply patch tool call", - "description": "A tool call that applies file diffs by creating, deleting, or updating files." -}) -export type FunctionCallOutputItemParam = { - readonly "id"?: string | null - readonly "call_id": string - readonly "type": "function_call_output" - readonly "output": - | string - | ReadonlyArray - readonly "status"?: "in_progress" | "completed" | "incomplete" | null -} -export const FunctionCallOutputItemParam = Schema.Struct({ - "id": Schema.optionalKey( + "mask": Schema.optionalKey(Schema.String.annotate({ + "description": + "An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.", + "format": "binary" + })), + "background": Schema.optionalKey( + Schema.Union([Schema.Literal("transparent"), Schema.Literal("opaque"), Schema.Literal("auto"), Schema.Null]) + .annotate({ + "description": + "Allows to set transparency for the background of the generated image(s).\nThis parameter is only supported for the GPT image models. Must be one of\n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the\nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it\nshould be set to either `png` (default value) or `webp`.\n" + }) + ), + "model": Schema.optionalKey( Schema.Union([ - Schema.String.annotate({ - "description": "The unique ID of the function tool call output. Populated when this item is returned via API." - }), + Schema.Union([ + Schema.String, + Schema.Literals(["gpt-image-1.5", "dall-e-2", "gpt-image-1", "gpt-image-1-mini", "chatgpt-image-latest"]) + ]).annotate({ "description": "The model to use for image generation. Defaults to `gpt-image-1.5`." }), Schema.Null ]) ), - "call_id": Schema.String.annotate({ - "description": "The unique ID of the function tool call generated by the model." - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)), - "type": Schema.Literal("function_call_output").annotate({ - "description": "The type of the function tool call output. Always `function_call_output`." - }), - "output": Schema.Union([ - Schema.String.annotate({ "description": "A JSON string of the output of the function tool call." }).check( - Schema.isMaxLength(10485760) - ), - Schema.Array( - Schema.Union([InputTextContentParam, InputImageContentParamAutoParam, InputFileContentParam], { mode: "oneOf" }) - .annotate({ "description": "A piece of message content, such as text, an image, or a file." }) - ).annotate({ "description": "An array of content outputs (text, image, file) for the function tool call." }) - ], { mode: "oneOf" }).annotate({ "description": "Text, image, or file output of the function tool call." }), - "status": Schema.optionalKey( + "n": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "description": "The number of images to generate. Must be between 1 and 10." + }) + ), + "size": Schema.optionalKey( Schema.Union([ - Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ - "description": - "The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API." - }), - Schema.Null - ]) - ) -}).annotate({ "title": "Function tool call output", "description": "The output of a function tool call." }) -export type LocalEnvironmentParam = { readonly "type": "local"; readonly "skills"?: ReadonlyArray } -export const LocalEnvironmentParam = Schema.Struct({ - "type": Schema.Literal("local").annotate({ "description": "Use a local computer environment." }), - "skills": Schema.optionalKey( - Schema.Array(LocalSkillParam).annotate({ "description": "An optional list of skills." }).check( - Schema.isMaxLength(200) - ) - ) -}) -export type FunctionShellCallOutputContentParam = { - readonly "stdout": string - readonly "stderr": string - readonly "outcome": FunctionShellCallOutputTimeoutOutcomeParam | FunctionShellCallOutputExitOutcomeParam -} -export const FunctionShellCallOutputContentParam = Schema.Struct({ - "stdout": Schema.String.annotate({ "description": "Captured stdout output for the shell call." }).check( - Schema.isMaxLength(10485760) - ), - "stderr": Schema.String.annotate({ "description": "Captured stderr output for the shell call." }).check( - Schema.isMaxLength(10485760) - ), - "outcome": Schema.Union([FunctionShellCallOutputTimeoutOutcomeParam, FunctionShellCallOutputExitOutcomeParam], { - mode: "oneOf" - }).annotate({ - "title": "Shell call outcome", - "description": "The exit or timeout outcome associated with this shell call." - }) -}).annotate({ - "title": "Shell output content", - "description": "Captured stdout and stderr for a portion of a shell tool call output." -}) -export type ApplyPatchToolCallItemParam = { - readonly "type": "apply_patch_call" - readonly "id"?: string | null - readonly "call_id": string - readonly "status": "in_progress" | "completed" - readonly "operation": - | ApplyPatchCreateFileOperationParam - | ApplyPatchDeleteFileOperationParam - | ApplyPatchUpdateFileOperationParam -} -export const ApplyPatchToolCallItemParam = Schema.Struct({ - "type": Schema.Literal("apply_patch_call").annotate({ - "description": "The type of the item. Always `apply_patch_call`." - }), - "id": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API." - }), - Schema.Null - ]) - ), - "call_id": Schema.String.annotate({ - "description": "The unique ID of the apply patch tool call generated by the model." - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)), - "status": Schema.Literals(["in_progress", "completed"]).annotate({ - "title": "Apply patch call status", - "description": "The status of the apply patch tool call. One of `in_progress` or `completed`." - }), - "operation": Schema.Union([ - ApplyPatchCreateFileOperationParam, - ApplyPatchDeleteFileOperationParam, - ApplyPatchUpdateFileOperationParam - ], { mode: "oneOf" }).annotate({ - "title": "Apply patch operation", - "description": "The specific create, delete, or update instruction for the apply_patch tool call." - }) -}).annotate({ - "title": "Apply patch tool call", - "description": "A tool call representing a request to create, delete, or update files using diff patches." -}) -export type CreateImageEditRequest = { - readonly "image": string | ReadonlyArray - readonly "prompt": string - readonly "mask"?: string - readonly "background"?: "transparent" | "opaque" | "auto" | null - readonly "model"?: - | string - | "gpt-image-1.5" - | "dall-e-2" - | "gpt-image-1" - | "gpt-image-1-mini" - | "chatgpt-image-latest" - | null - readonly "n"?: number | null - readonly "size"?: "256x256" | "512x512" | "1024x1024" | "1536x1024" | "1024x1536" | "auto" | null - readonly "response_format"?: "url" | "b64_json" | null - readonly "output_format"?: "png" | "jpeg" | "webp" | null - readonly "output_compression"?: number | null - readonly "user"?: string - readonly "input_fidelity"?: InputFidelity | null - readonly "stream"?: boolean | null - readonly "partial_images"?: PartialImages - readonly "quality"?: "standard" | "low" | "medium" | "high" | "auto" | null -} -export const CreateImageEditRequest = Schema.Struct({ - "image": Schema.Union([ - Schema.String.annotate({ "format": "binary" }), - Schema.Array(Schema.String.annotate({ "format": "binary" })).check(Schema.isMaxLength(16)) - ]).annotate({ - "description": - "The image(s) to edit. Must be a supported image file or an array of images.\n\nFor the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`\nfile less than 50MB. You can provide up to 16 images.\n`chatgpt-image-latest` follows the same input constraints as GPT image models.\n\nFor `dall-e-2`, you can only provide one image, and it should be a square\n`png` file less than 4MB.\n" - }), - "prompt": Schema.String.annotate({ - "description": - "A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models." - }), - "mask": Schema.optionalKey(Schema.String.annotate({ - "description": - "An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.", - "format": "binary" - })), - "background": Schema.optionalKey( - Schema.Union([Schema.Literal("transparent"), Schema.Literal("opaque"), Schema.Literal("auto"), Schema.Null]) - .annotate({ - "description": - "Allows to set transparency for the background of the generated image(s).\nThis parameter is only supported for the GPT image models. Must be one of\n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the\nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it\nshould be set to either `png` (default value) or `webp`.\n" - }) - ), - "model": Schema.optionalKey( - Schema.Union([ - Schema.Union([ - Schema.String, - Schema.Literals(["gpt-image-1.5", "dall-e-2", "gpt-image-1", "gpt-image-1-mini", "chatgpt-image-latest"]) - ]).annotate({ "description": "The model to use for image generation. Defaults to `gpt-image-1.5`." }), - Schema.Null - ]) - ), - "n": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "description": "The number of images to generate. Must be between 1 and 10." - }) - ), - "size": Schema.optionalKey( - Schema.Union([ - Schema.Literal("256x256"), - Schema.Literal("512x512"), - Schema.Literal("1024x1024"), - Schema.Literal("1536x1024"), - Schema.Literal("1024x1536"), - Schema.Literal("auto"), + Schema.Literal("256x256"), + Schema.Literal("512x512"), + Schema.Literal("1024x1024"), + Schema.Literal("1536x1024"), + Schema.Literal("1024x1536"), + Schema.Literal("auto"), Schema.Null ]).annotate({ "description": @@ -13464,11 +13347,21 @@ export const ImageGenTool = Schema.Struct({ "title": "Image generation tool", "description": "A tool that generates images using the GPT image models.\n" }) +export type LocalEnvironmentParam = { readonly "type": "local"; readonly "skills"?: ReadonlyArray } +export const LocalEnvironmentParam = Schema.Struct({ + "type": Schema.Literal("local").annotate({ "description": "Use a local computer environment." }), + "skills": Schema.optionalKey( + Schema.Array(LocalSkillParam).annotate({ "description": "An optional list of skills." }).check( + Schema.isMaxLength(200) + ) + ) +}) export type CustomToolParam = { readonly "type": "custom" readonly "name": string readonly "description"?: string readonly "format"?: CustomTextFormatParam | CustomGrammarFormatParam + readonly "defer_loading"?: boolean } export const CustomToolParam = Schema.Struct({ "type": Schema.Literal("custom").annotate({ "description": "The type of the custom tool. Always `custom`." }), @@ -13480,255 +13373,695 @@ export const CustomToolParam = Schema.Struct({ Schema.Union([CustomTextFormatParam, CustomGrammarFormatParam], { mode: "oneOf" }).annotate({ "description": "The input format for the custom tool. Default is unconstrained text." }) + ), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether this tool should be deferred and discovered via tool search." }) ) }).annotate({ "title": "Custom tool", "description": "A custom tool that processes input using a specified format. Learn more about [custom tools](/docs/guides/function-calling#custom-tools)" }) -export type ImageGenUsage = { - readonly "input_tokens": number - readonly "total_tokens": number - readonly "output_tokens": number - readonly "output_tokens_details"?: ImageGenOutputTokensDetails - readonly "input_tokens_details": ImageGenInputUsageDetails +export type FunctionToolParam = { + readonly "name": string + readonly "description"?: string | null + readonly "parameters"?: EmptyModelParam | null + readonly "strict"?: boolean | null + readonly "type": "function" + readonly "defer_loading"?: boolean } -export const ImageGenUsage = Schema.Struct({ - "input_tokens": Schema.Number.annotate({ - "description": "The number of tokens (images and text) in the input prompt." - }).check(Schema.isInt()), - "total_tokens": Schema.Number.annotate({ - "description": "The total number of tokens (images and text) used for the image generation." - }).check(Schema.isInt()), - "output_tokens": Schema.Number.annotate({ "description": "The number of output tokens generated by the model." }) - .check(Schema.isInt()), - "output_tokens_details": Schema.optionalKey(ImageGenOutputTokensDetails), - "input_tokens_details": ImageGenInputUsageDetails -}).annotate({ - "title": "Image generation usage", - "description": "For `gpt-image-1` only, the token usage information for the image generation." +export const FunctionToolParam = Schema.Struct({ + "name": Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)).check( + Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$")) + ), + "description": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + "parameters": Schema.optionalKey(Schema.Union([EmptyModelParam, Schema.Null])), + "strict": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + "type": Schema.Literal("function"), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Whether this function should be deferred and discovered via tool search." + }) + ) }) -export type ToolChoiceParam = - | ToolChoiceOptions - | ToolChoiceAllowed - | ToolChoiceTypes - | ToolChoiceFunction - | ToolChoiceMCP - | ToolChoiceCustom - | SpecificApplyPatchParam - | SpecificFunctionShellParam -export const ToolChoiceParam = Schema.Union([ - ToolChoiceOptions, - ToolChoiceAllowed, - ToolChoiceTypes, - ToolChoiceFunction, - ToolChoiceMCP, - ToolChoiceCustom, - SpecificApplyPatchParam, - SpecificFunctionShellParam -], { mode: "oneOf" }).annotate({ +export type WebSearchPreviewTool = { + readonly "type": "web_search_preview" | "web_search_preview_2025_03_11" + readonly "user_location"?: { + readonly "type": "approximate" + readonly "country"?: string | null + readonly "region"?: string | null + readonly "city"?: string | null + readonly "timezone"?: string | null + } | null + readonly "search_context_size"?: "low" | "medium" | "high" + readonly "search_content_types"?: ReadonlyArray +} +export const WebSearchPreviewTool = Schema.Struct({ + "type": Schema.Literals(["web_search_preview", "web_search_preview_2025_03_11"]).annotate({ + "description": "The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`." + }), + "user_location": Schema.optionalKey(Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("approximate").annotate({ + "description": "The type of location approximation. Always `approximate`." + }), + "country": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": + "The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`." + }), + Schema.Null + ]) + ), + "region": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ "description": "Free text input for the region of the user, e.g. `California`." }), + Schema.Null + ]) + ), + "city": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ "description": "Free text input for the city of the user, e.g. `San Francisco`." }), + Schema.Null + ]) + ), + "timezone": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": + "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`." + }), + Schema.Null + ]) + ) + }).annotate({ "description": "The user's location." }), + Schema.Null + ])), + "search_context_size": Schema.optionalKey( + Schema.Literals(["low", "medium", "high"]).annotate({ + "description": + "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default." + }) + ), + "search_content_types": Schema.optionalKey(Schema.Array(SearchContentType)) +}).annotate({ + "title": "Web search preview", "description": - "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n" + "This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search)." }) -export type ConversationParam = string | ConversationParam_2 -export const ConversationParam = Schema.Union([ - Schema.String.annotate({ "title": "Conversation ID", "description": "The unique ID of the conversation.\n" }), - ConversationParam_2 -], { mode: "oneOf" }).annotate({ - "description": - "The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request.\nInput items and output items from this response are automatically added to this conversation after this response completes.\n" -}) -export type VideoListResource = { - readonly "object": "list" - readonly "data": ReadonlyArray - readonly "first_id": string | null - readonly "last_id": string | null - readonly "has_more": boolean -} -export const VideoListResource = Schema.Struct({ - "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }), - "data": Schema.Array(VideoResource).annotate({ "description": "A list of items" }), - "first_id": Schema.Union([ - Schema.String.annotate({ "description": "The ID of the first item in the list." }), - Schema.Null - ]), - "last_id": Schema.Union([ - Schema.String.annotate({ "description": "The ID of the last item in the list." }), - Schema.Null - ]), - "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }) -}) -export type SkillListResource = { - readonly "object": "list" - readonly "data": ReadonlyArray - readonly "first_id": string | null - readonly "last_id": string | null - readonly "has_more": boolean -} -export const SkillListResource = Schema.Struct({ - "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }), - "data": Schema.Array(SkillResource).annotate({ "description": "A list of items" }), - "first_id": Schema.Union([ - Schema.String.annotate({ "description": "The ID of the first item in the list." }), - Schema.Null - ]), - "last_id": Schema.Union([ - Schema.String.annotate({ "description": "The ID of the last item in the list." }), - Schema.Null - ]), - "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }) -}) -export type SkillVersionListResource = { - readonly "object": "list" - readonly "data": ReadonlyArray - readonly "first_id": string | null - readonly "last_id": string | null - readonly "has_more": boolean -} -export const SkillVersionListResource = Schema.Struct({ - "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }), - "data": Schema.Array(SkillVersionResource).annotate({ "description": "A list of items" }), - "first_id": Schema.Union([ - Schema.String.annotate({ "description": "The ID of the first item in the list." }), - Schema.Null - ]), - "last_id": Schema.Union([ - Schema.String.annotate({ "description": "The ID of the last item in the list." }), - Schema.Null - ]), - "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }) -}) -export type UserMessageItem = { +export type CodeInterpreterToolCall = { + readonly "type": "code_interpreter_call" readonly "id": string - readonly "object": "chatkit.thread_item" - readonly "created_at": number - readonly "thread_id": string - readonly "type": "chatkit.user_message" - readonly "content": ReadonlyArray - readonly "attachments": ReadonlyArray - readonly "inference_options": { - readonly "tool_choice": { readonly "id": string } | null - readonly "model": string | null - } | null + readonly "status": "in_progress" | "completed" | "incomplete" | "interpreting" | "failed" + readonly "container_id": string + readonly "code": string | null + readonly "outputs": ReadonlyArray | null } -export const UserMessageItem = Schema.Struct({ - "id": Schema.String.annotate({ "description": "Identifier of the thread item." }), - "object": Schema.Literal("chatkit.thread_item").annotate({ - "description": "Type discriminator that is always `chatkit.thread_item`." +export const CodeInterpreterToolCall = Schema.Struct({ + "type": Schema.Literal("code_interpreter_call").annotate({ + "description": "The type of the code interpreter tool call. Always `code_interpreter_call`.\n" }), - "created_at": Schema.Number.annotate({ "description": "Unix timestamp (in seconds) for when the item was created." }) - .check(Schema.isInt()), - "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }), - "type": Schema.Literal("chatkit.user_message"), - "content": Schema.Array( - Schema.Union([UserMessageInputText, UserMessageQuotedText], { mode: "oneOf" }).annotate({ - "description": "Content blocks that comprise a user message." - }) - ).annotate({ "description": "Ordered content elements supplied by the user." }), - "attachments": Schema.Array(Attachment).annotate({ - "description": "Attachments associated with the user message. Defaults to an empty list." + "id": Schema.String.annotate({ "description": "The unique ID of the code interpreter tool call.\n" }), + "status": Schema.Literals(["in_progress", "completed", "incomplete", "interpreting", "failed"]).annotate({ + "description": + "The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n" }), - "inference_options": Schema.Union([ - Schema.Struct({ - "tool_choice": Schema.Union([ - Schema.Struct({ "id": Schema.String.annotate({ "description": "Identifier of the requested tool." }) }) - .annotate({ - "title": "Tool choice", - "description": "Preferred tool to invoke. Defaults to null when ChatKit should auto-select." - }), - Schema.Null - ]), - "model": Schema.Union([ - Schema.String.annotate({ - "description": "Model name that generated the response. Defaults to null when using the session default." - }), - Schema.Null - ]) - }).annotate({ - "title": "Inference options", - "description": "Inference overrides applied to the message. Defaults to null when unset." + "container_id": Schema.String.annotate({ "description": "The ID of the container used to run the code.\n" }), + "code": Schema.Union([ + Schema.String.annotate({ "description": "The code to run, or null if not available.\n" }), + Schema.Null + ]), + "outputs": Schema.Union([ + Schema.Array(Schema.Union([CodeInterpreterOutputLogs, CodeInterpreterOutputImage], { mode: "oneOf" })).annotate({ + "description": + "The outputs generated by the code interpreter, such as logs or images.\nCan be null if no outputs are available.\n" }), Schema.Null ]) -}).annotate({ "title": "User Message Item", "description": "User-authored messages within a thread." }) -export type ResponseOutputText = { - readonly "type": "output_text" - readonly "text": string - readonly "annotations": ReadonlyArray -} -export const ResponseOutputText = Schema.Struct({ - "type": Schema.Literal("output_text").annotate({ "description": "Type discriminator that is always `output_text`." }), - "text": Schema.String.annotate({ "description": "Assistant generated text." }), - "annotations": Schema.Array( - Schema.Union([FileAnnotation, UrlAnnotation], { mode: "oneOf" }).annotate({ - "description": "Annotation object describing a cited source." - }) - ).annotate({ "description": "Ordered list of annotations attached to the response text." }) -}).annotate({ - "title": "Assistant message content", - "description": "Assistant response text accompanied by optional annotations." -}) -export type TaskGroupItem = { +}).annotate({ "title": "Code interpreter tool call", "description": "A tool call to run code.\n" }) +export type LocalShellToolCall = { + readonly "type": "local_shell_call" readonly "id": string - readonly "object": "chatkit.thread_item" - readonly "created_at": number - readonly "thread_id": string - readonly "type": "chatkit.task_group" - readonly "tasks": ReadonlyArray + readonly "call_id": string + readonly "action": LocalShellExecAction + readonly "status": "in_progress" | "completed" | "incomplete" } -export const TaskGroupItem = Schema.Struct({ - "id": Schema.String.annotate({ "description": "Identifier of the thread item." }), - "object": Schema.Literal("chatkit.thread_item").annotate({ - "description": "Type discriminator that is always `chatkit.thread_item`." +export const LocalShellToolCall = Schema.Struct({ + "type": Schema.Literal("local_shell_call").annotate({ + "description": "The type of the local shell call. Always `local_shell_call`.\n" }), - "created_at": Schema.Number.annotate({ "description": "Unix timestamp (in seconds) for when the item was created." }) - .check(Schema.isInt()), - "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }), - "type": Schema.Literal("chatkit.task_group").annotate({ - "description": "Type discriminator that is always `chatkit.task_group`." + "id": Schema.String.annotate({ "description": "The unique ID of the local shell call.\n" }), + "call_id": Schema.String.annotate({ + "description": "The unique ID of the local shell tool call generated by the model.\n" }), - "tasks": Schema.Array(TaskGroupTask).annotate({ "description": "Tasks included in the group." }) -}).annotate({ "title": "Task group", "description": "Collection of workflow tasks grouped together in the thread." }) -export type ThreadResource = { + "action": LocalShellExecAction, + "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ + "description": "The status of the local shell call.\n" + }) +}).annotate({ "title": "Local shell call", "description": "A tool call to run a command on the local shell.\n" }) +export type FunctionShellCall = { + readonly "type": "shell_call" readonly "id": string - readonly "object": "chatkit.thread" - readonly "created_at": number - readonly "title": string | null - readonly "status": ActiveStatus | LockedStatus | ClosedStatus - readonly "user": string + readonly "call_id": string + readonly "action": { + readonly "commands": ReadonlyArray + readonly "timeout_ms": number | null + readonly "max_output_length": number | null + } + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "environment": LocalEnvironmentResource | ContainerReferenceResource | null + readonly "created_by"?: string } -export const ThreadResource = Schema.Struct({ - "id": Schema.String.annotate({ "description": "Identifier of the thread." }), - "object": Schema.Literal("chatkit.thread").annotate({ - "description": "Type discriminator that is always `chatkit.thread`." +export const FunctionShellCall = Schema.Struct({ + "type": Schema.Literal("shell_call").annotate({ "description": "The type of the item. Always `shell_call`." }), + "id": Schema.String.annotate({ + "description": "The unique ID of the shell tool call. Populated when this item is returned via API." }), - "created_at": Schema.Number.annotate({ - "description": "Unix timestamp (in seconds) for when the thread was created." - }).check(Schema.isInt()), - "title": Schema.Union([ - Schema.String.annotate({ - "description": "Optional human-readable title for the thread. Defaults to null when no title has been generated." - }), + "call_id": Schema.String.annotate({ "description": "The unique ID of the shell tool call generated by the model." }), + "action": Schema.Struct({ + "commands": Schema.Array(Schema.String.annotate({ "description": "A list of commands to run." })), + "timeout_ms": Schema.Union([ + Schema.Number.annotate({ "description": "Optional timeout in milliseconds for the commands." }).check( + Schema.isInt() + ), + Schema.Null + ]), + "max_output_length": Schema.Union([ + Schema.Number.annotate({ "description": "Optional maximum number of characters to return from each command." }) + .check(Schema.isInt()), + Schema.Null + ]) + }).annotate({ + "title": "Shell exec action", + "description": "The shell commands and limits that describe how to run the tool call." + }), + "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ + "description": "The status of the shell call. One of `in_progress`, `completed`, or `incomplete`." + }), + "environment": Schema.Union([ + Schema.Union([LocalEnvironmentResource, ContainerReferenceResource], { mode: "oneOf" }), Schema.Null ]), - "status": Schema.Union([ActiveStatus, LockedStatus, ClosedStatus], { mode: "oneOf" }).annotate({ - "description": "Current status for the thread. Defaults to `active` for newly created threads." - }), - "user": Schema.String.annotate({ - "description": "Free-form string that identifies your end user who owns the thread." - }) -}).annotate({ "title": "The thread object", "description": "Represents a ChatKit thread and its current status." }) -export type AuditLogActor = { - readonly "type"?: "session" | "api_key" - readonly "session"?: AuditLogActorSession - readonly "api_key"?: AuditLogActorApiKey -} -export const AuditLogActor = Schema.Struct({ - "type": Schema.optionalKey( - Schema.Literals(["session", "api_key"]).annotate({ - "description": "The type of actor. Is either `session` or `api_key`." - }) - ), + "created_by": Schema.optionalKey( + Schema.String.annotate({ "description": "The ID of the entity that created this tool call." }) + ) +}).annotate({ + "title": "Shell tool call", + "description": "A tool call that executes one or more shell commands in a managed environment." +}) +export type FunctionShellCallOutputContent = { + readonly "stdout": string + readonly "stderr": string + readonly "outcome": FunctionShellCallOutputTimeoutOutcome | FunctionShellCallOutputExitOutcome + readonly "created_by"?: string +} +export const FunctionShellCallOutputContent = Schema.Struct({ + "stdout": Schema.String.annotate({ "description": "The standard output that was captured." }), + "stderr": Schema.String.annotate({ "description": "The standard error output that was captured." }), + "outcome": Schema.Union([FunctionShellCallOutputTimeoutOutcome, FunctionShellCallOutputExitOutcome], { + mode: "oneOf" + }).annotate({ + "title": "Shell call outcome", + "description": + "Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk." + }), + "created_by": Schema.optionalKey( + Schema.String.annotate({ "description": "The identifier of the actor that created the item." }) + ) +}).annotate({ + "title": "Shell call output content", + "description": "The content of a shell tool call output that was emitted." +}) +export type ApplyPatchToolCall = { + readonly "type": "apply_patch_call" + readonly "id": string + readonly "call_id": string + readonly "status": "in_progress" | "completed" + readonly "operation": ApplyPatchCreateFileOperation | ApplyPatchDeleteFileOperation | ApplyPatchUpdateFileOperation + readonly "created_by"?: string +} +export const ApplyPatchToolCall = Schema.Struct({ + "type": Schema.Literal("apply_patch_call").annotate({ + "description": "The type of the item. Always `apply_patch_call`." + }), + "id": Schema.String.annotate({ + "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API." + }), + "call_id": Schema.String.annotate({ + "description": "The unique ID of the apply patch tool call generated by the model." + }), + "status": Schema.Literals(["in_progress", "completed"]).annotate({ + "description": "The status of the apply patch tool call. One of `in_progress` or `completed`." + }), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchDeleteFileOperation, + ApplyPatchUpdateFileOperation + ], { mode: "oneOf" }).annotate({ + "title": "Apply patch operation", + "description": "One of the create_file, delete_file, or update_file operations applied via apply_patch." + }), + "created_by": Schema.optionalKey( + Schema.String.annotate({ "description": "The ID of the entity that created this tool call." }) + ) +}).annotate({ + "title": "Apply patch tool call", + "description": "A tool call that applies file diffs by creating, deleting, or updating files." +}) +export type FunctionCallOutputItemParam = { + readonly "id"?: string | null + readonly "call_id": string + readonly "type": "function_call_output" + readonly "output": + | string + | ReadonlyArray + readonly "status"?: "in_progress" | "completed" | "incomplete" | null +} +export const FunctionCallOutputItemParam = Schema.Struct({ + "id": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": "The unique ID of the function tool call output. Populated when this item is returned via API." + }), + Schema.Null + ]) + ), + "call_id": Schema.String.annotate({ + "description": "The unique ID of the function tool call generated by the model." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)), + "type": Schema.Literal("function_call_output").annotate({ + "description": "The type of the function tool call output. Always `function_call_output`." + }), + "output": Schema.Union([ + Schema.String.annotate({ "description": "A JSON string of the output of the function tool call." }).check( + Schema.isMaxLength(10485760) + ), + Schema.Array( + Schema.Union([InputTextContentParam, InputImageContentParamAutoParam, InputFileContentParam], { mode: "oneOf" }) + .annotate({ "description": "A piece of message content, such as text, an image, or a file." }) + ).annotate({ "description": "An array of content outputs (text, image, file) for the function tool call." }) + ], { mode: "oneOf" }).annotate({ "description": "Text, image, or file output of the function tool call." }), + "status": Schema.optionalKey( + Schema.Union([ + Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ + "description": + "The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API." + }), + Schema.Null + ]) + ) +}).annotate({ "title": "Function tool call output", "description": "The output of a function tool call." }) +export type FunctionShellCallOutputContentParam = { + readonly "stdout": string + readonly "stderr": string + readonly "outcome": FunctionShellCallOutputTimeoutOutcomeParam | FunctionShellCallOutputExitOutcomeParam +} +export const FunctionShellCallOutputContentParam = Schema.Struct({ + "stdout": Schema.String.annotate({ "description": "Captured stdout output for the shell call." }).check( + Schema.isMaxLength(10485760) + ), + "stderr": Schema.String.annotate({ "description": "Captured stderr output for the shell call." }).check( + Schema.isMaxLength(10485760) + ), + "outcome": Schema.Union([FunctionShellCallOutputTimeoutOutcomeParam, FunctionShellCallOutputExitOutcomeParam], { + mode: "oneOf" + }).annotate({ + "title": "Shell call outcome", + "description": "The exit or timeout outcome associated with this shell call." + }) +}).annotate({ + "title": "Shell output content", + "description": "Captured stdout and stderr for a portion of a shell tool call output." +}) +export type ApplyPatchToolCallItemParam = { + readonly "type": "apply_patch_call" + readonly "id"?: string | null + readonly "call_id": string + readonly "status": "in_progress" | "completed" + readonly "operation": + | ApplyPatchCreateFileOperationParam + | ApplyPatchDeleteFileOperationParam + | ApplyPatchUpdateFileOperationParam +} +export const ApplyPatchToolCallItemParam = Schema.Struct({ + "type": Schema.Literal("apply_patch_call").annotate({ + "description": "The type of the item. Always `apply_patch_call`." + }), + "id": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API." + }), + Schema.Null + ]) + ), + "call_id": Schema.String.annotate({ + "description": "The unique ID of the apply patch tool call generated by the model." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)), + "status": Schema.Literals(["in_progress", "completed"]).annotate({ + "title": "Apply patch call status", + "description": "The status of the apply patch tool call. One of `in_progress` or `completed`." + }), + "operation": Schema.Union([ + ApplyPatchCreateFileOperationParam, + ApplyPatchDeleteFileOperationParam, + ApplyPatchUpdateFileOperationParam + ], { mode: "oneOf" }).annotate({ + "title": "Apply patch operation", + "description": "The specific create, delete, or update instruction for the apply_patch tool call." + }) +}).annotate({ + "title": "Apply patch tool call", + "description": "A tool call representing a request to create, delete, or update files using diff patches." +}) +export type ImageGenUsage = { + readonly "input_tokens": number + readonly "total_tokens": number + readonly "output_tokens": number + readonly "output_tokens_details"?: ImageGenOutputTokensDetails + readonly "input_tokens_details": ImageGenInputUsageDetails +} +export const ImageGenUsage = Schema.Struct({ + "input_tokens": Schema.Number.annotate({ + "description": "The number of tokens (images and text) in the input prompt." + }).check(Schema.isInt()), + "total_tokens": Schema.Number.annotate({ + "description": "The total number of tokens (images and text) used for the image generation." + }).check(Schema.isInt()), + "output_tokens": Schema.Number.annotate({ "description": "The number of output tokens generated by the model." }) + .check(Schema.isInt()), + "output_tokens_details": Schema.optionalKey(ImageGenOutputTokensDetails), + "input_tokens_details": ImageGenInputUsageDetails +}).annotate({ + "title": "Image generation usage", + "description": "For `gpt-image-1` only, the token usage information for the image generation." +}) +export type ToolChoiceParam = + | ToolChoiceOptions + | ToolChoiceAllowed + | ToolChoiceTypes + | ToolChoiceFunction + | ToolChoiceMCP + | ToolChoiceCustom + | SpecificApplyPatchParam + | SpecificFunctionShellParam +export const ToolChoiceParam = Schema.Union([ + ToolChoiceOptions, + ToolChoiceAllowed, + ToolChoiceTypes, + ToolChoiceFunction, + ToolChoiceMCP, + ToolChoiceCustom, + SpecificApplyPatchParam, + SpecificFunctionShellParam +], { mode: "oneOf" }).annotate({ + "description": + "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n" +}) +export type ConversationParam = string | ConversationParam_2 +export const ConversationParam = Schema.Union([ + Schema.String.annotate({ "title": "Conversation ID", "description": "The unique ID of the conversation.\n" }), + ConversationParam_2 +], { mode: "oneOf" }).annotate({ + "description": + "The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request.\nInput items and output items from this response are automatically added to this conversation after this response completes.\n" +}) +export type VideoListResource = { + readonly "object": "list" + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "last_id": string | null + readonly "has_more": boolean +} +export const VideoListResource = Schema.Struct({ + "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }), + "data": Schema.Array(VideoResource).annotate({ "description": "A list of items" }), + "first_id": Schema.Union([ + Schema.String.annotate({ "description": "The ID of the first item in the list." }), + Schema.Null + ]), + "last_id": Schema.Union([ + Schema.String.annotate({ "description": "The ID of the last item in the list." }), + Schema.Null + ]), + "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }) +}) +export type CreateVideoMultipartBody = { + readonly "model"?: + | string + | "sora-2" + | "sora-2-pro" + | "sora-2-2025-10-06" + | "sora-2-pro-2025-10-06" + | "sora-2-2025-12-08" + readonly "prompt": string + readonly "input_reference"?: string | ImageRefParam_2 + readonly "seconds"?: "4" | "8" | "12" + readonly "size"?: "720x1280" | "1280x720" | "1024x1792" | "1792x1024" +} +export const CreateVideoMultipartBody = Schema.Struct({ + "model": Schema.optionalKey( + Schema.Union([ + Schema.String, + Schema.Literals(["sora-2", "sora-2-pro", "sora-2-2025-10-06", "sora-2-pro-2025-10-06", "sora-2-2025-12-08"]) + ]).annotate({ + "description": "The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`." + }) + ), + "prompt": Schema.String.annotate({ "description": "Text prompt that describes the video to generate." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(32000)), + "input_reference": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": "Optional reference asset upload or reference object that guides generation.", + "format": "binary" + }), + ImageRefParam_2 + ], { mode: "oneOf" }) + ), + "seconds": Schema.optionalKey( + Schema.Literals(["4", "8", "12"]).annotate({ + "description": "Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds." + }) + ), + "size": Schema.optionalKey( + Schema.Literals(["720x1280", "1280x720", "1024x1792", "1792x1024"]).annotate({ + "description": + "Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280." + }) + ) +}).annotate({ + "title": "Create video multipart request", + "description": "Multipart parameters for creating a new video generation job." +}) +export type CreateVideoEditMultipartBody = { + readonly "video": string | VideoReferenceInputParam + readonly "prompt": string +} +export const CreateVideoEditMultipartBody = Schema.Struct({ + "video": Schema.Union([ + Schema.String.annotate({ "description": "Reference to the completed video to edit.", "format": "binary" }), + VideoReferenceInputParam + ], { mode: "oneOf" }), + "prompt": Schema.String.annotate({ "description": "Text prompt that describes how to edit the source video." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(32000)) +}).annotate({ + "title": "Create video edit multipart request", + "description": "Parameters for editing an existing generated video." +}) +export type CreateVideoExtendMultipartBody = { + readonly "video": VideoReferenceInputParam | string + readonly "prompt": string + readonly "seconds": "4" | "8" | "12" +} +export const CreateVideoExtendMultipartBody = Schema.Struct({ + "video": Schema.Union([ + VideoReferenceInputParam, + Schema.String.annotate({ "description": "Reference to the completed video to extend.", "format": "binary" }) + ], { mode: "oneOf" }), + "prompt": Schema.String.annotate({ "description": "Updated text prompt that directs the extension generation." }) + .check(Schema.isMinLength(1)).check(Schema.isMaxLength(32000)), + "seconds": Schema.Literals(["4", "8", "12"]).annotate({ + "description": "Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20)." + }) +}).annotate({ + "title": "Create video extension multipart request", + "description": "Multipart parameters for extending an existing generated video." +}) +export type SkillListResource = { + readonly "object": "list" + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "last_id": string | null + readonly "has_more": boolean +} +export const SkillListResource = Schema.Struct({ + "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }), + "data": Schema.Array(SkillResource).annotate({ "description": "A list of items" }), + "first_id": Schema.Union([ + Schema.String.annotate({ "description": "The ID of the first item in the list." }), + Schema.Null + ]), + "last_id": Schema.Union([ + Schema.String.annotate({ "description": "The ID of the last item in the list." }), + Schema.Null + ]), + "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }) +}) +export type SkillVersionListResource = { + readonly "object": "list" + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "last_id": string | null + readonly "has_more": boolean +} +export const SkillVersionListResource = Schema.Struct({ + "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }), + "data": Schema.Array(SkillVersionResource).annotate({ "description": "A list of items" }), + "first_id": Schema.Union([ + Schema.String.annotate({ "description": "The ID of the first item in the list." }), + Schema.Null + ]), + "last_id": Schema.Union([ + Schema.String.annotate({ "description": "The ID of the last item in the list." }), + Schema.Null + ]), + "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }) +}) +export type UserMessageItem = { + readonly "id": string + readonly "object": "chatkit.thread_item" + readonly "created_at": number + readonly "thread_id": string + readonly "type": "chatkit.user_message" + readonly "content": ReadonlyArray + readonly "attachments": ReadonlyArray + readonly "inference_options": { + readonly "tool_choice": { readonly "id": string } | null + readonly "model": string | null + } | null +} +export const UserMessageItem = Schema.Struct({ + "id": Schema.String.annotate({ "description": "Identifier of the thread item." }), + "object": Schema.Literal("chatkit.thread_item").annotate({ + "description": "Type discriminator that is always `chatkit.thread_item`." + }), + "created_at": Schema.Number.annotate({ "description": "Unix timestamp (in seconds) for when the item was created." }) + .check(Schema.isInt()), + "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }), + "type": Schema.Literal("chatkit.user_message"), + "content": Schema.Array( + Schema.Union([UserMessageInputText, UserMessageQuotedText], { mode: "oneOf" }).annotate({ + "description": "Content blocks that comprise a user message." + }) + ).annotate({ "description": "Ordered content elements supplied by the user." }), + "attachments": Schema.Array(Attachment).annotate({ + "description": "Attachments associated with the user message. Defaults to an empty list." + }), + "inference_options": Schema.Union([ + Schema.Struct({ + "tool_choice": Schema.Union([ + Schema.Struct({ "id": Schema.String.annotate({ "description": "Identifier of the requested tool." }) }) + .annotate({ + "title": "Tool choice", + "description": "Preferred tool to invoke. Defaults to null when ChatKit should auto-select." + }), + Schema.Null + ]), + "model": Schema.Union([ + Schema.String.annotate({ + "description": "Model name that generated the response. Defaults to null when using the session default." + }), + Schema.Null + ]) + }).annotate({ + "title": "Inference options", + "description": "Inference overrides applied to the message. Defaults to null when unset." + }), + Schema.Null + ]) +}).annotate({ "title": "User Message Item", "description": "User-authored messages within a thread." }) +export type ResponseOutputText = { + readonly "type": "output_text" + readonly "text": string + readonly "annotations": ReadonlyArray +} +export const ResponseOutputText = Schema.Struct({ + "type": Schema.Literal("output_text").annotate({ "description": "Type discriminator that is always `output_text`." }), + "text": Schema.String.annotate({ "description": "Assistant generated text." }), + "annotations": Schema.Array( + Schema.Union([FileAnnotation, UrlAnnotation], { mode: "oneOf" }).annotate({ + "description": "Annotation object describing a cited source." + }) + ).annotate({ "description": "Ordered list of annotations attached to the response text." }) +}).annotate({ + "title": "Assistant message content", + "description": "Assistant response text accompanied by optional annotations." +}) +export type TaskGroupItem = { + readonly "id": string + readonly "object": "chatkit.thread_item" + readonly "created_at": number + readonly "thread_id": string + readonly "type": "chatkit.task_group" + readonly "tasks": ReadonlyArray +} +export const TaskGroupItem = Schema.Struct({ + "id": Schema.String.annotate({ "description": "Identifier of the thread item." }), + "object": Schema.Literal("chatkit.thread_item").annotate({ + "description": "Type discriminator that is always `chatkit.thread_item`." + }), + "created_at": Schema.Number.annotate({ "description": "Unix timestamp (in seconds) for when the item was created." }) + .check(Schema.isInt()), + "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }), + "type": Schema.Literal("chatkit.task_group").annotate({ + "description": "Type discriminator that is always `chatkit.task_group`." + }), + "tasks": Schema.Array(TaskGroupTask).annotate({ "description": "Tasks included in the group." }) +}).annotate({ "title": "Task group", "description": "Collection of workflow tasks grouped together in the thread." }) +export type ThreadResource = { + readonly "id": string + readonly "object": "chatkit.thread" + readonly "created_at": number + readonly "title": string | null + readonly "status": ActiveStatus | LockedStatus | ClosedStatus + readonly "user": string +} +export const ThreadResource = Schema.Struct({ + "id": Schema.String.annotate({ "description": "Identifier of the thread." }), + "object": Schema.Literal("chatkit.thread").annotate({ + "description": "Type discriminator that is always `chatkit.thread`." + }), + "created_at": Schema.Number.annotate({ + "description": "Unix timestamp (in seconds) for when the thread was created." + }).check(Schema.isInt()), + "title": Schema.Union([ + Schema.String.annotate({ + "description": "Optional human-readable title for the thread. Defaults to null when no title has been generated." + }), + Schema.Null + ]), + "status": Schema.Union([ActiveStatus, LockedStatus, ClosedStatus], { mode: "oneOf" }).annotate({ + "description": "Current status for the thread. Defaults to `active` for newly created threads." + }), + "user": Schema.String.annotate({ + "description": "Free-form string that identifies your end user who owns the thread." + }) +}).annotate({ "title": "The thread object", "description": "Represents a ChatKit thread and its current status." }) +export type AuditLogActor = { + readonly "type"?: "session" | "api_key" + readonly "session"?: AuditLogActorSession + readonly "api_key"?: AuditLogActorApiKey +} +export const AuditLogActor = Schema.Struct({ + "type": Schema.optionalKey( + Schema.Literals(["session", "api_key"]).annotate({ + "description": "The type of actor. Is either `session` or `api_key`." + }) + ), "session": Schema.optionalKey(AuditLogActorSession), "api_key": Schema.optionalKey(AuditLogActorApiKey) }).annotate({ "description": "The actor who performed the audit logged action." }) @@ -14710,6 +15043,7 @@ export type RealtimeCallCreateRequest = { readonly "model"?: | string | "gpt-realtime" + | "gpt-realtime-1.5" | "gpt-realtime-2025-08-28" | "gpt-4o-realtime-preview" | "gpt-4o-realtime-preview-2024-10-01" @@ -14720,6 +15054,7 @@ export type RealtimeCallCreateRequest = { | "gpt-realtime-mini" | "gpt-realtime-mini-2025-10-06" | "gpt-realtime-mini-2025-12-15" + | "gpt-audio-1.5" | "gpt-audio-mini" | "gpt-audio-mini-2025-10-06" | "gpt-audio-mini-2025-12-15" @@ -14747,19 +15082,7 @@ export type RealtimeCallCreateRequest = { readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | { readonly "type"?: "audio/pcmu" } | { readonly "type"?: "audio/pcma" } - readonly "voice"?: - | string - | "alloy" - | "ash" - | "ballad" - | "coral" - | "echo" - | "sage" - | "shimmer" - | "verse" - | "marin" - | "cedar" - | { readonly "id": string } + readonly "voice"?: VoiceIdsShared | { readonly "id": string } readonly "speed"?: number } } @@ -14796,6 +15119,7 @@ export const RealtimeCallCreateRequest = Schema.Struct({ Schema.String, Schema.Literals([ "gpt-realtime", + "gpt-realtime-1.5", "gpt-realtime-2025-08-28", "gpt-4o-realtime-preview", "gpt-4o-realtime-preview-2024-10-01", @@ -14806,6 +15130,7 @@ export const RealtimeCallCreateRequest = Schema.Struct({ "gpt-realtime-mini", "gpt-realtime-mini-2025-10-06", "gpt-realtime-mini-2025-12-15", + "gpt-audio-1.5", "gpt-audio-mini", "gpt-audio-mini-2025-10-06", "gpt-audio-mini-2025-12-15" @@ -14912,21 +15237,7 @@ export const RealtimeCallCreateRequest = Schema.Struct({ ), "voice": Schema.optionalKey( Schema.Union([ - Schema.Union([ - Schema.String, - Schema.Literals([ - "alloy", - "ash", - "ballad", - "coral", - "echo", - "sage", - "shimmer", - "verse", - "marin", - "cedar" - ]) - ]), + VoiceIdsShared, Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) }).annotate({ "description": "Custom voice reference." }) @@ -15022,6 +15333,7 @@ export type RealtimeSession = { readonly "model"?: | string | "gpt-realtime" + | "gpt-realtime-1.5" | "gpt-realtime-2025-08-28" | "gpt-4o-realtime-preview" | "gpt-4o-realtime-preview-2024-10-01" @@ -15032,6 +15344,7 @@ export type RealtimeSession = { | "gpt-realtime-mini" | "gpt-realtime-mini-2025-10-06" | "gpt-realtime-mini-2025-12-15" + | "gpt-audio-1.5" | "gpt-audio-mini" | "gpt-audio-mini-2025-10-06" | "gpt-audio-mini-2025-12-15" @@ -15096,6 +15409,7 @@ export const RealtimeSession = Schema.Struct({ Schema.String, Schema.Literals([ "gpt-realtime", + "gpt-realtime-1.5", "gpt-realtime-2025-08-28", "gpt-4o-realtime-preview", "gpt-4o-realtime-preview-2024-10-01", @@ -15106,6 +15420,7 @@ export const RealtimeSession = Schema.Struct({ "gpt-realtime-mini", "gpt-realtime-mini-2025-10-06", "gpt-realtime-mini-2025-12-15", + "gpt-audio-1.5", "gpt-audio-mini", "gpt-audio-mini-2025-10-06", "gpt-audio-mini-2025-12-15" @@ -15255,19 +15570,7 @@ export type RealtimeSessionCreateRequest = { readonly "client_secret": { readonly "value": string; readonly "expires_at": number } readonly "modalities"?: ReadonlyArray<"text" | "audio"> readonly "instructions"?: string - readonly "voice"?: - | string - | "alloy" - | "ash" - | "ballad" - | "coral" - | "echo" - | "sage" - | "shimmer" - | "verse" - | "marin" - | "cedar" - | { readonly "id": string } + readonly "voice"?: VoiceIdsShared | { readonly "id": string } readonly "input_audio_format"?: string readonly "output_audio_format"?: string readonly "input_audio_transcription"?: { readonly "model"?: string } @@ -15318,10 +15621,7 @@ export const RealtimeSessionCreateRequest = Schema.Struct({ })), "voice": Schema.optionalKey( Schema.Union([ - Schema.Union([ - Schema.String, - Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"]) - ]), + VoiceIdsShared, Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) }) .annotate({ "description": "Custom voice reference." }) ]).annotate({ @@ -15455,6 +15755,7 @@ export type RealtimeSessionCreateRequestGA = { readonly "model"?: | string | "gpt-realtime" + | "gpt-realtime-1.5" | "gpt-realtime-2025-08-28" | "gpt-4o-realtime-preview" | "gpt-4o-realtime-preview-2024-10-01" @@ -15465,6 +15766,7 @@ export type RealtimeSessionCreateRequestGA = { | "gpt-realtime-mini" | "gpt-realtime-mini-2025-10-06" | "gpt-realtime-mini-2025-12-15" + | "gpt-audio-1.5" | "gpt-audio-mini" | "gpt-audio-mini-2025-10-06" | "gpt-audio-mini-2025-12-15" @@ -15492,19 +15794,7 @@ export type RealtimeSessionCreateRequestGA = { readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | { readonly "type"?: "audio/pcmu" } | { readonly "type"?: "audio/pcma" } - readonly "voice"?: - | string - | "alloy" - | "ash" - | "ballad" - | "coral" - | "echo" - | "sage" - | "shimmer" - | "verse" - | "marin" - | "cedar" - | { readonly "id": string } + readonly "voice"?: VoiceIdsShared | { readonly "id": string } readonly "speed"?: number } } @@ -15535,6 +15825,7 @@ export const RealtimeSessionCreateRequestGA = Schema.Struct({ Schema.String, Schema.Literals([ "gpt-realtime", + "gpt-realtime-1.5", "gpt-realtime-2025-08-28", "gpt-4o-realtime-preview", "gpt-4o-realtime-preview-2024-10-01", @@ -15545,6 +15836,7 @@ export const RealtimeSessionCreateRequestGA = Schema.Struct({ "gpt-realtime-mini", "gpt-realtime-mini-2025-10-06", "gpt-realtime-mini-2025-12-15", + "gpt-audio-1.5", "gpt-audio-mini", "gpt-audio-mini-2025-10-06", "gpt-audio-mini-2025-12-15" @@ -15651,10 +15943,7 @@ export const RealtimeSessionCreateRequestGA = Schema.Struct({ ), "voice": Schema.optionalKey( Schema.Union([ - Schema.Union([ - Schema.String, - Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"]) - ]), + VoiceIdsShared, Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) }).annotate({ "description": "Custom voice reference." }) @@ -15741,6 +16030,7 @@ export type RealtimeSessionCreateResponseGA = { readonly "model"?: | string | "gpt-realtime" + | "gpt-realtime-1.5" | "gpt-realtime-2025-08-28" | "gpt-4o-realtime-preview" | "gpt-4o-realtime-preview-2024-10-01" @@ -15751,6 +16041,7 @@ export type RealtimeSessionCreateResponseGA = { | "gpt-realtime-mini" | "gpt-realtime-mini-2025-10-06" | "gpt-realtime-mini-2025-12-15" + | "gpt-audio-1.5" | "gpt-audio-mini" | "gpt-audio-mini-2025-10-06" | "gpt-audio-mini-2025-12-15" @@ -15829,6 +16120,7 @@ export const RealtimeSessionCreateResponseGA = Schema.Struct({ Schema.String, Schema.Literals([ "gpt-realtime", + "gpt-realtime-1.5", "gpt-realtime-2025-08-28", "gpt-4o-realtime-preview", "gpt-4o-realtime-preview-2024-10-01", @@ -15839,6 +16131,7 @@ export const RealtimeSessionCreateResponseGA = Schema.Struct({ "gpt-realtime-mini", "gpt-realtime-mini-2025-10-06", "gpt-realtime-mini-2025-12-15", + "gpt-audio-1.5", "gpt-audio-mini", "gpt-audio-mini-2025-10-06", "gpt-audio-mini-2025-12-15" @@ -16441,43 +16734,9 @@ export const ComputerAction = Schema.Union([ MoveParam, ScreenshotParam, ScrollParam, - TypeParam, - WaitParam -], { mode: "oneOf" }) -export type FunctionShellCallOutput = { - readonly "type": "shell_call_output" - readonly "id": string - readonly "call_id": string - readonly "status": "in_progress" | "completed" | "incomplete" - readonly "output": ReadonlyArray - readonly "max_output_length": number | null - readonly "created_by"?: string -} -export const FunctionShellCallOutput = Schema.Struct({ - "type": Schema.Literal("shell_call_output").annotate({ - "description": "The type of the shell call output. Always `shell_call_output`." - }), - "id": Schema.String.annotate({ - "description": "The unique ID of the shell call output. Populated when this item is returned via API." - }), - "call_id": Schema.String.annotate({ "description": "The unique ID of the shell tool call generated by the model." }), - "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ - "description": "The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`." - }), - "output": Schema.Array(FunctionShellCallOutputContent).annotate({ - "description": "An array of shell call output contents" - }), - "max_output_length": Schema.Union([ - Schema.Number.annotate({ - "description": - "The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output." - }).check(Schema.isInt()), - Schema.Null - ]), - "created_by": Schema.optionalKey( - Schema.String.annotate({ "description": "The identifier of the actor that created the item." }) - ) -}).annotate({ "title": "Shell call output", "description": "The output of a shell tool call that was emitted." }) + TypeParam, + WaitParam +], { mode: "oneOf" }) export type FunctionShellCallItemParam = { readonly "id"?: string | null readonly "call_id": string @@ -16547,6 +16806,61 @@ export const FunctionShellCallItemParam = Schema.Struct({ "title": "Shell tool call", "description": "A tool representing a request to execute one or more shell commands." }) +export type NamespaceToolParam = { + readonly "type": "namespace" + readonly "name": string + readonly "description": string + readonly "tools": ReadonlyArray +} +export const NamespaceToolParam = Schema.Struct({ + "type": Schema.Literal("namespace").annotate({ "description": "The type of the tool. Always `namespace`." }), + "name": Schema.String.annotate({ "description": "The namespace name used in tool calls (for example, `crm`)." }) + .check(Schema.isMinLength(1)), + "description": Schema.String.annotate({ "description": "A description of the namespace shown to the model." }).check( + Schema.isMinLength(1) + ), + "tools": Schema.Array( + Schema.Union([FunctionToolParam, CustomToolParam], { mode: "oneOf" }).annotate({ + "description": "A function or custom tool that belongs to a namespace." + }) + ).annotate({ "description": "The function/custom tools available inside this namespace." }).check( + Schema.isMinLength(1) + ) +}).annotate({ "title": "Namespace", "description": "Groups function/custom tools under a shared namespace." }) +export type FunctionShellCallOutput = { + readonly "type": "shell_call_output" + readonly "id": string + readonly "call_id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "output": ReadonlyArray + readonly "max_output_length": number | null + readonly "created_by"?: string +} +export const FunctionShellCallOutput = Schema.Struct({ + "type": Schema.Literal("shell_call_output").annotate({ + "description": "The type of the shell call output. Always `shell_call_output`." + }), + "id": Schema.String.annotate({ + "description": "The unique ID of the shell call output. Populated when this item is returned via API." + }), + "call_id": Schema.String.annotate({ "description": "The unique ID of the shell tool call generated by the model." }), + "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ + "description": "The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`." + }), + "output": Schema.Array(FunctionShellCallOutputContent).annotate({ + "description": "An array of shell call output contents" + }), + "max_output_length": Schema.Union([ + Schema.Number.annotate({ + "description": + "The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output." + }).check(Schema.isInt()), + Schema.Null + ]), + "created_by": Schema.optionalKey( + Schema.String.annotate({ "description": "The identifier of the actor that created the item." }) + ) +}).annotate({ "title": "Shell call output", "description": "The output of a shell tool call that was emitted." }) export type FunctionShellCallOutputItemParam = { readonly "id"?: string | null readonly "call_id": string @@ -17687,19 +18001,7 @@ export const RealtimeBetaResponse = Schema.Struct({ export type RealtimeBetaResponseCreateParams = { readonly "modalities"?: ReadonlyArray<"text" | "audio"> readonly "instructions"?: string - readonly "voice"?: - | string - | "alloy" - | "ash" - | "ballad" - | "coral" - | "echo" - | "sage" - | "shimmer" - | "verse" - | "marin" - | "cedar" - | { readonly "id": string } + readonly "voice"?: VoiceIdsShared | { readonly "id": string } readonly "output_audio_format"?: "pcm16" | "g711_ulaw" | "g711_alaw" readonly "tools"?: ReadonlyArray< { @@ -17729,10 +18031,7 @@ export const RealtimeBetaResponseCreateParams = Schema.Struct({ })), "voice": Schema.optionalKey( Schema.Union([ - Schema.Union([ - Schema.String, - Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"]) - ]), + VoiceIdsShared, Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) }) .annotate({ "description": "Custom voice reference." }) ]).annotate({ @@ -18058,19 +18357,7 @@ export type RealtimeResponseCreateParams = { readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | { readonly "type"?: "audio/pcmu" } | { readonly "type"?: "audio/pcma" } - readonly "voice"?: - | string - | "alloy" - | "ash" - | "ballad" - | "coral" - | "echo" - | "sage" - | "shimmer" - | "verse" - | "marin" - | "cedar" - | { readonly "id": string } + readonly "voice"?: VoiceIdsShared | { readonly "id": string } } } readonly "tools"?: ReadonlyArray @@ -18122,10 +18409,7 @@ export const RealtimeResponseCreateParams = Schema.Struct({ ), "voice": Schema.optionalKey( Schema.Union([ - Schema.Union([ - Schema.String, - Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"]) - ]), + VoiceIdsShared, Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) }).annotate({ "description": "Custom voice reference." }) @@ -19334,9 +19618,7 @@ export const EvalItemContent = Schema.Union([EvalItemContentItem, EvalItemConten "Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.\n" }) export type OutputMessageContent = OutputTextContent | RefusalContent -export const OutputMessageContent = Schema.Union([OutputTextContent, RefusalContent], { - mode: "oneOf" -}) +export const OutputMessageContent = Schema.Union([OutputTextContent, RefusalContent], { mode: "oneOf" }) export type ResponseContentPartAddedEvent = { readonly "type": "response.content_part.added" readonly "item_id": string @@ -19439,6 +19721,7 @@ export const Message = Schema.Struct({ export type EasyInputMessage = { readonly "role": "user" | "assistant" | "system" | "developer" readonly "content": string | InputMessageContentList + readonly "phase"?: MessagePhase | null readonly "type"?: "message" } export const EasyInputMessage = Schema.Struct({ @@ -19452,6 +19735,7 @@ export const EasyInputMessage = Schema.Struct({ "description": "Text, image, or audio input to the model, used to generate a response.\nCan also contain previous assistant responses.\n" }), + "phase": Schema.optionalKey(Schema.Union([MessagePhase, Schema.Null])), "type": Schema.optionalKey( Schema.Literal("message").annotate({ "description": "The type of the message input. Always `message`.\n" }) ) @@ -19486,16 +19770,16 @@ export const InputMessage = Schema.Struct({ "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role.\n" }) export type InputMessageResource = { - readonly "type"?: "message" + readonly "type": "message" readonly "role": "user" | "system" | "developer" readonly "status"?: "in_progress" | "completed" | "incomplete" readonly "content": InputMessageContentList readonly "id": string } export const InputMessageResource = Schema.Struct({ - "type": Schema.optionalKey( - Schema.Literal("message").annotate({ "description": "The type of the message input. Always set to `message`.\n" }) - ), + "type": Schema.Literal("message").annotate({ + "description": "The type of the message input. Always set to `message`.\n" + }), "role": Schema.Literals(["user", "system", "developer"]).annotate({ "description": "The role of the message input. One of `user`, `system`, or `developer`.\n" }), @@ -19512,34 +19796,11 @@ export const InputMessageResource = Schema.Struct({ "description": "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role.\n" }) -export type ComputerToolCall = { - readonly "type": "computer_call" - readonly "id": string - readonly "call_id": string - readonly "action": ComputerAction - readonly "pending_safety_checks": ReadonlyArray - readonly "status": "in_progress" | "completed" | "incomplete" -} -export const ComputerToolCall = Schema.Struct({ - "type": Schema.Literal("computer_call").annotate({ - "description": "The type of the computer call. Always `computer_call`." - }), - "id": Schema.String.annotate({ "description": "The unique ID of the computer call." }), - "call_id": Schema.String.annotate({ - "description": "An identifier used when responding to the tool call with output.\n" - }), - "action": ComputerAction, - "pending_safety_checks": Schema.Array(ComputerCallSafetyCheckParam).annotate({ - "description": "The pending safety checks for the computer call.\n" - }), - "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ - "description": - "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n" - }) -}).annotate({ - "title": "Computer tool call", +export type ComputerActionList = ReadonlyArray +export const ComputerActionList = Schema.Array(ComputerAction).annotate({ + "title": "Computer Action List", "description": - "A tool call to a computer use tool. See the\n[computer use guide](/docs/guides/tools-computer-use) for more information.\n" + "Flattened batched actions for `computer_use`. Each action includes an\n`type` discriminator and action-specific fields.\n" }) export type ThreadItem = | UserMessageItem @@ -19603,6 +19864,12 @@ export type CreateChatCompletionRequest = { readonly "messages": ReadonlyArray readonly "model": | string + | "gpt-5.4" + | "gpt-5.4-mini" + | "gpt-5.4-nano" + | "gpt-5.4-mini-2026-03-17" + | "gpt-5.4-nano-2026-03-17" + | "gpt-5.3-chat-latest" | "gpt-5.2" | "gpt-5.2-2025-12-11" | "gpt-5.2-chat-latest" @@ -19778,6 +20045,12 @@ export const CreateChatCompletionRequest = Schema.Struct({ "model": Schema.Union([ Schema.String, Schema.Literals([ + "gpt-5.4", + "gpt-5.4-mini", + "gpt-5.4-nano", + "gpt-5.4-mini-2026-03-17", + "gpt-5.4-nano-2026-03-17", + "gpt-5.3-chat-latest", "gpt-5.2", "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", @@ -20180,6 +20453,7 @@ export const RunStreamEvent = Schema.Union([ export type Tool = | FunctionTool | FileSearchTool + | ComputerTool | ComputerUsePreviewTool | WebSearchTool | MCPTool @@ -20188,11 +20462,14 @@ export type Tool = | LocalShellToolParam | FunctionShellToolParam | CustomToolParam + | NamespaceToolParam + | ToolSearchToolParam | WebSearchPreviewTool | ApplyPatchToolParam export const Tool = Schema.Union([ FunctionTool, FileSearchTool, + ComputerTool, ComputerUsePreviewTool, WebSearchTool, MCPTool, @@ -20201,6 +20478,8 @@ export const Tool = Schema.Union([ LocalShellToolParam, FunctionShellToolParam, CustomToolParam, + NamespaceToolParam, + ToolSearchToolParam, WebSearchPreviewTool, ApplyPatchToolParam ], { mode: "oneOf" }).annotate({ "description": "A tool that can be used to generate a response.\n" }) @@ -20227,6 +20506,7 @@ export type OutputMessage = { readonly "type": "message" readonly "role": "assistant" readonly "content": ReadonlyArray + readonly "phase"?: MessagePhase | null readonly "status": "in_progress" | "completed" | "incomplete" } export const OutputMessage = Schema.Struct({ @@ -20236,112 +20516,42 @@ export const OutputMessage = Schema.Struct({ "description": "The role of the output message. Always `assistant`.\n" }), "content": Schema.Array(OutputMessageContent).annotate({ "description": "The content of the output message.\n" }), + "phase": Schema.optionalKey(Schema.Union([MessagePhase, Schema.Null])), "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ "description": "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n" }) }).annotate({ "title": "Output message", "description": "An output message from the model.\n" }) -export type ConversationItem = - | Message - | FunctionToolCallResource - | FunctionToolCallOutputResource - | FileSearchToolCall - | WebSearchToolCall - | ImageGenToolCall - | ComputerToolCall - | ComputerToolCallOutputResource - | ReasoningItem - | CodeInterpreterToolCall - | LocalShellToolCall - | LocalShellToolCallOutput - | FunctionShellCall - | FunctionShellCallOutput - | ApplyPatchToolCall - | ApplyPatchToolCallOutput - | MCPListTools - | MCPApprovalRequest - | MCPApprovalResponseResource - | MCPToolCall - | CustomToolCall - | CustomToolCallOutput -export const ConversationItem = Schema.Union([ - Message, - FunctionToolCallResource, - FunctionToolCallOutputResource, - FileSearchToolCall, - WebSearchToolCall, - ImageGenToolCall, - ComputerToolCall, - ComputerToolCallOutputResource, - ReasoningItem, - CodeInterpreterToolCall, - LocalShellToolCall, - LocalShellToolCallOutput, - FunctionShellCall, - FunctionShellCallOutput, - ApplyPatchToolCall, - ApplyPatchToolCallOutput, - MCPListTools, - MCPApprovalRequest, - MCPApprovalResponseResource, - MCPToolCall, - CustomToolCall, - CustomToolCallOutput -], { mode: "oneOf" }).annotate({ - "title": "Conversation item", +export type ComputerToolCall = { + readonly "type": "computer_call" + readonly "id": string + readonly "call_id": string + readonly "action"?: ComputerAction + readonly "actions"?: ComputerActionList + readonly "pending_safety_checks": ReadonlyArray + readonly "status": "in_progress" | "completed" | "incomplete" +} +export const ComputerToolCall = Schema.Struct({ + "type": Schema.Literal("computer_call").annotate({ + "description": "The type of the computer call. Always `computer_call`." + }), + "id": Schema.String.annotate({ "description": "The unique ID of the computer call." }), + "call_id": Schema.String.annotate({ + "description": "An identifier used when responding to the tool call with output.\n" + }), + "action": Schema.optionalKey(ComputerAction), + "actions": Schema.optionalKey(ComputerActionList), + "pending_safety_checks": Schema.Array(ComputerCallSafetyCheckParam).annotate({ + "description": "The pending safety checks for the computer call.\n" + }), + "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ + "description": + "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n" + }) +}).annotate({ + "title": "Computer tool call", "description": - "A single item within a conversation. The set of possible types are the same as the `output` type of a [Response object](/docs/api-reference/responses/object#responses/object-output)." -}) -export type ItemField = - | Message - | FunctionToolCall - | FunctionToolCallOutput - | FileSearchToolCall - | WebSearchToolCall - | ImageGenToolCall - | ComputerToolCall - | ComputerToolCallOutputResource - | ReasoningItem - | CompactionBody - | CodeInterpreterToolCall - | LocalShellToolCall - | LocalShellToolCallOutput - | FunctionShellCall - | FunctionShellCallOutput - | ApplyPatchToolCall - | ApplyPatchToolCallOutput - | MCPListTools - | MCPApprovalRequest - | MCPApprovalResponseResource - | MCPToolCall - | CustomToolCall - | CustomToolCallOutput -export const ItemField = Schema.Union([ - Message, - FunctionToolCall, - FunctionToolCallOutput, - FileSearchToolCall, - WebSearchToolCall, - ImageGenToolCall, - ComputerToolCall, - ComputerToolCallOutputResource, - ReasoningItem, - CompactionBody, - CodeInterpreterToolCall, - LocalShellToolCall, - LocalShellToolCallOutput, - FunctionShellCall, - FunctionShellCallOutput, - ApplyPatchToolCall, - ApplyPatchToolCallOutput, - MCPListTools, - MCPApprovalRequest, - MCPApprovalResponseResource, - MCPToolCall, - CustomToolCall, - CustomToolCallOutput -], { mode: "oneOf" }).annotate({ - "description": "An item representing a message, tool call, tool output, reasoning, or other response element." + "A tool call to a computer use tool. See the\n[computer use guide](/docs/guides/tools-computer-use) for more information.\n" }) export type ThreadItemListResource = { readonly "object": "list" @@ -20406,20 +20616,89 @@ export const RunStepStreamEvent = Schema.Union([ Schema.Struct({ "event": Schema.Literal("thread.run.step.completed"), "data": RunStepObject }).annotate({ "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is completed." }), - Schema.Struct({ "event": Schema.Literal("thread.run.step.failed"), "data": RunStepObject }).annotate({ - "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) fails." + Schema.Struct({ "event": Schema.Literal("thread.run.step.failed"), "data": RunStepObject }).annotate({ + "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) fails." + }), + Schema.Struct({ "event": Schema.Literal("thread.run.step.cancelled"), "data": RunStepObject }).annotate({ + "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is cancelled." + }), + Schema.Struct({ "event": Schema.Literal("thread.run.step.expired"), "data": RunStepObject }).annotate({ + "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) expires." + }) +], { mode: "oneOf" }) +export type ToolsArray = ReadonlyArray +export const ToolsArray = Schema.Array(Tool).annotate({ + "description": + "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n" +}) +export type ToolSearchOutput = { + readonly "type": "tool_search_output" + readonly "id": string + readonly "call_id": string | null + readonly "execution": "server" | "client" + readonly "tools": ReadonlyArray + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "created_by"?: string +} +export const ToolSearchOutput = Schema.Struct({ + "type": Schema.Literal("tool_search_output").annotate({ + "description": "The type of the item. Always `tool_search_output`." + }), + "id": Schema.String.annotate({ "description": "The unique ID of the tool search output item." }), + "call_id": Schema.Union([ + Schema.String.annotate({ "description": "The unique ID of the tool search call generated by the model." }), + Schema.Null + ]), + "execution": Schema.Literals(["server", "client"]).annotate({ + "description": "Whether tool search was executed by the server or by the client." + }), + "tools": Schema.Array(Tool).annotate({ "description": "The loaded tool definitions returned by tool search." }), + "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ + "description": "The status of the tool search output item that was recorded." + }), + "created_by": Schema.optionalKey( + Schema.String.annotate({ "description": "The identifier of the actor that created the item." }) + ) +}) +export type ToolSearchOutputItemParam = { + readonly "id"?: string | null + readonly "call_id"?: string | null + readonly "type": "tool_search_output" + readonly "execution"?: "server" | "client" + readonly "tools": ReadonlyArray + readonly "status"?: "in_progress" | "completed" | "incomplete" | null +} +export const ToolSearchOutputItemParam = Schema.Struct({ + "id": Schema.optionalKey( + Schema.Union([Schema.String.annotate({ "description": "The unique ID of this tool search output." }), Schema.Null]) + ), + "call_id": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ "description": "The unique ID of the tool search call generated by the model." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(64)), + Schema.Null + ]) + ), + "type": Schema.Literal("tool_search_output").annotate({ + "description": "The item type. Always `tool_search_output`." }), - Schema.Struct({ "event": Schema.Literal("thread.run.step.cancelled"), "data": RunStepObject }).annotate({ - "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is cancelled." + "execution": Schema.optionalKey( + Schema.Literals(["server", "client"]).annotate({ + "description": "Whether tool search was executed by the server or by the client." + }) + ), + "tools": Schema.Array(Tool).annotate({ + "description": "The loaded tool definitions returned by the tool search output." }), - Schema.Struct({ "event": Schema.Literal("thread.run.step.expired"), "data": RunStepObject }).annotate({ - "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) expires." - }) -], { mode: "oneOf" }) -export type ToolsArray = ReadonlyArray -export const ToolsArray = Schema.Array(Tool).annotate({ - "description": - "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n" + "status": Schema.optionalKey( + Schema.Union([ + Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({ + "description": "The status of the tool search output." + }), + Schema.Null + ]) + ) }) export type CreateEvalCompletionsRunDataSource = { readonly "type": "completions" @@ -20815,67 +21094,61 @@ export const GraderScoreModel = Schema.Struct({ "title": "ScoreModelGrader", "description": "A ScoreModelGrader object that uses a model to assign a score to the input.\n" }) -export type InputItem = - | EasyInputMessage - | InputMessage - | OutputMessage +export type ConversationItem = + | Message + | FunctionToolCallResource + | FunctionToolCallOutputResource | FileSearchToolCall - | ComputerToolCall - | ComputerCallOutputItemParam | WebSearchToolCall - | FunctionToolCall - | FunctionCallOutputItemParam - | ReasoningItem - | CompactionSummaryItemParam | ImageGenToolCall + | ComputerToolCall + | ComputerToolCallOutputResource + | ToolSearchCall + | ToolSearchOutput + | ReasoningItem | CodeInterpreterToolCall | LocalShellToolCall | LocalShellToolCallOutput - | FunctionShellCallItemParam - | FunctionShellCallOutputItemParam - | ApplyPatchToolCallItemParam - | ApplyPatchToolCallOutputItemParam + | FunctionShellCall + | FunctionShellCallOutput + | ApplyPatchToolCall + | ApplyPatchToolCallOutput | MCPListTools | MCPApprovalRequest - | MCPApprovalResponse + | MCPApprovalResponseResource | MCPToolCall - | CustomToolCallOutput | CustomToolCall - | ItemReferenceParam -export const InputItem = Schema.Union([ - EasyInputMessage, - Schema.Union([ - InputMessage, - OutputMessage, - FileSearchToolCall, - ComputerToolCall, - ComputerCallOutputItemParam, - WebSearchToolCall, - FunctionToolCall, - FunctionCallOutputItemParam, - ReasoningItem, - CompactionSummaryItemParam, - ImageGenToolCall, - CodeInterpreterToolCall, - LocalShellToolCall, - LocalShellToolCallOutput, - FunctionShellCallItemParam, - FunctionShellCallOutputItemParam, - ApplyPatchToolCallItemParam, - ApplyPatchToolCallOutputItemParam, - MCPListTools, - MCPApprovalRequest, - MCPApprovalResponse, - MCPToolCall, - CustomToolCallOutput, - CustomToolCall - ], { mode: "oneOf" }).annotate({ - "description": - "An item representing part of the context for the response to be\ngenerated by the model. Can contain text, images, and audio inputs,\nas well as previous assistant responses and tool call outputs.\n", - "title": "Item" - }), - ItemReferenceParam -], { mode: "oneOf" }) + | CustomToolCallOutput +export const ConversationItem = Schema.Union([ + Message, + FunctionToolCallResource, + FunctionToolCallOutputResource, + FileSearchToolCall, + WebSearchToolCall, + ImageGenToolCall, + ComputerToolCall, + ComputerToolCallOutputResource, + ToolSearchCall, + ToolSearchOutput, + ReasoningItem, + CodeInterpreterToolCall, + LocalShellToolCall, + LocalShellToolCallOutput, + FunctionShellCall, + FunctionShellCallOutput, + ApplyPatchToolCall, + ApplyPatchToolCallOutput, + MCPListTools, + MCPApprovalRequest, + MCPApprovalResponseResource, + MCPToolCall, + CustomToolCall, + CustomToolCallOutput +], { mode: "oneOf" }).annotate({ + "title": "Conversation item", + "description": + "A single item within a conversation. The set of possible types are the same as the `output` type of a [Response object](/docs/api-reference/responses/object#responses/object-output)." +}) export type ItemResource = | InputMessageResource | OutputMessage @@ -20885,6 +21158,8 @@ export type ItemResource = | WebSearchToolCall | FunctionToolCallResource | FunctionToolCallOutputResource + | ToolSearchCall + | ToolSearchOutput | ImageGenToolCall | CodeInterpreterToolCall | LocalShellToolCall @@ -20906,6 +21181,8 @@ export const ItemResource = Schema.Union([ WebSearchToolCall, FunctionToolCallResource, FunctionToolCallOutputResource, + ToolSearchCall, + ToolSearchOutput, ImageGenToolCall, CodeInterpreterToolCall, LocalShellToolCall, @@ -20926,6 +21203,8 @@ export type OutputItem = | WebSearchToolCall | ComputerToolCall | ReasoningItem + | ToolSearchCall + | ToolSearchOutput | CompactionBody | ImageGenToolCall | CodeInterpreterToolCall @@ -20945,6 +21224,8 @@ export const OutputItem = Schema.Union([ WebSearchToolCall, ComputerToolCall, ReasoningItem, + ToolSearchCall, + ToolSearchOutput, CompactionBody, ImageGenToolCall, CodeInterpreterToolCall, @@ -20969,6 +21250,8 @@ export type ResponseOutputItemAddedEvent = { | WebSearchToolCall | ComputerToolCall | ReasoningItem + | ToolSearchCall + | ToolSearchOutput | CompactionBody | ImageGenToolCall | CodeInterpreterToolCall @@ -20999,6 +21282,8 @@ export const ResponseOutputItemAddedEvent = Schema.Struct({ WebSearchToolCall, ComputerToolCall, ReasoningItem, + ToolSearchCall, + ToolSearchOutput, CompactionBody, ImageGenToolCall, CodeInterpreterToolCall, @@ -21024,6 +21309,8 @@ export type ResponseOutputItemDoneEvent = { | WebSearchToolCall | ComputerToolCall | ReasoningItem + | ToolSearchCall + | ToolSearchOutput | CompactionBody | ImageGenToolCall | CodeInterpreterToolCall @@ -21053,6 +21340,8 @@ export const ResponseOutputItemDoneEvent = Schema.Struct({ WebSearchToolCall, ComputerToolCall, ReasoningItem, + ToolSearchCall, + ToolSearchOutput, CompactionBody, ImageGenToolCall, CodeInterpreterToolCall, @@ -21067,61 +21356,126 @@ export const ResponseOutputItemDoneEvent = Schema.Struct({ CustomToolCall ]).annotate({ "description": "The output item that was marked done.\n" }) }).annotate({ "description": "Emitted when an output item is marked done." }) -export type ConversationItemList = { - readonly "object": "list" - readonly "data": ReadonlyArray - readonly "has_more": boolean - readonly "first_id": string - readonly "last_id": string -} -export const ConversationItemList = Schema.Struct({ - "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }), - "data": Schema.Array(ConversationItem).annotate({ "description": "A list of conversation items." }), - "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }), - "first_id": Schema.String.annotate({ "description": "The ID of the first item in the list." }), - "last_id": Schema.String.annotate({ "description": "The ID of the last item in the list." }) -}).annotate({ "title": "The conversation item list", "description": "A list of Conversation items." }) -export type CompactResource = { - readonly "id": string - readonly "object": "response.compaction" - readonly "output": ReadonlyArray - readonly "created_at": number - readonly "usage": { - readonly "input_tokens": number - readonly "input_tokens_details": { readonly "cached_tokens": number } - readonly "output_tokens": number - readonly "output_tokens_details": { readonly "reasoning_tokens": number } - readonly "total_tokens": number - } -} -export const CompactResource = Schema.Struct({ - "id": Schema.String.annotate({ "description": "The unique identifier for the compacted response." }), - "object": Schema.Literal("response.compaction").annotate({ - "description": "The object type. Always `response.compaction`." +export type ItemField = + | Message + | FunctionToolCall + | ToolSearchCall + | ToolSearchOutput + | FunctionToolCallOutput + | FileSearchToolCall + | WebSearchToolCall + | ImageGenToolCall + | ComputerToolCall + | ComputerToolCallOutputResource + | ReasoningItem + | CompactionBody + | CodeInterpreterToolCall + | LocalShellToolCall + | LocalShellToolCallOutput + | FunctionShellCall + | FunctionShellCallOutput + | ApplyPatchToolCall + | ApplyPatchToolCallOutput + | MCPListTools + | MCPApprovalRequest + | MCPApprovalResponseResource + | MCPToolCall + | CustomToolCall + | CustomToolCallOutput +export const ItemField = Schema.Union([ + Message, + FunctionToolCall, + ToolSearchCall, + ToolSearchOutput, + FunctionToolCallOutput, + FileSearchToolCall, + WebSearchToolCall, + ImageGenToolCall, + ComputerToolCall, + ComputerToolCallOutputResource, + ReasoningItem, + CompactionBody, + CodeInterpreterToolCall, + LocalShellToolCall, + LocalShellToolCallOutput, + FunctionShellCall, + FunctionShellCallOutput, + ApplyPatchToolCall, + ApplyPatchToolCallOutput, + MCPListTools, + MCPApprovalRequest, + MCPApprovalResponseResource, + MCPToolCall, + CustomToolCall, + CustomToolCallOutput +], { mode: "oneOf" }).annotate({ + "description": "An item representing a message, tool call, tool output, reasoning, or other response element." +}) +export type InputItem = + | EasyInputMessage + | InputMessage + | OutputMessage + | FileSearchToolCall + | ComputerToolCall + | ComputerCallOutputItemParam + | WebSearchToolCall + | FunctionToolCall + | FunctionCallOutputItemParam + | ToolSearchCallItemParam + | ToolSearchOutputItemParam + | ReasoningItem + | CompactionSummaryItemParam + | ImageGenToolCall + | CodeInterpreterToolCall + | LocalShellToolCall + | LocalShellToolCallOutput + | FunctionShellCallItemParam + | FunctionShellCallOutputItemParam + | ApplyPatchToolCallItemParam + | ApplyPatchToolCallOutputItemParam + | MCPListTools + | MCPApprovalRequest + | MCPApprovalResponse + | MCPToolCall + | CustomToolCallOutput + | CustomToolCall + | ItemReferenceParam +export const InputItem = Schema.Union([ + EasyInputMessage, + Schema.Union([ + InputMessage, + OutputMessage, + FileSearchToolCall, + ComputerToolCall, + ComputerCallOutputItemParam, + WebSearchToolCall, + FunctionToolCall, + FunctionCallOutputItemParam, + ToolSearchCallItemParam, + ToolSearchOutputItemParam, + ReasoningItem, + CompactionSummaryItemParam, + ImageGenToolCall, + CodeInterpreterToolCall, + LocalShellToolCall, + LocalShellToolCallOutput, + FunctionShellCallItemParam, + FunctionShellCallOutputItemParam, + ApplyPatchToolCallItemParam, + ApplyPatchToolCallOutputItemParam, + MCPListTools, + MCPApprovalRequest, + MCPApprovalResponse, + MCPToolCall, + CustomToolCallOutput, + CustomToolCall + ], { mode: "oneOf" }).annotate({ + "description": + "An item representing part of the context for the response to be\ngenerated by the model. Can contain text, images, and audio inputs,\nas well as previous assistant responses and tool call outputs.\n", + "title": "Item" }), - "output": Schema.Array(ItemField).annotate({ "description": "The compacted list of output items." }), - "created_at": Schema.Number.annotate({ - "description": "Unix timestamp (in seconds) when the compacted conversation was created." - }).check(Schema.isInt()), - "usage": Schema.Struct({ - "input_tokens": Schema.Number.annotate({ "description": "The number of input tokens." }).check(Schema.isInt()), - "input_tokens_details": Schema.Struct({ - "cached_tokens": Schema.Number.annotate({ - "description": - "The number of tokens that were retrieved from the cache. \n[More on prompt caching](/docs/guides/prompt-caching).\n" - }).check(Schema.isInt()) - }).annotate({ "description": "A detailed breakdown of the input tokens." }), - "output_tokens": Schema.Number.annotate({ "description": "The number of output tokens." }).check(Schema.isInt()), - "output_tokens_details": Schema.Struct({ - "reasoning_tokens": Schema.Number.annotate({ "description": "The number of reasoning tokens." }).check( - Schema.isInt() - ) - }).annotate({ "description": "A detailed breakdown of the output tokens." }), - "total_tokens": Schema.Number.annotate({ "description": "The total number of tokens used." }).check(Schema.isInt()) - }).annotate({ - "description": "Token accounting for the compaction pass, including cached, reasoning, and total tokens." - }) -}).annotate({ "title": "The compacted response object" }) + ItemReferenceParam +], { mode: "oneOf" }) export type CreateEvalLabelModelGrader = { readonly "type": "label_model" readonly "name": string @@ -21317,219 +21671,20 @@ export const GraderMulti = Schema.Struct({ "title": "MultiGrader", "description": "A MultiGrader object combines the output of multiple graders to produce a single score." }) -export type InputParam = string | ReadonlyArray -export const InputParam = Schema.Union([ - Schema.String.annotate({ - "title": "Text input", - "description": "A text input to the model, equivalent to a text input with the\n`user` role.\n" - }), - Schema.Array(InputItem).annotate({ - "title": "Input item list", - "description": "A list of one or many input items to the model, containing\ndifferent content types.\n" - }) -], { mode: "oneOf" }).annotate({ - "description": - "Text, image, or file inputs to the model, used to generate a response.\n\nLearn more:\n- [Text inputs and outputs](/docs/guides/text)\n- [Image inputs](/docs/guides/images)\n- [File inputs](/docs/guides/pdf-files)\n- [Conversation state](/docs/guides/conversation-state)\n- [Function calling](/docs/guides/function-calling)\n" -}) -export type CreateConversationBody = { - readonly "metadata"?: {} | null | null - readonly "items"?: ReadonlyArray | null -} -export const CreateConversationBody = Schema.Struct({ - "metadata": Schema.optionalKey(Schema.Union([ - Schema.Union([ - Schema.Struct({}).annotate({ - "description": - "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n" - }), - Schema.Null - ]).annotate({ - "description": - "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters." - }), - Schema.Null - ])), - "items": Schema.optionalKey( - Schema.Union([ - Schema.Array(InputItem).annotate({ - "description": "Initial items to include in the conversation context. You may add up to 20 items at a time." - }).check(Schema.isMaxLength(20)), - Schema.Null - ]) - ) -}) -export type TokenCountsBody = { - readonly "model"?: string | null - readonly "input"?: string | ReadonlyArray | null - readonly "previous_response_id"?: string | null - readonly "tools"?: ReadonlyArray | null - readonly "text"?: ResponseTextParam | null - readonly "reasoning"?: { - readonly "effort"?: ReasoningEffort - readonly "summary"?: "auto" | "concise" | "detailed" | null - readonly "generate_summary"?: "auto" | "concise" | "detailed" | null - } | null - readonly "truncation"?: "auto" | "disabled" - readonly "instructions"?: string | null - readonly "conversation"?: ConversationParam | null - readonly "tool_choice"?: - | ToolChoiceOptions - | ToolChoiceAllowed - | ToolChoiceTypes - | ToolChoiceFunction - | ToolChoiceMCP - | ToolChoiceCustom - | SpecificApplyPatchParam - | SpecificFunctionShellParam - | null - readonly "parallel_tool_calls"?: boolean | null -} -export const TokenCountsBody = Schema.Struct({ - "model": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": - "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](/docs/models) to browse and compare available models." - }), - Schema.Null - ]) - ), - "input": Schema.optionalKey( - Schema.Union([ - Schema.Union([ - Schema.String.annotate({ - "description": "A text input to the model, equivalent to a text input with the `user` role." - }).check(Schema.isMaxLength(10485760)), - Schema.Array(InputItem).annotate({ - "description": "A list of one or many input items to the model, containing different content types." - }) - ], { mode: "oneOf" }).annotate({ - "description": "Text, image, or file inputs to the model, used to generate a response" - }), - Schema.Null - ]) - ), - "previous_response_id": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": - "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`." - }), - Schema.Null - ]) - ), - "tools": Schema.optionalKey( - Schema.Union([ - Schema.Array(Tool).annotate({ - "description": - "An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter." - }), - Schema.Null - ]) - ), - "text": Schema.optionalKey(Schema.Union([ResponseTextParam, Schema.Null])), - "reasoning": Schema.optionalKey(Schema.Union([ - Schema.Struct({ - "effort": Schema.optionalKey(ReasoningEffort), - "summary": Schema.optionalKey(Schema.Union([ - Schema.Literals(["auto", "concise", "detailed"]).annotate({ - "description": - "A summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n\n`concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.\n" - }), - Schema.Null - ])), - "generate_summary": Schema.optionalKey( - Schema.Union([ - Schema.Literals(["auto", "concise", "detailed"]).annotate({ - "description": - "**Deprecated:** use `summary` instead.\n\nA summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n" - }), - Schema.Null - ]) - ) - }).annotate({ - "title": "Reasoning", - "description": - "**gpt-5 and o-series models only** Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning)." - }), - Schema.Null - ])), - "truncation": Schema.optionalKey( - Schema.Literals(["auto", "disabled"]).annotate({ - "description": - "The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error." - }) - ), - "instructions": Schema.optionalKey(Schema.Union([ - Schema.String.annotate({ - "description": - "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses." - }), - Schema.Null - ])), - "conversation": Schema.optionalKey(Schema.Union([ConversationParam, Schema.Null])), - "tool_choice": Schema.optionalKey( - Schema.Union([ - Schema.Union([ - ToolChoiceOptions, - ToolChoiceAllowed, - ToolChoiceTypes, - ToolChoiceFunction, - ToolChoiceMCP, - ToolChoiceCustom, - SpecificApplyPatchParam, - SpecificFunctionShellParam - ], { mode: "oneOf" }).annotate({ "description": "Controls which tool the model should use, if any." }), - Schema.Null - ]) - ), - "parallel_tool_calls": Schema.optionalKey( - Schema.Union([ - Schema.Boolean.annotate({ "description": "Whether to allow the model to run tool calls in parallel." }), - Schema.Null - ]) - ) -}) -export type CompactResponseMethodPublicBody = { - readonly "model": ModelIdsCompaction - readonly "input"?: string | ReadonlyArray | null - readonly "previous_response_id"?: string | null - readonly "instructions"?: string | null -} -export const CompactResponseMethodPublicBody = Schema.Struct({ - "model": ModelIdsCompaction, - "input": Schema.optionalKey( - Schema.Union([ - Schema.Union([ - Schema.String.annotate({ - "description": "A text input to the model, equivalent to a text input with the `user` role." - }).check(Schema.isMaxLength(10485760)), - Schema.Array(InputItem).annotate({ - "description": "A list of one or many input items to the model, containing different content types." - }) - ], { mode: "oneOf" }).annotate({ - "description": "Text, image, or file inputs to the model, used to generate a response" - }), - Schema.Null - ]) - ), - "previous_response_id": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": - "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`." - }), - Schema.Null - ]) - ), - "instructions": Schema.optionalKey(Schema.Union([ - Schema.String.annotate({ - "description": - "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses." - }), - Schema.Null - ])) -}) +export type ConversationItemList = { + readonly "object": "list" + readonly "data": ReadonlyArray + readonly "has_more": boolean + readonly "first_id": string + readonly "last_id": string +} +export const ConversationItemList = Schema.Struct({ + "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }), + "data": Schema.Array(ConversationItem).annotate({ "description": "A list of conversation items." }), + "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }), + "first_id": Schema.String.annotate({ "description": "The ID of the first item in the list." }), + "last_id": Schema.String.annotate({ "description": "The ID of the last item in the list." }) +}).annotate({ "title": "The conversation item list", "description": "A list of Conversation items." }) export type ResponseItemList = { readonly "object": "list" readonly "data": ReadonlyArray @@ -21544,6 +21699,61 @@ export const ResponseItemList = Schema.Struct({ "first_id": Schema.String.annotate({ "description": "The ID of the first item in the list." }), "last_id": Schema.String.annotate({ "description": "The ID of the last item in the list." }) }).annotate({ "description": "A list of Response items." }) +export type CompactResource = { + readonly "id": string + readonly "object": "response.compaction" + readonly "output": ReadonlyArray + readonly "created_at": number + readonly "usage": { + readonly "input_tokens": number + readonly "input_tokens_details": { readonly "cached_tokens": number } + readonly "output_tokens": number + readonly "output_tokens_details": { readonly "reasoning_tokens": number } + readonly "total_tokens": number + } +} +export const CompactResource = Schema.Struct({ + "id": Schema.String.annotate({ "description": "The unique identifier for the compacted response." }), + "object": Schema.Literal("response.compaction").annotate({ + "description": "The object type. Always `response.compaction`." + }), + "output": Schema.Array(ItemField).annotate({ "description": "The compacted list of output items." }), + "created_at": Schema.Number.annotate({ + "description": "Unix timestamp (in seconds) when the compacted conversation was created." + }).check(Schema.isInt()), + "usage": Schema.Struct({ + "input_tokens": Schema.Number.annotate({ "description": "The number of input tokens." }).check(Schema.isInt()), + "input_tokens_details": Schema.Struct({ + "cached_tokens": Schema.Number.annotate({ + "description": + "The number of tokens that were retrieved from the cache. \n[More on prompt caching](/docs/guides/prompt-caching).\n" + }).check(Schema.isInt()) + }).annotate({ "description": "A detailed breakdown of the input tokens." }), + "output_tokens": Schema.Number.annotate({ "description": "The number of output tokens." }).check(Schema.isInt()), + "output_tokens_details": Schema.Struct({ + "reasoning_tokens": Schema.Number.annotate({ "description": "The number of reasoning tokens." }).check( + Schema.isInt() + ) + }).annotate({ "description": "A detailed breakdown of the output tokens." }), + "total_tokens": Schema.Number.annotate({ "description": "The total number of tokens used." }).check(Schema.isInt()) + }).annotate({ + "description": "Token accounting for the compaction pass, including cached, reasoning, and total tokens." + }) +}).annotate({ "title": "The compacted response object" }) +export type InputParam = string | ReadonlyArray +export const InputParam = Schema.Union([ + Schema.String.annotate({ + "title": "Text input", + "description": "A text input to the model, equivalent to a text input with the\n`user` role.\n" + }), + Schema.Array(InputItem).annotate({ + "title": "Input item list", + "description": "A list of one or many input items to the model, containing\ndifferent content types.\n" + }) +], { mode: "oneOf" }).annotate({ + "description": + "Text, image, or file inputs to the model, used to generate a response.\n\nLearn more:\n- [Text inputs and outputs](/docs/guides/text)\n- [Image inputs](/docs/guides/images)\n- [File inputs](/docs/guides/pdf-files)\n- [Conversation state](/docs/guides/conversation-state)\n- [Function calling](/docs/guides/function-calling)\n" +}) export type Response = { readonly "metadata": {} | null readonly "top_logprobs"?: number | null @@ -21741,79 +21951,360 @@ export const Response = Schema.Struct({ "truncation": Schema.optionalKey(Schema.Union([ Schema.Literals(["auto", "disabled"]).annotate({ "description": - "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n" + "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n" + }), + Schema.Null + ])), + "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }), + "object": Schema.Literal("response").annotate({ + "description": "The object type of this resource - always set to `response`.\n" + }), + "status": Schema.optionalKey( + Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({ + "description": + "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n" + }) + ), + "created_at": Schema.Number.annotate({ + "description": "Unix timestamp (in seconds) of when this Response was created.\n" + }).check(Schema.isFinite()), + "completed_at": Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + "description": + "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n" + }).check(Schema.isFinite()), + Schema.Null + ]) + ), + "error": ResponseError, + "incomplete_details": Schema.Union([ + Schema.Struct({ + "reason": Schema.optionalKey( + Schema.Literals(["max_output_tokens", "content_filter"]).annotate({ + "description": "The reason why the response is incomplete." + }) + ) + }).annotate({ "description": "Details about why the response is incomplete.\n" }), + Schema.Null + ]), + "output": Schema.Array(OutputItem).annotate({ + "description": + "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n" + }), + "instructions": Schema.Union([ + Schema.Union([ + Schema.String.annotate({ + "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n" + }), + Schema.Array(InputItem).annotate({ + "title": "Input item list", + "description": "A list of one or many input items to the model, containing\ndifferent content types.\n" + }) + ], { mode: "oneOf" }).annotate({ + "description": + "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n" + }), + Schema.Null + ]), + "output_text": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": + "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n" + }), + Schema.Null + ]) + ), + "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])), + "parallel_tool_calls": Schema.Boolean.annotate({ + "description": "Whether to allow the model to run tool calls in parallel.\n" + }), + "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) +}).annotate({ "title": "The response object" }) +export type ResponseCompletedEvent = { + readonly "type": "response.completed" + readonly "response": { + readonly "metadata": {} | null + readonly "top_logprobs"?: number | null + readonly "temperature": number | null + readonly "top_p": number | null + readonly "user"?: string | null + readonly "safety_identifier"?: string | null + readonly "prompt_cache_key"?: string | null + readonly "service_tier"?: ServiceTier + readonly "prompt_cache_retention"?: "in-memory" | "24h" | null + readonly "previous_response_id"?: string | null + readonly "model": + | ModelIdsShared + | "o1-pro" + | "o1-pro-2025-03-19" + | "o3-pro" + | "o3-pro-2025-06-10" + | "o3-deep-research" + | "o3-deep-research-2025-06-26" + | "o4-mini-deep-research" + | "o4-mini-deep-research-2025-06-26" + | "computer-use-preview" + | "computer-use-preview-2025-03-11" + | "gpt-5-codex" + | "gpt-5-pro" + | "gpt-5-pro-2025-10-06" + | "gpt-5.1-codex-max" + readonly "reasoning"?: Reasoning | null + readonly "background"?: boolean | null + readonly "max_output_tokens"?: number | null + readonly "max_tool_calls"?: number | null + readonly "text"?: ResponseTextParam + readonly "tools": ReadonlyArray + readonly "tool_choice": + | ToolChoiceOptions + | ToolChoiceAllowed + | ToolChoiceTypes + | ToolChoiceFunction + | ToolChoiceMCP + | ToolChoiceCustom + | SpecificApplyPatchParam + | SpecificFunctionShellParam + readonly "prompt"?: Prompt + readonly "truncation"?: "auto" | "disabled" | null + readonly "id": string + readonly "object": "response" + readonly "status"?: "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete" + readonly "created_at": number + readonly "completed_at"?: number | null + readonly "error": ResponseError + readonly "incomplete_details": { readonly "reason"?: "max_output_tokens" | "content_filter" } | null + readonly "output": ReadonlyArray + readonly "instructions": string | ReadonlyArray | null + readonly "output_text"?: string | null + readonly "usage"?: ResponseUsage | null + readonly "parallel_tool_calls": boolean + readonly "conversation"?: Conversation_2 | null + } + readonly "sequence_number": number +} +export const ResponseCompletedEvent = Schema.Struct({ + "type": Schema.Literal("response.completed").annotate({ + "description": "The type of the event. Always `response.completed`.\n" + }), + "response": Schema.Struct({ + "metadata": Schema.Union([ + Schema.Struct({}).annotate({ + "description": + "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n" + }), + Schema.Null + ]), + "top_logprobs": Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + "description": + "An integer between 0 and 20 specifying the number of most likely tokens to\nreturn at each token position, each with an associated log probability.\n" + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)), + Schema.Null + ]) + ), + "temperature": Schema.Union([ + Schema.Number.annotate({ + "description": + "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n" + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)), + Schema.Null + ]), + "top_p": Schema.Union([ + Schema.Number.annotate({ + "description": + "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)), + Schema.Null + ]), + "user": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": + "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n" + }) + ), + "safety_identifier": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": + "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n" + }) + ), + "prompt_cache_key": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": + "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n" + }) + ), + "service_tier": Schema.optionalKey(ServiceTier), + "prompt_cache_retention": Schema.optionalKey( + Schema.Union([ + Schema.Literals(["in-memory", "24h"]).annotate({ + "description": + "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n" + }), + Schema.Null + ]) + ), + "previous_response_id": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": + "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n" + }), + Schema.Null + ]) + ), + "model": Schema.Union([ + ModelIdsShared, + Schema.Literals([ + "o1-pro", + "o1-pro-2025-03-19", + "o3-pro", + "o3-pro-2025-06-10", + "o3-deep-research", + "o3-deep-research-2025-06-26", + "o4-mini-deep-research", + "o4-mini-deep-research-2025-06-26", + "computer-use-preview", + "computer-use-preview-2025-03-11", + "gpt-5-codex", + "gpt-5-pro", + "gpt-5-pro-2025-10-06", + "gpt-5.1-codex-max" + ]).annotate({ "title": "ResponsesOnlyModel" }) + ]).annotate({ + "description": + "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n" }), - Schema.Null - ])), - "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }), - "object": Schema.Literal("response").annotate({ - "description": "The object type of this resource - always set to `response`.\n" - }), - "status": Schema.optionalKey( - Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({ + "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])), + "background": Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ + "description": + "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n" + }), + Schema.Null + ]) + ), + "max_output_tokens": Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + "description": + "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n" + }).check(Schema.isInt()), + Schema.Null + ]) + ), + "max_tool_calls": Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + "description": + "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n" + }).check(Schema.isInt()), + Schema.Null + ]) + ), + "text": Schema.optionalKey(ResponseTextParam), + "tools": Schema.Array(Tool).annotate({ "description": - "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n" - }) - ), - "created_at": Schema.Number.annotate({ - "description": "Unix timestamp (in seconds) of when this Response was created.\n" - }).check(Schema.isFinite()), - "completed_at": Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ + "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n" + }), + "tool_choice": Schema.Union([ + ToolChoiceOptions, + ToolChoiceAllowed, + ToolChoiceTypes, + ToolChoiceFunction, + ToolChoiceMCP, + ToolChoiceCustom, + SpecificApplyPatchParam, + SpecificFunctionShellParam + ], { mode: "oneOf" }).annotate({ + "description": + "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n" + }), + "prompt": Schema.optionalKey(Prompt), + "truncation": Schema.optionalKey(Schema.Union([ + Schema.Literals(["auto", "disabled"]).annotate({ "description": - "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n" - }).check(Schema.isFinite()), - Schema.Null - ]) - ), - "error": ResponseError, - "incomplete_details": Schema.Union([ - Schema.Struct({ - "reason": Schema.optionalKey( - Schema.Literals(["max_output_tokens", "content_filter"]).annotate({ - "description": "The reason why the response is incomplete." - }) - ) - }).annotate({ "description": "Details about why the response is incomplete.\n" }), - Schema.Null - ]), - "output": Schema.Array(OutputItem).annotate({ - "description": - "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n" - }), - "instructions": Schema.Union([ - Schema.Union([ - Schema.String.annotate({ - "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n" + "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n" }), - Schema.Array(InputItem).annotate({ - "title": "Input item list", - "description": "A list of one or many input items to the model, containing\ndifferent content types.\n" + Schema.Null + ])), + "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }), + "object": Schema.Literal("response").annotate({ + "description": "The object type of this resource - always set to `response`.\n" + }), + "status": Schema.optionalKey( + Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({ + "description": + "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n" }) - ], { mode: "oneOf" }).annotate({ + ), + "created_at": Schema.Number.annotate({ + "description": "Unix timestamp (in seconds) of when this Response was created.\n" + }).check(Schema.isFinite()), + "completed_at": Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + "description": + "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n" + }).check(Schema.isFinite()), + Schema.Null + ]) + ), + "error": ResponseError, + "incomplete_details": Schema.Union([ + Schema.Struct({ + "reason": Schema.optionalKey( + Schema.Literals(["max_output_tokens", "content_filter"]).annotate({ + "description": "The reason why the response is incomplete." + }) + ) + }).annotate({ "description": "Details about why the response is incomplete.\n" }), + Schema.Null + ]), + "output": Schema.Array(OutputItem).annotate({ "description": - "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n" + "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n" }), - Schema.Null - ]), - "output_text": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ + "instructions": Schema.Union([ + Schema.Union([ + Schema.String.annotate({ + "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n" + }), + Schema.Array(InputItem).annotate({ + "title": "Input item list", + "description": "A list of one or many input items to the model, containing\ndifferent content types.\n" + }) + ], { mode: "oneOf" }).annotate({ "description": - "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n" + "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n" }), Schema.Null - ]) - ), - "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])), - "parallel_tool_calls": Schema.Boolean.annotate({ - "description": "Whether to allow the model to run tool calls in parallel.\n" - }), - "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) -}).annotate({ "title": "The response object" }) -export type ResponseCompletedEvent = { - readonly "type": "response.completed" + ]), + "output_text": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": + "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n" + }), + Schema.Null + ]) + ), + "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])), + "parallel_tool_calls": Schema.Boolean.annotate({ + "description": "Whether to allow the model to run tool calls in parallel.\n" + }), + "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) + }).annotate({ "title": "The response object", "description": "Properties of the completed response.\n" }), + "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check( + Schema.isInt() + ) +}).annotate({ "description": "Emitted when the model response is complete." }) +export type ResponseCreatedEvent = { + readonly "type": "response.created" readonly "response": { readonly "metadata": {} | null readonly "top_logprobs"?: number | null @@ -21874,9 +22365,9 @@ export type ResponseCompletedEvent = { } readonly "sequence_number": number } -export const ResponseCompletedEvent = Schema.Struct({ - "type": Schema.Literal("response.completed").annotate({ - "description": "The type of the event. Always `response.completed`.\n" +export const ResponseCreatedEvent = Schema.Struct({ + "type": Schema.Literal("response.created").annotate({ + "description": "The type of the event. Always `response.created`.\n" }), "response": Schema.Struct({ "metadata": Schema.Union([ @@ -22088,13 +22579,14 @@ export const ResponseCompletedEvent = Schema.Struct({ "description": "Whether to allow the model to run tool calls in parallel.\n" }), "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) - }).annotate({ "title": "The response object", "description": "Properties of the completed response.\n" }), + }).annotate({ "title": "The response object", "description": "The response that was created.\n" }), "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check( Schema.isInt() ) -}).annotate({ "description": "Emitted when the model response is complete." }) -export type ResponseCreatedEvent = { - readonly "type": "response.created" +}).annotate({ "description": "An event that is emitted when a response is created.\n" }) +export type ResponseFailedEvent = { + readonly "type": "response.failed" + readonly "sequence_number": number readonly "response": { readonly "metadata": {} | null readonly "top_logprobs"?: number | null @@ -22153,12 +22645,14 @@ export type ResponseCreatedEvent = { readonly "parallel_tool_calls": boolean readonly "conversation"?: Conversation_2 | null } - readonly "sequence_number": number } -export const ResponseCreatedEvent = Schema.Struct({ - "type": Schema.Literal("response.created").annotate({ - "description": "The type of the event. Always `response.created`.\n" +export const ResponseFailedEvent = Schema.Struct({ + "type": Schema.Literal("response.failed").annotate({ + "description": "The type of the event. Always `response.failed`.\n" }), + "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check( + Schema.isInt() + ), "response": Schema.Struct({ "metadata": Schema.Union([ Schema.Struct({}).annotate({ @@ -22362,21 +22856,17 @@ export const ResponseCreatedEvent = Schema.Struct({ "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n" }), Schema.Null - ]) - ), - "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])), - "parallel_tool_calls": Schema.Boolean.annotate({ - "description": "Whether to allow the model to run tool calls in parallel.\n" - }), - "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) - }).annotate({ "title": "The response object", "description": "The response that was created.\n" }), - "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check( - Schema.isInt() - ) -}).annotate({ "description": "An event that is emitted when a response is created.\n" }) -export type ResponseFailedEvent = { - readonly "type": "response.failed" - readonly "sequence_number": number + ]) + ), + "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])), + "parallel_tool_calls": Schema.Boolean.annotate({ + "description": "Whether to allow the model to run tool calls in parallel.\n" + }), + "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) + }).annotate({ "title": "The response object", "description": "The response that failed.\n" }) +}).annotate({ "description": "An event that is emitted when a response fails.\n" }) +export type ResponseInProgressEvent = { + readonly "type": "response.in_progress" readonly "response": { readonly "metadata": {} | null readonly "top_logprobs"?: number | null @@ -22435,14 +22925,12 @@ export type ResponseFailedEvent = { readonly "parallel_tool_calls": boolean readonly "conversation"?: Conversation_2 | null } + readonly "sequence_number": number } -export const ResponseFailedEvent = Schema.Struct({ - "type": Schema.Literal("response.failed").annotate({ - "description": "The type of the event. Always `response.failed`.\n" +export const ResponseInProgressEvent = Schema.Struct({ + "type": Schema.Literal("response.in_progress").annotate({ + "description": "The type of the event. Always `response.in_progress`.\n" }), - "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check( - Schema.isInt() - ), "response": Schema.Struct({ "metadata": Schema.Union([ Schema.Struct({}).annotate({ @@ -22653,10 +23141,13 @@ export const ResponseFailedEvent = Schema.Struct({ "description": "Whether to allow the model to run tool calls in parallel.\n" }), "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) - }).annotate({ "title": "The response object", "description": "The response that failed.\n" }) -}).annotate({ "description": "An event that is emitted when a response fails.\n" }) -export type ResponseInProgressEvent = { - readonly "type": "response.in_progress" + }).annotate({ "title": "The response object", "description": "The response that is in progress.\n" }), + "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check( + Schema.isInt() + ) +}).annotate({ "description": "Emitted when the response is in progress." }) +export type ResponseIncompleteEvent = { + readonly "type": "response.incomplete" readonly "response": { readonly "metadata": {} | null readonly "top_logprobs"?: number | null @@ -22717,9 +23208,9 @@ export type ResponseInProgressEvent = { } readonly "sequence_number": number } -export const ResponseInProgressEvent = Schema.Struct({ - "type": Schema.Literal("response.in_progress").annotate({ - "description": "The type of the event. Always `response.in_progress`.\n" +export const ResponseIncompleteEvent = Schema.Struct({ + "type": Schema.Literal("response.incomplete").annotate({ + "description": "The type of the event. Always `response.incomplete`.\n" }), "response": Schema.Struct({ "metadata": Schema.Union([ @@ -22931,13 +23422,13 @@ export const ResponseInProgressEvent = Schema.Struct({ "description": "Whether to allow the model to run tool calls in parallel.\n" }), "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) - }).annotate({ "title": "The response object", "description": "The response that is in progress.\n" }), + }).annotate({ "title": "The response object", "description": "The response that was incomplete.\n" }), "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check( Schema.isInt() ) -}).annotate({ "description": "Emitted when the response is in progress." }) -export type ResponseIncompleteEvent = { - readonly "type": "response.incomplete" +}).annotate({ "description": "An event that is emitted when a response finishes as incomplete.\n" }) +export type ResponseQueuedEvent = { + readonly "type": "response.queued" readonly "response": { readonly "metadata": {} | null readonly "top_logprobs"?: number | null @@ -22998,9 +23489,9 @@ export type ResponseIncompleteEvent = { } readonly "sequence_number": number } -export const ResponseIncompleteEvent = Schema.Struct({ - "type": Schema.Literal("response.incomplete").annotate({ - "description": "The type of the event. Always `response.incomplete`.\n" +export const ResponseQueuedEvent = Schema.Struct({ + "type": Schema.Literal("response.queued").annotate({ + "description": "The type of the event. Always 'response.queued'." }), "response": Schema.Struct({ "metadata": Schema.Union([ @@ -23189,169 +23680,480 @@ export const ResponseIncompleteEvent = Schema.Struct({ "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n" }), Schema.Array(InputItem).annotate({ - "title": "Input item list", - "description": "A list of one or many input items to the model, containing\ndifferent content types.\n" + "title": "Input item list", + "description": "A list of one or many input items to the model, containing\ndifferent content types.\n" + }) + ], { mode: "oneOf" }).annotate({ + "description": + "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n" + }), + Schema.Null + ]), + "output_text": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": + "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n" + }), + Schema.Null + ]) + ), + "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])), + "parallel_tool_calls": Schema.Boolean.annotate({ + "description": "Whether to allow the model to run tool calls in parallel.\n" + }), + "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) + }).annotate({ "title": "The response object", "description": "The full response object that is queued." }), + "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check( + Schema.isInt() + ) +}).annotate({ + "title": "ResponseQueuedEvent", + "description": "Emitted when a response is queued and waiting to be processed.\n" +}) +export type CreateConversationBody = { + readonly "metadata"?: {} | null | null + readonly "items"?: ReadonlyArray | null +} +export const CreateConversationBody = Schema.Struct({ + "metadata": Schema.optionalKey(Schema.Union([ + Schema.Union([ + Schema.Struct({}).annotate({ + "description": + "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n" + }), + Schema.Null + ]).annotate({ + "description": + "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters." + }), + Schema.Null + ])), + "items": Schema.optionalKey( + Schema.Union([ + Schema.Array(InputItem).annotate({ + "description": "Initial items to include in the conversation context. You may add up to 20 items at a time." + }).check(Schema.isMaxLength(20)), + Schema.Null + ]) + ) +}) +export type TokenCountsBody = { + readonly "model"?: string | null + readonly "input"?: string | ReadonlyArray | null + readonly "previous_response_id"?: string | null + readonly "tools"?: ReadonlyArray | null + readonly "text"?: ResponseTextParam | null + readonly "reasoning"?: { + readonly "effort"?: ReasoningEffort + readonly "summary"?: "auto" | "concise" | "detailed" | null + readonly "generate_summary"?: "auto" | "concise" | "detailed" | null + } | null + readonly "truncation"?: "auto" | "disabled" + readonly "instructions"?: string | null + readonly "conversation"?: ConversationParam | null + readonly "tool_choice"?: + | ToolChoiceOptions + | ToolChoiceAllowed + | ToolChoiceTypes + | ToolChoiceFunction + | ToolChoiceMCP + | ToolChoiceCustom + | SpecificApplyPatchParam + | SpecificFunctionShellParam + | null + readonly "parallel_tool_calls"?: boolean | null +} +export const TokenCountsBody = Schema.Struct({ + "model": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": + "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](/docs/models) to browse and compare available models." + }), + Schema.Null + ]) + ), + "input": Schema.optionalKey( + Schema.Union([ + Schema.Union([ + Schema.String.annotate({ + "description": "A text input to the model, equivalent to a text input with the `user` role." + }).check(Schema.isMaxLength(10485760)), + Schema.Array(InputItem).annotate({ + "description": "A list of one or many input items to the model, containing different content types." + }) + ], { mode: "oneOf" }).annotate({ + "description": "Text, image, or file inputs to the model, used to generate a response" + }), + Schema.Null + ]) + ), + "previous_response_id": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ + "description": + "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`." + }), + Schema.Null + ]) + ), + "tools": Schema.optionalKey( + Schema.Union([ + Schema.Array(Tool).annotate({ + "description": + "An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter." + }), + Schema.Null + ]) + ), + "text": Schema.optionalKey(Schema.Union([ResponseTextParam, Schema.Null])), + "reasoning": Schema.optionalKey(Schema.Union([ + Schema.Struct({ + "effort": Schema.optionalKey(ReasoningEffort), + "summary": Schema.optionalKey(Schema.Union([ + Schema.Literals(["auto", "concise", "detailed"]).annotate({ + "description": + "A summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n\n`concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.\n" + }), + Schema.Null + ])), + "generate_summary": Schema.optionalKey( + Schema.Union([ + Schema.Literals(["auto", "concise", "detailed"]).annotate({ + "description": + "**Deprecated:** use `summary` instead.\n\nA summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n" + }), + Schema.Null + ]) + ) + }).annotate({ + "title": "Reasoning", + "description": + "**gpt-5 and o-series models only** Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning)." + }), + Schema.Null + ])), + "truncation": Schema.optionalKey( + Schema.Literals(["auto", "disabled"]).annotate({ + "description": + "The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error." + }) + ), + "instructions": Schema.optionalKey(Schema.Union([ + Schema.String.annotate({ + "description": + "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses." + }), + Schema.Null + ])), + "conversation": Schema.optionalKey(Schema.Union([ConversationParam, Schema.Null])), + "tool_choice": Schema.optionalKey( + Schema.Union([ + Schema.Union([ + ToolChoiceOptions, + ToolChoiceAllowed, + ToolChoiceTypes, + ToolChoiceFunction, + ToolChoiceMCP, + ToolChoiceCustom, + SpecificApplyPatchParam, + SpecificFunctionShellParam + ], { mode: "oneOf" }).annotate({ "description": "Controls which tool the model should use, if any." }), + Schema.Null + ]) + ), + "parallel_tool_calls": Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ "description": "Whether to allow the model to run tool calls in parallel." }), + Schema.Null + ]) + ) +}) +export type CompactResponseMethodPublicBody = { + readonly "model": ModelIdsCompaction + readonly "input"?: string | ReadonlyArray | null + readonly "previous_response_id"?: string | null + readonly "instructions"?: string | null + readonly "prompt_cache_key"?: string | null +} +export const CompactResponseMethodPublicBody = Schema.Struct({ + "model": ModelIdsCompaction, + "input": Schema.optionalKey( + Schema.Union([ + Schema.Union([ + Schema.String.annotate({ + "description": "A text input to the model, equivalent to a text input with the `user` role." + }).check(Schema.isMaxLength(10485760)), + Schema.Array(InputItem).annotate({ + "description": "A list of one or many input items to the model, containing different content types." }) ], { mode: "oneOf" }).annotate({ + "description": "Text, image, or file inputs to the model, used to generate a response" + }), + Schema.Null + ]) + ), + "previous_response_id": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ "description": - "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n" + "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`." }), Schema.Null - ]), - "output_text": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": - "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n" - }), - Schema.Null - ]) - ), - "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])), - "parallel_tool_calls": Schema.Boolean.annotate({ - "description": "Whether to allow the model to run tool calls in parallel.\n" + ]) + ), + "instructions": Schema.optionalKey(Schema.Union([ + Schema.String.annotate({ + "description": + "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses." }), - "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) - }).annotate({ "title": "The response object", "description": "The response that was incomplete.\n" }), - "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check( - Schema.isInt() + Schema.Null + ])), + "prompt_cache_key": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ "description": "A key to use when reading from or writing to the prompt cache." }).check( + Schema.isMaxLength(64) + ), + Schema.Null + ]) ) -}).annotate({ "description": "An event that is emitted when a response finishes as incomplete.\n" }) -export type ResponseQueuedEvent = { - readonly "type": "response.queued" - readonly "response": { - readonly "metadata": {} | null - readonly "top_logprobs"?: number | null - readonly "temperature": number | null - readonly "top_p": number | null - readonly "user"?: string | null - readonly "safety_identifier"?: string | null - readonly "prompt_cache_key"?: string | null - readonly "service_tier"?: ServiceTier - readonly "prompt_cache_retention"?: "in-memory" | "24h" | null - readonly "previous_response_id"?: string | null - readonly "model": - | ModelIdsShared - | "o1-pro" - | "o1-pro-2025-03-19" - | "o3-pro" - | "o3-pro-2025-06-10" - | "o3-deep-research" - | "o3-deep-research-2025-06-26" - | "o4-mini-deep-research" - | "o4-mini-deep-research-2025-06-26" - | "computer-use-preview" - | "computer-use-preview-2025-03-11" - | "gpt-5-codex" - | "gpt-5-pro" - | "gpt-5-pro-2025-10-06" - | "gpt-5.1-codex-max" - readonly "reasoning"?: Reasoning | null - readonly "background"?: boolean | null - readonly "max_output_tokens"?: number | null - readonly "max_tool_calls"?: number | null - readonly "text"?: ResponseTextParam - readonly "tools": ReadonlyArray - readonly "tool_choice": - | ToolChoiceOptions - | ToolChoiceAllowed - | ToolChoiceTypes - | ToolChoiceFunction - | ToolChoiceMCP - | ToolChoiceCustom - | SpecificApplyPatchParam - | SpecificFunctionShellParam - readonly "prompt"?: Prompt - readonly "truncation"?: "auto" | "disabled" | null - readonly "id": string - readonly "object": "response" - readonly "status"?: "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete" - readonly "created_at": number - readonly "completed_at"?: number | null - readonly "error": ResponseError - readonly "incomplete_details": { readonly "reason"?: "max_output_tokens" | "content_filter" } | null - readonly "output": ReadonlyArray - readonly "instructions": string | ReadonlyArray | null - readonly "output_text"?: string | null - readonly "usage"?: ResponseUsage | null - readonly "parallel_tool_calls": boolean - readonly "conversation"?: Conversation_2 | null - } - readonly "sequence_number": number +}) +export type CreateEvalRequest = { + readonly "name"?: string + readonly "metadata"?: Metadata + readonly "data_source_config": + | CreateEvalCustomDataSourceConfig + | CreateEvalLogsDataSourceConfig + | CreateEvalStoredCompletionsDataSourceConfig + readonly "testing_criteria": ReadonlyArray< + | CreateEvalLabelModelGrader + | EvalGraderStringCheck + | EvalGraderTextSimilarity + | EvalGraderPython + | EvalGraderScoreModel + > +} +export const CreateEvalRequest = Schema.Struct({ + "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the evaluation." })), + "metadata": Schema.optionalKey(Metadata), + "data_source_config": Schema.Union([ + CreateEvalCustomDataSourceConfig, + CreateEvalLogsDataSourceConfig, + CreateEvalStoredCompletionsDataSourceConfig + ], { mode: "oneOf" }).annotate({ + "description": + "The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation." + }), + "testing_criteria": Schema.Array( + Schema.Union([ + CreateEvalLabelModelGrader, + EvalGraderStringCheck, + EvalGraderTextSimilarity, + EvalGraderPython, + EvalGraderScoreModel + ], { mode: "oneOf" }) + ).annotate({ + "description": + "A list of graders for all eval runs in this group. Graders can reference variables in the data source using double curly braces notation, like `{{item.variable_name}}`. To reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`)." + }) +}).annotate({ "title": "CreateEvalRequest" }) +export type EvalRunList = { + readonly "object": "list" + readonly "data": ReadonlyArray + readonly "first_id": string + readonly "last_id": string + readonly "has_more": boolean +} +export const EvalRunList = Schema.Struct({ + "object": Schema.Literal("list").annotate({ + "description": "The type of this object. It is always set to \"list\".\n" + }), + "data": Schema.Array(EvalRun).annotate({ "description": "An array of eval run objects.\n" }), + "first_id": Schema.String.annotate({ "description": "The identifier of the first eval run in the data array." }), + "last_id": Schema.String.annotate({ "description": "The identifier of the last eval run in the data array." }), + "has_more": Schema.Boolean.annotate({ "description": "Indicates whether there are more evals available." }) +}).annotate({ "title": "EvalRunList", "description": "An object representing a list of runs for an evaluation.\n" }) +export type EvalList = { + readonly "object": "list" + readonly "data": ReadonlyArray + readonly "first_id": string + readonly "last_id": string + readonly "has_more": boolean +} +export const EvalList = Schema.Struct({ + "object": Schema.Literal("list").annotate({ + "description": "The type of this object. It is always set to \"list\".\n" + }), + "data": Schema.Array(Eval).annotate({ "description": "An array of eval objects.\n" }), + "first_id": Schema.String.annotate({ "description": "The identifier of the first eval in the data array." }), + "last_id": Schema.String.annotate({ "description": "The identifier of the last eval in the data array." }), + "has_more": Schema.Boolean.annotate({ "description": "Indicates whether there are more evals available." }) +}).annotate({ "title": "EvalList", "description": "An object representing a list of evals.\n" }) +export type FineTuneReinforcementMethod = { + readonly "grader": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderMulti + readonly "hyperparameters"?: FineTuneReinforcementHyperparameters +} +export const FineTuneReinforcementMethod = Schema.Struct({ + "grader": Schema.Union([GraderStringCheck, GraderTextSimilarity, GraderPython, GraderScoreModel, GraderMulti], { + mode: "oneOf" + }).annotate({ "description": "The grader used for the fine-tuning job." }), + "hyperparameters": Schema.optionalKey(FineTuneReinforcementHyperparameters) +}).annotate({ "description": "Configuration for the reinforcement fine-tuning method." }) +export type RunGraderRequest = { + readonly "grader": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderMulti + readonly "item"?: {} + readonly "model_sample": string +} +export const RunGraderRequest = Schema.Struct({ + "grader": Schema.Union([GraderStringCheck, GraderTextSimilarity, GraderPython, GraderScoreModel, GraderMulti], { + mode: "oneOf" + }).annotate({ "description": "The grader used for the fine-tuning job." }), + "item": Schema.optionalKey( + Schema.Struct({}).annotate({ + "description": + "The dataset item provided to the grader. This will be used to populate \nthe `item` namespace. See [the guide](/docs/guides/graders) for more details. \n" + }) + ), + "model_sample": Schema.String.annotate({ + "description": + "The model sample to be evaluated. This value will be used to populate \nthe `sample` namespace. See [the guide](/docs/guides/graders) for more details.\nThe `output_json` variable will be populated if the model sample is a \nvalid JSON string.\n \n" + }) +}).annotate({ "title": "RunGraderRequest" }) +export type ValidateGraderRequest = { + readonly "grader": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderMulti +} +export const ValidateGraderRequest = Schema.Struct({ + "grader": Schema.Union([GraderStringCheck, GraderTextSimilarity, GraderPython, GraderScoreModel, GraderMulti], { + mode: "oneOf" + }).annotate({ "description": "The grader used for the fine-tuning job." }) +}).annotate({ "title": "ValidateGraderRequest" }) +export type ValidateGraderResponse = { + readonly "grader"?: GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderMulti +} +export const ValidateGraderResponse = Schema.Struct({ + "grader": Schema.optionalKey( + Schema.Union([GraderStringCheck, GraderTextSimilarity, GraderPython, GraderScoreModel, GraderMulti], { + mode: "oneOf" + }).annotate({ "description": "The grader used for the fine-tuning job." }) + ) +}).annotate({ "title": "ValidateGraderResponse" }) +export type CreateResponse = { + readonly "metadata"?: Metadata + readonly "top_logprobs"?: number + readonly "temperature"?: number | null + readonly "top_p"?: number | null + readonly "user"?: string | null + readonly "safety_identifier"?: string | null + readonly "prompt_cache_key"?: string | null + readonly "service_tier"?: ServiceTier + readonly "prompt_cache_retention"?: "in-memory" | "24h" | null + readonly "previous_response_id"?: string | null + readonly "model"?: + | ModelIdsShared + | "o1-pro" + | "o1-pro-2025-03-19" + | "o3-pro" + | "o3-pro-2025-06-10" + | "o3-deep-research" + | "o3-deep-research-2025-06-26" + | "o4-mini-deep-research" + | "o4-mini-deep-research-2025-06-26" + | "computer-use-preview" + | "computer-use-preview-2025-03-11" + | "gpt-5-codex" + | "gpt-5-pro" + | "gpt-5-pro-2025-10-06" + | "gpt-5.1-codex-max" + readonly "reasoning"?: Reasoning | null + readonly "background"?: boolean | null + readonly "max_output_tokens"?: number | null + readonly "max_tool_calls"?: number | null + readonly "text"?: ResponseTextParam + readonly "tools"?: ToolsArray + readonly "tool_choice"?: ToolChoiceParam + readonly "prompt"?: Prompt + readonly "truncation"?: "auto" | "disabled" | null + readonly "input"?: InputParam + readonly "include"?: ReadonlyArray | null + readonly "parallel_tool_calls"?: boolean | null + readonly "store"?: boolean | null + readonly "instructions"?: string | null + readonly "stream"?: boolean | null + readonly "stream_options"?: ResponseStreamOptions + readonly "conversation"?: ConversationParam | null + readonly "context_management"?: ReadonlyArray | null } -export const ResponseQueuedEvent = Schema.Struct({ - "type": Schema.Literal("response.queued").annotate({ - "description": "The type of the event. Always 'response.queued'." - }), - "response": Schema.Struct({ - "metadata": Schema.Union([ - Schema.Struct({}).annotate({ +export const CreateResponse = Schema.Struct({ + "metadata": Schema.optionalKey(Metadata), + "top_logprobs": Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ "description": - "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n" - }), - Schema.Null - ]), - "top_logprobs": Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ + "An integer between 0 and 20 specifying the number of most likely tokens to\nreturn at each token position, each with an associated log probability.\n" + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)).check( + Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(20)], { "description": "An integer between 0 and 20 specifying the number of most likely tokens to\nreturn at each token position, each with an associated log probability.\n" - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)), - Schema.Null - ]) - ), - "temperature": Schema.Union([ + }) + ) + ]) + ), + "temperature": Schema.optionalKey( + Schema.Union([ Schema.Number.annotate({ "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n" }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)), Schema.Null - ]), - "top_p": Schema.Union([ - Schema.Number.annotate({ + ]) + ), + "top_p": Schema.optionalKey(Schema.Union([ + Schema.Number.annotate({ + "description": + "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)), + Schema.Null + ])), + "user": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": + "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n" + }) + ), + "safety_identifier": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": + "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n" + }) + ), + "prompt_cache_key": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": + "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n" + }) + ), + "service_tier": Schema.optionalKey(ServiceTier), + "prompt_cache_retention": Schema.optionalKey( + Schema.Union([ + Schema.Literals(["in-memory", "24h"]).annotate({ "description": - "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n" - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)), + "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n" + }), Schema.Null - ]), - "user": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "description": - "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n" - }) - ), - "safety_identifier": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "description": - "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n" - }) - ), - "prompt_cache_key": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ + ]) + ), + "previous_response_id": Schema.optionalKey( + Schema.Union([ + Schema.String.annotate({ "description": - "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n" - }) - ), - "service_tier": Schema.optionalKey(ServiceTier), - "prompt_cache_retention": Schema.optionalKey( - Schema.Union([ - Schema.Literals(["in-memory", "24h"]).annotate({ - "description": - "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n" - }), - Schema.Null - ]) - ), - "previous_response_id": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": - "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n" - }), - Schema.Null - ]) - ), - "model": Schema.Union([ + "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n" + }), + Schema.Null + ]) + ), + "model": Schema.optionalKey( + Schema.Union([ ModelIdsShared, Schema.Literals([ "o1-pro", @@ -23372,255 +24174,95 @@ export const ResponseQueuedEvent = Schema.Struct({ ]).annotate({ "description": "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n" - }), - "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])), - "background": Schema.optionalKey( - Schema.Union([ - Schema.Boolean.annotate({ - "description": - "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n" - }), - Schema.Null - ]) - ), - "max_output_tokens": Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - "description": - "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n" - }).check(Schema.isInt()), - Schema.Null - ]) - ), - "max_tool_calls": Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - "description": - "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n" - }).check(Schema.isInt()), - Schema.Null - ]) - ), - "text": Schema.optionalKey(ResponseTextParam), - "tools": Schema.Array(Tool).annotate({ - "description": - "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n" - }), - "tool_choice": Schema.Union([ - ToolChoiceOptions, - ToolChoiceAllowed, - ToolChoiceTypes, - ToolChoiceFunction, - ToolChoiceMCP, - ToolChoiceCustom, - SpecificApplyPatchParam, - SpecificFunctionShellParam - ], { mode: "oneOf" }).annotate({ - "description": - "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n" - }), - "prompt": Schema.optionalKey(Prompt), - "truncation": Schema.optionalKey(Schema.Union([ - Schema.Literals(["auto", "disabled"]).annotate({ - "description": - "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n" + }) + ), + "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])), + "background": Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ + "description": "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n" }), Schema.Null - ])), - "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }), - "object": Schema.Literal("response").annotate({ - "description": "The object type of this resource - always set to `response`.\n" - }), - "status": Schema.optionalKey( - Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({ + ]) + ), + "max_output_tokens": Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ "description": - "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n" - }) - ), - "created_at": Schema.Number.annotate({ - "description": "Unix timestamp (in seconds) of when this Response was created.\n" - }).check(Schema.isFinite()), - "completed_at": Schema.optionalKey( - Schema.Union([ - Schema.Number.annotate({ - "description": - "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n" - }).check(Schema.isFinite()), - Schema.Null - ]) - ), - "error": ResponseError, - "incomplete_details": Schema.Union([ - Schema.Struct({ - "reason": Schema.optionalKey( - Schema.Literals(["max_output_tokens", "content_filter"]).annotate({ - "description": "The reason why the response is incomplete." - }) - ) - }).annotate({ "description": "Details about why the response is incomplete.\n" }), + "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n" + }).check(Schema.isInt()), Schema.Null - ]), - "output": Schema.Array(OutputItem).annotate({ + ]) + ), + "max_tool_calls": Schema.optionalKey( + Schema.Union([ + Schema.Number.annotate({ + "description": + "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n" + }).check(Schema.isInt()), + Schema.Null + ]) + ), + "text": Schema.optionalKey(ResponseTextParam), + "tools": Schema.optionalKey(ToolsArray), + "tool_choice": Schema.optionalKey(ToolChoiceParam), + "prompt": Schema.optionalKey(Prompt), + "truncation": Schema.optionalKey(Schema.Union([ + Schema.Literals(["auto", "disabled"]).annotate({ + "description": + "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n" + }), + Schema.Null + ])), + "input": Schema.optionalKey(InputParam), + "include": Schema.optionalKey(Schema.Union([ + Schema.Array(IncludeEnum).annotate({ "description": - "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n" + "Specify additional output data to include in the model response. Currently supported values are:\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program)." }), - "instructions": Schema.Union([ - Schema.Union([ - Schema.String.annotate({ - "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n" - }), - Schema.Array(InputItem).annotate({ - "title": "Input item list", - "description": "A list of one or many input items to the model, containing\ndifferent content types.\n" - }) - ], { mode: "oneOf" }).annotate({ - "description": - "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n" + Schema.Null + ])), + "parallel_tool_calls": Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ "description": "Whether to allow the model to run tool calls in parallel.\n" }), + Schema.Null + ]) + ), + "store": Schema.optionalKey( + Schema.Union([ + Schema.Boolean.annotate({ + "description": "Whether to store the generated model response for later retrieval via\nAPI.\n" }), Schema.Null - ]), - "output_text": Schema.optionalKey( - Schema.Union([ - Schema.String.annotate({ - "description": - "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n" - }), - Schema.Null - ]) - ), - "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])), - "parallel_tool_calls": Schema.Boolean.annotate({ - "description": "Whether to allow the model to run tool calls in parallel.\n" + ]) + ), + "instructions": Schema.optionalKey(Schema.Union([ + Schema.String.annotate({ + "description": + "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n" }), - "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])) - }).annotate({ "title": "The response object", "description": "The full response object that is queued." }), - "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check( - Schema.isInt() - ) -}).annotate({ - "title": "ResponseQueuedEvent", - "description": "Emitted when a response is queued and waiting to be processed.\n" -}) -export type CreateEvalRequest = { - readonly "name"?: string - readonly "metadata"?: Metadata - readonly "data_source_config": - | CreateEvalCustomDataSourceConfig - | CreateEvalLogsDataSourceConfig - | CreateEvalStoredCompletionsDataSourceConfig - readonly "testing_criteria": ReadonlyArray< - | CreateEvalLabelModelGrader - | EvalGraderStringCheck - | EvalGraderTextSimilarity - | EvalGraderPython - | EvalGraderScoreModel - > -} -export const CreateEvalRequest = Schema.Struct({ - "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the evaluation." })), - "metadata": Schema.optionalKey(Metadata), - "data_source_config": Schema.Union([ - CreateEvalCustomDataSourceConfig, - CreateEvalLogsDataSourceConfig, - CreateEvalStoredCompletionsDataSourceConfig - ], { mode: "oneOf" }).annotate({ - "description": - "The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation." - }), - "testing_criteria": Schema.Array( - Schema.Union([ - CreateEvalLabelModelGrader, - EvalGraderStringCheck, - EvalGraderTextSimilarity, - EvalGraderPython, - EvalGraderScoreModel - ], { mode: "oneOf" }) - ).annotate({ - "description": - "A list of graders for all eval runs in this group. Graders can reference variables in the data source using double curly braces notation, like `{{item.variable_name}}`. To reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`)." - }) -}).annotate({ "title": "CreateEvalRequest" }) -export type EvalRunList = { - readonly "object": "list" - readonly "data": ReadonlyArray - readonly "first_id": string - readonly "last_id": string - readonly "has_more": boolean -} -export const EvalRunList = Schema.Struct({ - "object": Schema.Literal("list").annotate({ - "description": "The type of this object. It is always set to \"list\".\n" - }), - "data": Schema.Array(EvalRun).annotate({ "description": "An array of eval run objects.\n" }), - "first_id": Schema.String.annotate({ "description": "The identifier of the first eval run in the data array." }), - "last_id": Schema.String.annotate({ "description": "The identifier of the last eval run in the data array." }), - "has_more": Schema.Boolean.annotate({ "description": "Indicates whether there are more evals available." }) -}).annotate({ "title": "EvalRunList", "description": "An object representing a list of runs for an evaluation.\n" }) -export type EvalList = { - readonly "object": "list" - readonly "data": ReadonlyArray - readonly "first_id": string - readonly "last_id": string - readonly "has_more": boolean -} -export const EvalList = Schema.Struct({ - "object": Schema.Literal("list").annotate({ - "description": "The type of this object. It is always set to \"list\".\n" - }), - "data": Schema.Array(Eval).annotate({ "description": "An array of eval objects.\n" }), - "first_id": Schema.String.annotate({ "description": "The identifier of the first eval in the data array." }), - "last_id": Schema.String.annotate({ "description": "The identifier of the last eval in the data array." }), - "has_more": Schema.Boolean.annotate({ "description": "Indicates whether there are more evals available." }) -}).annotate({ "title": "EvalList", "description": "An object representing a list of evals.\n" }) -export type FineTuneReinforcementMethod = { - readonly "grader": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderMulti - readonly "hyperparameters"?: FineTuneReinforcementHyperparameters -} -export const FineTuneReinforcementMethod = Schema.Struct({ - "grader": Schema.Union([GraderStringCheck, GraderTextSimilarity, GraderPython, GraderScoreModel, GraderMulti], { - mode: "oneOf" - }).annotate({ "description": "The grader used for the fine-tuning job." }), - "hyperparameters": Schema.optionalKey(FineTuneReinforcementHyperparameters) -}).annotate({ "description": "Configuration for the reinforcement fine-tuning method." }) -export type RunGraderRequest = { - readonly "grader": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderMulti - readonly "item"?: {} - readonly "model_sample": string -} -export const RunGraderRequest = Schema.Struct({ - "grader": Schema.Union([GraderStringCheck, GraderTextSimilarity, GraderPython, GraderScoreModel, GraderMulti], { - mode: "oneOf" - }).annotate({ "description": "The grader used for the fine-tuning job." }), - "item": Schema.optionalKey( - Schema.Struct({}).annotate({ + Schema.Null + ])), + "stream": Schema.optionalKey(Schema.Union([ + Schema.Boolean.annotate({ "description": - "The dataset item provided to the grader. This will be used to populate \nthe `item` namespace. See [the guide](/docs/guides/graders) for more details. \n" - }) - ), - "model_sample": Schema.String.annotate({ - "description": - "The model sample to be evaluated. This value will be used to populate \nthe `sample` namespace. See [the guide](/docs/guides/graders) for more details.\nThe `output_json` variable will be populated if the model sample is a \nvalid JSON string.\n \n" - }) -}).annotate({ "title": "RunGraderRequest" }) -export type ValidateGraderRequest = { - readonly "grader": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderMulti -} -export const ValidateGraderRequest = Schema.Struct({ - "grader": Schema.Union([GraderStringCheck, GraderTextSimilarity, GraderPython, GraderScoreModel, GraderMulti], { - mode: "oneOf" - }).annotate({ "description": "The grader used for the fine-tuning job." }) -}).annotate({ "title": "ValidateGraderRequest" }) -export type ValidateGraderResponse = { - readonly "grader"?: GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderMulti -} -export const ValidateGraderResponse = Schema.Struct({ - "grader": Schema.optionalKey( - Schema.Union([GraderStringCheck, GraderTextSimilarity, GraderPython, GraderScoreModel, GraderMulti], { - mode: "oneOf" - }).annotate({ "description": "The grader used for the fine-tuning job." }) + "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](/docs/api-reference/responses-streaming)\nfor more information.\n" + }), + Schema.Null + ])), + "stream_options": Schema.optionalKey(ResponseStreamOptions), + "conversation": Schema.optionalKey(Schema.Union([ConversationParam, Schema.Null])), + "context_management": Schema.optionalKey( + Schema.Union([ + Schema.Array(ContextManagementParam).annotate({ + "description": "Context management configuration for this request.\n" + }).check(Schema.isMinLength(1)), + Schema.Null + ]) ) -}).annotate({ "title": "ValidateGraderResponse" }) -export type CreateResponse = { +}) +export type ResponsesClientEventResponseCreate = { + readonly "type": "response.create" readonly "metadata"?: Metadata readonly "top_logprobs"?: number readonly "temperature"?: number | null @@ -23666,7 +24308,10 @@ export type CreateResponse = { readonly "conversation"?: ConversationParam | null readonly "context_management"?: ReadonlyArray | null } -export const CreateResponse = Schema.Struct({ +export const ResponsesClientEventResponseCreate = Schema.Struct({ + "type": Schema.Literal("response.create").annotate({ + "description": "The type of the client event. Always `response.create`.\n" + }), "metadata": Schema.optionalKey(Metadata), "top_logprobs": Schema.optionalKey( Schema.Union([ @@ -23842,21 +24487,9 @@ export const CreateResponse = Schema.Struct({ Schema.Null ]) ) -}) -export type ResponseKeepAliveEvent = { - readonly "type": "keepalive" - readonly "sequence_number": number -} -export const ResponseKeepAliveEvent = Schema.Struct({ - "type": Schema.Literal("keepalive").annotate({ - "description": "The type of the keepalive event. Always `keepalive`." - }), - "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this keepalive event." }).check( - Schema.isInt() - ) }).annotate({ - "title": "Keep alive", - "description": "A keepalive event emitted during long-running response streams." + "description": + "Client event for creating a response over a persistent WebSocket connection.\nThis payload uses the same top-level fields as `POST /v1/responses`.\n\nNotes:\n- `stream` is implicit over WebSocket and should not be sent.\n- `background` is not supported over WebSocket.\n" }) export type ResponseStreamEvent = | ResponseAudioDeltaEvent @@ -23881,7 +24514,6 @@ export type ResponseStreamEvent = | ResponseInProgressEvent | ResponseFailedEvent | ResponseIncompleteEvent - | ResponseKeepAliveEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningSummaryPartAddedEvent @@ -23913,6 +24545,7 @@ export type ResponseStreamEvent = | ResponseQueuedEvent | ResponseCustomToolCallInputDeltaEvent | ResponseCustomToolCallInputDoneEvent + | ResponseKeepAliveEvent | ResponseApplyPatchCallOperationDiffDeltaEvent | ResponseApplyPatchCallOperationDiffDoneEvent export const ResponseStreamEvent = Schema.Union([ @@ -23938,7 +24571,6 @@ export const ResponseStreamEvent = Schema.Union([ ResponseInProgressEvent, ResponseFailedEvent, ResponseIncompleteEvent, - ResponseKeepAliveEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent, ResponseReasoningSummaryPartAddedEvent, @@ -23970,6 +24602,7 @@ export const ResponseStreamEvent = Schema.Union([ ResponseQueuedEvent, ResponseCustomToolCallInputDeltaEvent, ResponseCustomToolCallInputDoneEvent, + ResponseKeepAliveEvent, ResponseApplyPatchCallOperationDiffDeltaEvent, ResponseApplyPatchCallOperationDiffDoneEvent ]) @@ -24334,6 +24967,7 @@ export type CreateBatchRequestJson = { | "/v1/moderations" | "/v1/images/generations" | "/v1/images/edits" + | "/v1/videos" readonly "completion_window": "24h" readonly "metadata"?: Metadata readonly "output_expires_after"?: BatchFileExpirationAfter @@ -24350,10 +24984,11 @@ export const CreateBatchRequestJson = Schema.Struct({ "/v1/completions", "/v1/moderations", "/v1/images/generations", - "/v1/images/edits" + "/v1/images/edits", + "/v1/videos" ]).annotate({ "description": - "The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`, `/v1/images/generations`, and `/v1/images/edits` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch." + "The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and `/v1/videos` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch." }), "completion_window": Schema.Literal("24h").annotate({ "description": "The time frame within which the batch should be processed. Currently only `24h` is supported." @@ -25680,12 +26315,30 @@ export const ListVideosParams = Schema.Struct({ }) export type ListVideos200 = VideoListResource export const ListVideos200 = VideoListResource -export type CreateVideoRequestJson = CreateVideoBody -export const CreateVideoRequestJson = CreateVideoBody -export type CreateVideoRequestFormData = CreateVideoBody -export const CreateVideoRequestFormData = CreateVideoBody +export type CreateVideoRequestJson = CreateVideoJsonBody +export const CreateVideoRequestJson = CreateVideoJsonBody +export type CreateVideoRequestFormData = CreateVideoMultipartBody +export const CreateVideoRequestFormData = CreateVideoMultipartBody export type CreateVideo200 = VideoResource export const CreateVideo200 = VideoResource +export type CreateVideoCharacterRequestFormData = CreateVideoCharacterBody +export const CreateVideoCharacterRequestFormData = CreateVideoCharacterBody +export type CreateVideoCharacter200 = VideoCharacterResource +export const CreateVideoCharacter200 = VideoCharacterResource +export type GetVideoCharacter200 = VideoCharacterResource +export const GetVideoCharacter200 = VideoCharacterResource +export type CreateVideoEditRequestJson = CreateVideoEditJsonBody +export const CreateVideoEditRequestJson = CreateVideoEditJsonBody +export type CreateVideoEditRequestFormData = CreateVideoEditMultipartBody +export const CreateVideoEditRequestFormData = CreateVideoEditMultipartBody +export type CreateVideoEdit200 = VideoResource +export const CreateVideoEdit200 = VideoResource +export type CreateVideoExtendRequestJson = CreateVideoExtendJsonBody +export const CreateVideoExtendRequestJson = CreateVideoExtendJsonBody +export type CreateVideoExtendRequestFormData = CreateVideoExtendMultipartBody +export const CreateVideoExtendRequestFormData = CreateVideoExtendMultipartBody +export type CreateVideoExtend200 = VideoResource +export const CreateVideoExtend200 = VideoResource export type GetVideo200 = VideoResource export const GetVideo200 = VideoResource export type DeleteVideo200 = DeletedVideoResource @@ -27908,6 +28561,37 @@ export const make = ( orElse: unexpectedStatus })) ), + "CreateVideoCharacter": (options) => + HttpClientRequest.post(`/videos/characters`).pipe( + HttpClientRequest.bodyFormData(options.payload as any), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateVideoCharacter200), + orElse: unexpectedStatus + })) + ), + "GetVideoCharacter": (characterId, options) => + HttpClientRequest.get(`/videos/characters/${characterId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(GetVideoCharacter200), + orElse: unexpectedStatus + })) + ), + "CreateVideoEdit": (options) => + HttpClientRequest.post(`/videos/edits`).pipe( + HttpClientRequest.bodyFormData(options.payload as any), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateVideoEdit200), + orElse: unexpectedStatus + })) + ), + "CreateVideoExtend": (options) => + HttpClientRequest.post(`/videos/extensions`).pipe( + HttpClientRequest.bodyFormData(options.payload as any), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateVideoExtend200), + orElse: unexpectedStatus + })) + ), "GetVideo": (videoId, options) => HttpClientRequest.get(`/videos/${videoId}`).pipe( withResponse(options?.config)(HttpClientResponse.matchStatus({ @@ -30489,7 +31173,7 @@ export interface OpenAiClient { HttpClientError.HttpClientError | SchemaError > /** - * Create a vector store file batch. + * The maximum number of files in a single batch request is 2000. */ readonly "createVectorStoreFileBatch": ( vectorStoreId: string, @@ -30676,6 +31360,46 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Create a character from an uploaded video. + */ + readonly "CreateVideoCharacter": ( + options: { + readonly payload: typeof CreateVideoCharacterRequestFormData.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Fetch a character. + */ + readonly "GetVideoCharacter": ( + characterId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Create a new video generation job by editing a source video or existing generated video. + */ + readonly "CreateVideoEdit": ( + options: { readonly payload: typeof CreateVideoEditRequestFormData.Encoded; readonly config?: Config | undefined } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Create an extension of a completed video. + */ + readonly "CreateVideoExtend": ( + options: { readonly payload: typeof CreateVideoExtendRequestFormData.Encoded; readonly config?: Config | undefined } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Fetch the latest metadata for a generated video. */ diff --git a/packages/ai/openrouter/src/Generated.ts b/packages/ai/openrouter/src/Generated.ts index 06dadb884..01bb552c4 100644 --- a/packages/ai/openrouter/src/Generated.ts +++ b/packages/ai/openrouter/src/Generated.ts @@ -270,10 +270,6 @@ export type ResponsesFormatText = { readonly "type": "text" } export const ResponsesFormatText = Schema.Struct({ "type": Schema.Literal("text") }).annotate({ "description": "Plain text response format" }) -export type ResponsesFormatJSONObject = { readonly "type": "json_object" } -export const ResponsesFormatJSONObject = Schema.Struct({ "type": Schema.Literal("json_object") }).annotate({ - "description": "JSON object response format" -}) export type ResponsesFormatTextJSONSchemaConfig = { readonly "type": "json_schema" readonly "name": string @@ -677,6 +673,7 @@ export type ProviderName = | "Inception" | "Inceptron" | "InferenceNet" + | "Ionstream" | "Infermatic" | "Io Net" | "Inflection" @@ -751,6 +748,7 @@ export const ProviderName = Schema.Literals([ "Inception", "Inceptron", "InferenceNet", + "Ionstream", "Infermatic", "Io Net", "Inflection", @@ -794,7 +792,26 @@ export const ProviderName = Schema.Literals([ export type Quantization = "int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown" export const Quantization = Schema.Literals(["int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown"]) export type ProviderSort = "price" | "throughput" | "latency" -export const ProviderSort = Schema.Literals(["price", "throughput", "latency"]) +export const ProviderSort = Schema.Literals(["price", "throughput", "latency"]).annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" +}) +export type ProviderSortConfig = { + readonly "by"?: "price" | "throughput" | "latency" + readonly "partition"?: "model" | "none" +} +export const ProviderSortConfig = Schema.Struct({ + "by": Schema.optionalKey( + Schema.Literals(["price", "throughput", "latency"]).annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }) + ), + "partition": Schema.optionalKey( + Schema.Literals(["model", "none"]).annotate({ + "description": + "Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model." + }) + ) +}).annotate({ "description": "The provider sorting strategy (price, throughput, latency)" }) export type BigNumberUnion = string export const BigNumberUnion = Schema.String.annotate({ "description": "Price per million prompt tokens" }) export type PercentileThroughputCutoffs = { @@ -2325,6 +2342,300 @@ export const ForbiddenResponseErrorData = Schema.Struct({ "message": Schema.String, "metadata": Schema.optionalKey(Schema.Struct({})) }).annotate({ "description": "Error data for ForbiddenResponse" }) +export type ChatCompletionFinishReason = "tool_calls" | "stop" | "length" | "content_filter" | "error" +export const ChatCompletionFinishReason = Schema.Literals(["tool_calls", "stop", "length", "content_filter", "error"]) +export type ChatMessageContentItemCacheControl = { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } +export const ChatMessageContentItemCacheControl = Schema.Struct({ + "type": Schema.Literal("ephemeral"), + "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) +}).annotate({ "description": "Cache control for the content part" }) +export type ChatMessageContentItemImage = { + readonly "type": "image_url" + readonly "image_url": { readonly "url": string; readonly "detail"?: "auto" | "low" | "high" } +} +export const ChatMessageContentItemImage = Schema.Struct({ + "type": Schema.Literal("image_url"), + "image_url": Schema.Struct({ + "url": Schema.String.annotate({ "description": "URL of the image (data: URLs supported)" }), + "detail": Schema.optionalKey( + Schema.Literals(["auto", "low", "high"]).annotate({ "description": "Image detail level for vision models" }) + ) + }) +}).annotate({ "description": "Image content part for vision models" }) +export type ChatMessageContentItemAudio = { + readonly "type": "input_audio" + readonly "input_audio": { readonly "data": string; readonly "format": string } +} +export const ChatMessageContentItemAudio = Schema.Struct({ + "type": Schema.Literal("input_audio"), + "input_audio": Schema.Struct({ + "data": Schema.String.annotate({ "description": "Base64 encoded audio data" }), + "format": Schema.String.annotate({ + "description": + "Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by provider." + }) + }) +}).annotate({ "description": "Audio input content part. Supported audio formats vary by provider." }) +export type VideoInput = { readonly "url": string } +export const VideoInput = Schema.Struct({ + "url": Schema.String.annotate({ "description": "URL of the video (data: URLs supported)" }) +}).annotate({ "description": "Video input object" }) +export type ChatMessageToolCall = { + readonly "id": string + readonly "type": "function" + readonly "function": { readonly "name": string; readonly "arguments": string } +} +export const ChatMessageToolCall = Schema.Struct({ + "id": Schema.String.annotate({ "description": "Tool call identifier" }), + "type": Schema.Literal("function"), + "function": Schema.Struct({ + "name": Schema.String.annotate({ "description": "Function name to call" }), + "arguments": Schema.String.annotate({ "description": "Function arguments as JSON string" }) + }) +}).annotate({ "description": "Tool call made by the assistant" }) +export type ReasoningDetailSummary = { + readonly "type": "reasoning.summary" + readonly "summary": string + readonly "id"?: string + readonly "format"?: + | "unknown" + | "openai-responses-v1" + | "azure-openai-responses-v1" + | "xai-responses-v1" + | "anthropic-claude-v1" + | "google-gemini-v1" + readonly "index"?: number +} +export const ReasoningDetailSummary = Schema.Struct({ + "type": Schema.Literal("reasoning.summary"), + "summary": Schema.String, + "id": Schema.optionalKey(Schema.String), + "format": Schema.optionalKey( + Schema.Literals([ + "unknown", + "openai-responses-v1", + "azure-openai-responses-v1", + "xai-responses-v1", + "anthropic-claude-v1", + "google-gemini-v1" + ]) + ), + "index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) +}).annotate({ "description": "Reasoning detail summary schema" }) +export type ReasoningDetailEncrypted = { + readonly "type": "reasoning.encrypted" + readonly "data": string + readonly "id"?: string + readonly "format"?: + | "unknown" + | "openai-responses-v1" + | "azure-openai-responses-v1" + | "xai-responses-v1" + | "anthropic-claude-v1" + | "google-gemini-v1" + readonly "index"?: number +} +export const ReasoningDetailEncrypted = Schema.Struct({ + "type": Schema.Literal("reasoning.encrypted"), + "data": Schema.String, + "id": Schema.optionalKey(Schema.String), + "format": Schema.optionalKey( + Schema.Literals([ + "unknown", + "openai-responses-v1", + "azure-openai-responses-v1", + "xai-responses-v1", + "anthropic-claude-v1", + "google-gemini-v1" + ]) + ), + "index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) +}).annotate({ "description": "Reasoning detail encrypted schema" }) +export type ReasoningDetailText = { + readonly "type": "reasoning.text" + readonly "text"?: string + readonly "signature"?: string + readonly "id"?: string + readonly "format"?: + | "unknown" + | "openai-responses-v1" + | "azure-openai-responses-v1" + | "xai-responses-v1" + | "anthropic-claude-v1" + | "google-gemini-v1" + readonly "index"?: number +} +export const ReasoningDetailText = Schema.Struct({ + "type": Schema.Literal("reasoning.text"), + "text": Schema.optionalKey(Schema.String), + "signature": Schema.optionalKey(Schema.String), + "id": Schema.optionalKey(Schema.String), + "format": Schema.optionalKey( + Schema.Literals([ + "unknown", + "openai-responses-v1", + "azure-openai-responses-v1", + "xai-responses-v1", + "anthropic-claude-v1", + "google-gemini-v1" + ]) + ), + "index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) +}).annotate({ "description": "Reasoning detail text schema" }) +export type ChatMessageTokenLogprob = { + readonly "token": string + readonly "logprob": number + readonly "bytes": ReadonlyArray + readonly "top_logprobs": ReadonlyArray< + { readonly "token": string; readonly "logprob": number; readonly "bytes": ReadonlyArray } + > +} +export const ChatMessageTokenLogprob = Schema.Struct({ + "token": Schema.String.annotate({ "description": "The token" }), + "logprob": Schema.Number.annotate({ "description": "Log probability of the token" }).check(Schema.isFinite()), + "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())).annotate({ "description": "UTF-8 bytes of the token" }), + "top_logprobs": Schema.Array( + Schema.Struct({ + "token": Schema.String, + "logprob": Schema.Number.check(Schema.isFinite()), + "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())) + }) + ).annotate({ "description": "Top alternative tokens with probabilities" }) +}).annotate({ "description": "Token log probability information" }) +export type ChatGenerationTokenUsage = { + readonly "completion_tokens": number + readonly "prompt_tokens": number + readonly "total_tokens": number + readonly "completion_tokens_details"?: { + readonly "reasoning_tokens"?: number + readonly "audio_tokens"?: number + readonly "accepted_prediction_tokens"?: number + readonly "rejected_prediction_tokens"?: number + } + readonly "prompt_tokens_details"?: { + readonly "cached_tokens"?: number + readonly "cache_write_tokens"?: number + readonly "audio_tokens"?: number + readonly "video_tokens"?: number + } +} +export const ChatGenerationTokenUsage = Schema.Struct({ + "completion_tokens": Schema.Number.annotate({ "description": "Number of tokens in the completion" }).check( + Schema.isFinite() + ), + "prompt_tokens": Schema.Number.annotate({ "description": "Number of tokens in the prompt" }).check(Schema.isFinite()), + "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens" }).check(Schema.isFinite()), + "completion_tokens_details": Schema.optionalKey( + Schema.Struct({ + "reasoning_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Tokens used for reasoning" }).check(Schema.isFinite()) + ), + "audio_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Tokens used for audio output" }).check(Schema.isFinite()) + ), + "accepted_prediction_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Accepted prediction tokens" }).check(Schema.isFinite()) + ), + "rejected_prediction_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Rejected prediction tokens" }).check(Schema.isFinite()) + ) + }).annotate({ "description": "Detailed completion token usage" }) + ), + "prompt_tokens_details": Schema.optionalKey( + Schema.Struct({ + "cached_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Cached prompt tokens" }).check(Schema.isFinite()) + ), + "cache_write_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Tokens written to cache. Only returned for models with explicit caching and cache write pricing." + }).check(Schema.isFinite()) + ), + "audio_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Audio input tokens" }).check(Schema.isFinite()) + ), + "video_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Video input tokens" }).check(Schema.isFinite()) + ) + }).annotate({ "description": "Detailed prompt token usage" }) + ) +}).annotate({ "description": "Token usage statistics" }) +export type ChatStreamingMessageToolCall = { + readonly "index": number + readonly "id"?: string | null + readonly "type"?: "function" | null + readonly "function"?: { readonly "name"?: string | null; readonly "arguments"?: string } +} +export const ChatStreamingMessageToolCall = Schema.Struct({ + "index": Schema.Number.annotate({ "description": "Tool call index in the array" }).check(Schema.isFinite()), + "id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + "type": Schema.optionalKey(Schema.Union([Schema.Literal("function"), Schema.Null])), + "function": Schema.optionalKey( + Schema.Struct({ + "name": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + "arguments": Schema.optionalKey(Schema.String.annotate({ "description": "Function arguments as JSON string" })) + }).annotate({ "description": "Function call details" }) + ) +}).annotate({ "description": "Tool call delta for streaming responses" }) +export type ModelName = string +export const ModelName = Schema.String.annotate({ "description": "Model to use for completion" }) +export type ModelNames = ReadonlyArray +export const ModelNames = Schema.Array( + Schema.String.annotate({ "description": "Available OpenRouter chat completion models" }) +).annotate({ "description": "Models to use for completion" }) +export type ResponseFormatText = { readonly "type": "text" } +export const ResponseFormatText = Schema.Struct({ "type": Schema.Literal("text") }).annotate({ + "description": "Default text response format" +}) +export type ResponseFormatJSONObject = { readonly "type": "json_object" } +export const ResponseFormatJSONObject = Schema.Struct({ "type": Schema.Literal("json_object") }).annotate({ + "description": "JSON object response format" +}) +export type JSONSchemaConfig = { + readonly "name": string + readonly "description"?: string + readonly "schema"?: {} + readonly "strict"?: boolean +} +export const JSONSchemaConfig = Schema.Struct({ + "name": Schema.String.annotate({ "description": "Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)" }) + .check(Schema.isMaxLength(64)), + "description": Schema.optionalKey(Schema.String.annotate({ "description": "Schema description for the model" })), + "schema": Schema.optionalKey(Schema.Struct({}).annotate({ "description": "JSON Schema object" })), + "strict": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Enable strict schema adherence" })) +}).annotate({ "description": "JSON Schema configuration object" }) +export type ResponseFormatTextGrammar = { readonly "type": "grammar"; readonly "grammar": string } +export const ResponseFormatTextGrammar = Schema.Struct({ + "type": Schema.Literal("grammar"), + "grammar": Schema.String.annotate({ "description": "Custom grammar for text generation" }) +}).annotate({ "description": "Custom grammar response format" }) +export type ResponseFormatTextPython = { readonly "type": "python" } +export const ResponseFormatTextPython = Schema.Struct({ "type": Schema.Literal("python") }).annotate({ + "description": "Python code response format" +}) +export type ChatStreamOptions = { readonly "include_usage"?: boolean } +export const ChatStreamOptions = Schema.Struct({ + "include_usage": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Deprecated: This field has no effect. Full usage details are always included." + }) + ) +}).annotate({ "description": "Streaming configuration options" }) +export type NamedToolChoice = { readonly "type": "function"; readonly "function": { readonly "name": string } } +export const NamedToolChoice = Schema.Struct({ + "type": Schema.Literal("function"), + "function": Schema.Struct({ "name": Schema.String.annotate({ "description": "Function name to call" }) }) +}).annotate({ "description": "Named tool choice for specific function" }) +export type DebugOptions = { readonly "echo_upstream_body"?: boolean } +export const DebugOptions = Schema.Struct({ + "echo_upstream_body": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode." + }) + ) +}).annotate({ "description": "Debug options for inspecting request transformations (streaming only)" }) export type CreateChargeRequest = { readonly "amount": number readonly "sender": string @@ -2549,351 +2860,6 @@ export const PercentileStats = Schema.Struct({ "description": "Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests." }) -export type __schema5 = ReadonlyArray< - | "AI21" - | "AionLabs" - | "Alibaba" - | "Ambient" - | "Amazon Bedrock" - | "Amazon Nova" - | "Anthropic" - | "Arcee AI" - | "AtlasCloud" - | "Avian" - | "Azure" - | "BaseTen" - | "BytePlus" - | "Black Forest Labs" - | "Cerebras" - | "Chutes" - | "Cirrascale" - | "Clarifai" - | "Cloudflare" - | "Cohere" - | "Crusoe" - | "DeepInfra" - | "DeepSeek" - | "Featherless" - | "Fireworks" - | "Friendli" - | "GMICloud" - | "Google" - | "Google AI Studio" - | "Groq" - | "Hyperbolic" - | "Inception" - | "Inceptron" - | "InferenceNet" - | "Infermatic" - | "Io Net" - | "Inflection" - | "Liquid" - | "Mara" - | "Mancer 2" - | "Minimax" - | "ModelRun" - | "Mistral" - | "Modular" - | "Moonshot AI" - | "Morph" - | "NCompass" - | "Nebius" - | "NextBit" - | "Novita" - | "Nvidia" - | "OpenAI" - | "OpenInference" - | "Parasail" - | "Perplexity" - | "Phala" - | "Relace" - | "SambaNova" - | "Seed" - | "SiliconFlow" - | "Sourceful" - | "StepFun" - | "Stealth" - | "StreamLake" - | "Switchpoint" - | "Together" - | "Upstage" - | "Venice" - | "WandB" - | "Xiaomi" - | "xAI" - | "Z.AI" - | "FakeProvider" - | string -> -export const __schema5 = Schema.Array( - Schema.Union([ - Schema.Literals([ - "AI21", - "AionLabs", - "Alibaba", - "Ambient", - "Amazon Bedrock", - "Amazon Nova", - "Anthropic", - "Arcee AI", - "AtlasCloud", - "Avian", - "Azure", - "BaseTen", - "BytePlus", - "Black Forest Labs", - "Cerebras", - "Chutes", - "Cirrascale", - "Clarifai", - "Cloudflare", - "Cohere", - "Crusoe", - "DeepInfra", - "DeepSeek", - "Featherless", - "Fireworks", - "Friendli", - "GMICloud", - "Google", - "Google AI Studio", - "Groq", - "Hyperbolic", - "Inception", - "Inceptron", - "InferenceNet", - "Infermatic", - "Io Net", - "Inflection", - "Liquid", - "Mara", - "Mancer 2", - "Minimax", - "ModelRun", - "Mistral", - "Modular", - "Moonshot AI", - "Morph", - "NCompass", - "Nebius", - "NextBit", - "Novita", - "Nvidia", - "OpenAI", - "OpenInference", - "Parasail", - "Perplexity", - "Phala", - "Relace", - "SambaNova", - "Seed", - "SiliconFlow", - "Sourceful", - "StepFun", - "Stealth", - "StreamLake", - "Switchpoint", - "Together", - "Upstage", - "Venice", - "WandB", - "Xiaomi", - "xAI", - "Z.AI", - "FakeProvider" - ]), - Schema.String - ]) -) -export type __schema11 = number -export const __schema11 = Schema.Number.check(Schema.isFinite()) -export type __schema13 = unknown -export const __schema13 = Schema.Unknown -export type __schema21 = string | null -export const __schema21 = Schema.Union([Schema.String, Schema.Null]) -export type __schema22 = - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" - | null -export const __schema22 = Schema.Union([ - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]), - Schema.Null -]) -export type ModelName = string -export const ModelName = Schema.String -export type ChatMessageContentItemImage = { - readonly "type": "image_url" - readonly "image_url": { readonly "url": string; readonly "detail"?: "auto" | "low" | "high" } -} -export const ChatMessageContentItemImage = Schema.Struct({ - "type": Schema.Literal("image_url"), - "image_url": Schema.Struct({ - "url": Schema.String, - "detail": Schema.optionalKey(Schema.Literals(["auto", "low", "high"])) - }) -}) -export type ChatMessageContentItemAudio = { - readonly "type": "input_audio" - readonly "input_audio": { readonly "data": string; readonly "format": string } -} -export const ChatMessageContentItemAudio = Schema.Struct({ - "type": Schema.Literal("input_audio"), - "input_audio": Schema.Struct({ "data": Schema.String, "format": Schema.String }) -}) -export type ChatMessageContentItemVideo = { - readonly "type": "input_video" - readonly "video_url": { readonly "url": string } -} | { readonly "type": "video_url"; readonly "video_url": { readonly "url": string } } -export const ChatMessageContentItemVideo = Schema.Union([ - Schema.Struct({ "type": Schema.Literal("input_video"), "video_url": Schema.Struct({ "url": Schema.String }) }), - Schema.Struct({ "type": Schema.Literal("video_url"), "video_url": Schema.Struct({ "url": Schema.String }) }) -], { mode: "oneOf" }) -export type ChatMessageToolCall = { - readonly "id": string - readonly "type": "function" - readonly "function": { readonly "name": string; readonly "arguments": string } -} -export const ChatMessageToolCall = Schema.Struct({ - "id": Schema.String, - "type": Schema.Literal("function"), - "function": Schema.Struct({ "name": Schema.String, "arguments": Schema.String }) -}) -export type ChatMessageTokenLogprob = { - readonly "token": string - readonly "logprob": number - readonly "bytes": ReadonlyArray | null - readonly "top_logprobs": ReadonlyArray< - { readonly "token": string; readonly "logprob": number; readonly "bytes": ReadonlyArray | null } - > -} -export const ChatMessageTokenLogprob = Schema.Struct({ - "token": Schema.String, - "logprob": Schema.Number.check(Schema.isFinite()), - "bytes": Schema.Union([Schema.Array(Schema.Number.check(Schema.isFinite())), Schema.Null]), - "top_logprobs": Schema.Array( - Schema.Struct({ - "token": Schema.String, - "logprob": Schema.Number.check(Schema.isFinite()), - "bytes": Schema.Union([Schema.Array(Schema.Number.check(Schema.isFinite())), Schema.Null]) - }) - ) -}) -export type ChatGenerationTokenUsage = { - readonly "completion_tokens": number - readonly "prompt_tokens": number - readonly "total_tokens": number - readonly "completion_tokens_details"?: { - readonly "reasoning_tokens"?: number | null - readonly "audio_tokens"?: number | null - readonly "accepted_prediction_tokens"?: number | null - readonly "rejected_prediction_tokens"?: number | null - } | null - readonly "prompt_tokens_details"?: { - readonly "cached_tokens"?: number - readonly "cache_write_tokens"?: number - readonly "audio_tokens"?: number - readonly "video_tokens"?: number - } | null -} -export const ChatGenerationTokenUsage = Schema.Struct({ - "completion_tokens": Schema.Number.check(Schema.isFinite()), - "prompt_tokens": Schema.Number.check(Schema.isFinite()), - "total_tokens": Schema.Number.check(Schema.isFinite()), - "completion_tokens_details": Schema.optionalKey(Schema.Union([ - Schema.Struct({ - "reasoning_tokens": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "audio_tokens": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "accepted_prediction_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null]) - ), - "rejected_prediction_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null]) - ) - }), - Schema.Null - ])), - "prompt_tokens_details": Schema.optionalKey(Schema.Union([ - Schema.Struct({ - "cached_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "cache_write_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "audio_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "video_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) - }), - Schema.Null - ])) -}) -export type ChatCompletionFinishReason = "tool_calls" | "stop" | "length" | "content_filter" | "error" -export const ChatCompletionFinishReason = Schema.Literals(["tool_calls", "stop", "length", "content_filter", "error"]) -export type JSONSchemaConfig = { - readonly "name": string - readonly "description"?: string - readonly "schema"?: {} - readonly "strict"?: boolean | null -} -export const JSONSchemaConfig = Schema.Struct({ - "name": Schema.String.check(Schema.isMaxLength(64)), - "description": Schema.optionalKey(Schema.String), - "schema": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))), - "strict": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])) -}) -export type ResponseFormatTextGrammar = { readonly "type": "grammar"; readonly "grammar": string } -export const ResponseFormatTextGrammar = Schema.Struct({ "type": Schema.Literal("grammar"), "grammar": Schema.String }) -export type ChatMessageContentItemCacheControl = { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } -export const ChatMessageContentItemCacheControl = Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) -}) -export type NamedToolChoice = { readonly "type": "function"; readonly "function": { readonly "name": string } } -export const NamedToolChoice = Schema.Struct({ - "type": Schema.Literal("function"), - "function": Schema.Struct({ "name": Schema.String }) -}) -export type ChatStreamOptions = { readonly "include_usage"?: boolean } -export const ChatStreamOptions = Schema.Struct({ "include_usage": Schema.optionalKey(Schema.Boolean) }) -export type ChatStreamingMessageToolCall = { - readonly "index": number - readonly "id"?: string | null - readonly "type"?: "function" | null - readonly "function"?: { readonly "name"?: string | null; readonly "arguments"?: string } -} -export const ChatStreamingMessageToolCall = Schema.Struct({ - "index": Schema.Number.check(Schema.isFinite()), - "id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "type": Schema.optionalKey(Schema.Union([Schema.Literal("function"), Schema.Null])), - "function": Schema.optionalKey( - Schema.Struct({ - "name": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "arguments": Schema.optionalKey(Schema.String) - }) - ) -}) -export type ChatError = { - readonly "error": { - readonly "code": string | number | null - readonly "message": string - readonly "param"?: string | null - readonly "type"?: string | null - } -} -export const ChatError = Schema.Struct({ - "error": Schema.Struct({ - "code": Schema.Union([Schema.Union([Schema.String, Schema.Number.check(Schema.isFinite())]), Schema.Null]), - "message": Schema.String, - "param": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "type": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])) - }) -}) export type OpenAIResponsesAnnotation = FileCitation | URLCitation | FilePath export const OpenAIResponsesAnnotation = Schema.Union([FileCitation, URLCitation, FilePath]) export type OutputItemReasoning = { @@ -2915,7 +2881,7 @@ export const OutputItemReasoning = Schema.Struct({ export type ResponsesOutputItemReasoning = { readonly "type": "reasoning" readonly "id": string - readonly "content"?: ReadonlyArray + readonly "content"?: ReadonlyArray<{ readonly "type": "reasoning_text"; readonly "text": string }> readonly "summary": ReadonlyArray readonly "encrypted_content"?: string readonly "status"?: "completed" | "incomplete" | "in_progress" @@ -2931,7 +2897,9 @@ export type ResponsesOutputItemReasoning = { export const ResponsesOutputItemReasoning = Schema.Struct({ "type": Schema.Literal("reasoning"), "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("reasoning_text"), "text": Schema.String })) + ), "summary": Schema.Array(ReasoningSummaryText), "encrypted_content": Schema.optionalKey(Schema.String), "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), @@ -2984,7 +2952,7 @@ export const OpenResponsesReasoningSummaryPartDoneEvent = Schema.Struct({ export type OpenResponsesReasoning = { readonly "type": "reasoning" readonly "id": string - readonly "content"?: ReadonlyArray + readonly "content"?: ReadonlyArray<{ readonly "type": "reasoning_text"; readonly "text": string }> readonly "summary": ReadonlyArray readonly "encrypted_content"?: string readonly "status"?: "completed" | "incomplete" | "in_progress" @@ -3000,7 +2968,9 @@ export type OpenResponsesReasoning = { export const OpenResponsesReasoning = Schema.Struct({ "type": Schema.Literal("reasoning"), "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("reasoning_text"), "text": Schema.String })) + ), "summary": Schema.Array(ReasoningSummaryText), "encrypted_content": Schema.optionalKey(Schema.String), "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), @@ -3178,15 +3148,6 @@ export const OpenResponsesReasoningConfig = Schema.Struct({ "max_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), "enabled": Schema.optionalKey(Schema.Boolean) }).annotate({ "description": "Configuration for reasoning mode in the response" }) -export type ResponseFormatTextConfig = - | ResponsesFormatText - | ResponsesFormatJSONObject - | ResponsesFormatTextJSONSchemaConfig -export const ResponseFormatTextConfig = Schema.Union([ - ResponsesFormatText, - ResponsesFormatJSONObject, - ResponsesFormatTextJSONSchemaConfig -]).annotate({ "description": "Text response format configuration" }) export type OpenResponsesLogProbs = { readonly "logprob": number readonly "token": string @@ -3346,11 +3307,6 @@ export const OpenResponsesInputMessageItem = Schema.Struct({ ], { mode: "oneOf" }) ) }) -export type ProviderSortConfig = { readonly "by"?: ProviderSort | null; readonly "partition"?: "model" | "none" | null } -export const ProviderSortConfig = Schema.Struct({ - "by": Schema.optionalKey(Schema.Union([ProviderSort, Schema.Null])), - "partition": Schema.optionalKey(Schema.Union([Schema.Literals(["model", "none"]), Schema.Null])) -}) export type PreferredMinThroughput = number | PercentileThroughputCutoffs | unknown export const PreferredMinThroughput = Schema.Union([ Schema.Number.check(Schema.isFinite()), @@ -3378,6 +3334,85 @@ export const ForbiddenResponse = Schema.Struct({ "error": ForbiddenResponseErrorData, "user_id": Schema.optionalKey(Schema.String) }).annotate({ "description": "Forbidden - Authentication successful but insufficient permissions" }) +export type ChatMessageContentItemText = { + readonly "type": "text" + readonly "text": string + readonly "cache_control"?: ChatMessageContentItemCacheControl +} +export const ChatMessageContentItemText = Schema.Struct({ + "type": Schema.Literal("text"), + "text": Schema.String, + "cache_control": Schema.optionalKey(ChatMessageContentItemCacheControl) +}).annotate({ "description": "Text content part" }) +export type ToolDefinitionJson = { + readonly "type": "function" + readonly "function": { + readonly "name": string + readonly "description"?: string + readonly "parameters"?: {} + readonly "strict"?: boolean + } + readonly "cache_control"?: ChatMessageContentItemCacheControl +} +export const ToolDefinitionJson = Schema.Struct({ + "type": Schema.Literal("function"), + "function": Schema.Struct({ + "name": Schema.String.annotate({ + "description": "Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)" + }).check(Schema.isMaxLength(64)), + "description": Schema.optionalKey(Schema.String.annotate({ "description": "Function description for the model" })), + "parameters": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Function parameters as JSON Schema object" }) + ), + "strict": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Enable strict schema adherence" })) + }).annotate({ "description": "Function definition for tool calling" }), + "cache_control": Schema.optionalKey(ChatMessageContentItemCacheControl) +}).annotate({ "description": "Tool definition for function calling" }) +export type ChatMessageContentItemVideoLegacy = { readonly "type": "input_video"; readonly "video_url": VideoInput } +export const ChatMessageContentItemVideoLegacy = Schema.Struct({ + "type": Schema.Literal("input_video"), + "video_url": VideoInput +}).annotate({ "description": "Video input content part (legacy format - deprecated)" }) +export type ChatMessageContentItemVideo = { readonly "type": "video_url"; readonly "video_url": VideoInput } +export const ChatMessageContentItemVideo = Schema.Struct({ + "type": Schema.Literal("video_url"), + "video_url": VideoInput +}).annotate({ "description": "Video input content part" }) +export type ReasoningDetailUnion = ReasoningDetailSummary | ReasoningDetailEncrypted | ReasoningDetailText +export const ReasoningDetailUnion = Schema.Union([ + ReasoningDetailSummary, + ReasoningDetailEncrypted, + ReasoningDetailText +], { mode: "oneOf" }).annotate({ "description": "Reasoning detail union schema" }) +export type ChatMessageTokenLogprobs = { + readonly "content": ReadonlyArray + readonly "refusal": ReadonlyArray +} +export const ChatMessageTokenLogprobs = Schema.Struct({ + "content": Schema.Array(ChatMessageTokenLogprob).annotate({ "description": "Log probabilities for content tokens" }), + "refusal": Schema.Array(ChatMessageTokenLogprob).annotate({ "description": "Log probabilities for refusal tokens" }) +}).annotate({ "description": "Log probabilities for the completion" }) +export type ResponseFormatTextConfig = + | ResponsesFormatText + | ResponseFormatJSONObject + | ResponsesFormatTextJSONSchemaConfig +export const ResponseFormatTextConfig = Schema.Union([ + ResponsesFormatText, + ResponseFormatJSONObject, + ResponsesFormatTextJSONSchemaConfig +]).annotate({ "description": "Text response format configuration" }) +export type ResponseFormatJSONSchema = { readonly "type": "json_schema"; readonly "json_schema": JSONSchemaConfig } +export const ResponseFormatJSONSchema = Schema.Struct({ + "type": Schema.Literal("json_schema"), + "json_schema": JSONSchemaConfig +}).annotate({ "description": "JSON Schema response format for structured outputs" }) +export type ToolChoiceOption = "none" | "auto" | "required" | NamedToolChoice +export const ToolChoiceOption = Schema.Union([ + Schema.Literal("none"), + Schema.Literal("auto"), + Schema.Literal("required"), + NamedToolChoice +]).annotate({ "description": "Tool choice configuration" }) export type ModelArchitecture = { readonly "tokenizer"?: ModelGroup readonly "instruct_type"?: @@ -3540,104 +3575,6 @@ export const PublicEndpoint = Schema.Struct({ "Throughput percentiles in tokens per second over the last 30 minutes. Throughput measures output token generation speed. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests." }) }).annotate({ "description": "Information about a specific model endpoint" }) -export type __schema20 = { - readonly "type": "reasoning.summary" - readonly "summary": string - readonly "id"?: __schema21 - readonly "format"?: __schema22 - readonly "index"?: __schema11 -} | { - readonly "type": "reasoning.encrypted" - readonly "data": string - readonly "id"?: __schema21 - readonly "format"?: __schema22 - readonly "index"?: __schema11 -} | { - readonly "type": "reasoning.text" - readonly "text"?: string | null - readonly "signature"?: string | null - readonly "id"?: __schema21 - readonly "format"?: __schema22 - readonly "index"?: __schema11 -} -export const __schema20 = Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("reasoning.summary"), - "summary": Schema.String, - "id": Schema.optionalKey(__schema21), - "format": Schema.optionalKey(__schema22), - "index": Schema.optionalKey(__schema11) - }), - Schema.Struct({ - "type": Schema.Literal("reasoning.encrypted"), - "data": Schema.String, - "id": Schema.optionalKey(__schema21), - "format": Schema.optionalKey(__schema22), - "index": Schema.optionalKey(__schema11) - }), - Schema.Struct({ - "type": Schema.Literal("reasoning.text"), - "text": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "signature": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "id": Schema.optionalKey(__schema21), - "format": Schema.optionalKey(__schema22), - "index": Schema.optionalKey(__schema11) - }) -], { mode: "oneOf" }) -export type __schema14 = __schema11 | ModelName | __schema13 -export const __schema14 = Schema.Union([__schema11, ModelName, __schema13]) -export type ChatMessageTokenLogprobs = { - readonly "content": ReadonlyArray | null - readonly "refusal": ReadonlyArray | null -} -export const ChatMessageTokenLogprobs = Schema.Struct({ - "content": Schema.Union([Schema.Array(ChatMessageTokenLogprob), Schema.Null]), - "refusal": Schema.Union([Schema.Array(ChatMessageTokenLogprob), Schema.Null]) -}) -export type __schema26 = ChatCompletionFinishReason | null -export const __schema26 = Schema.Union([ChatCompletionFinishReason, Schema.Null]) -export type ResponseFormatJSONSchema = { readonly "type": "json_schema"; readonly "json_schema": JSONSchemaConfig } -export const ResponseFormatJSONSchema = Schema.Struct({ - "type": Schema.Literal("json_schema"), - "json_schema": JSONSchemaConfig -}) -export type ChatMessageContentItemText = { - readonly "type": "text" - readonly "text": string - readonly "cache_control"?: ChatMessageContentItemCacheControl -} -export const ChatMessageContentItemText = Schema.Struct({ - "type": Schema.Literal("text"), - "text": Schema.String, - "cache_control": Schema.optionalKey(ChatMessageContentItemCacheControl) -}) -export type ToolDefinitionJson = { - readonly "type": "function" - readonly "function": { - readonly "name": string - readonly "description"?: string - readonly "parameters"?: {} - readonly "strict"?: boolean | null - } - readonly "cache_control"?: ChatMessageContentItemCacheControl -} -export const ToolDefinitionJson = Schema.Struct({ - "type": Schema.Literal("function"), - "function": Schema.Struct({ - "name": Schema.String.check(Schema.isMaxLength(64)), - "description": Schema.optionalKey(Schema.String), - "parameters": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))), - "strict": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])) - }), - "cache_control": Schema.optionalKey(ChatMessageContentItemCacheControl) -}) -export type ToolChoiceOption = "none" | "auto" | "required" | NamedToolChoice -export const ToolChoiceOption = Schema.Union([ - Schema.Literal("none"), - Schema.Literal("auto"), - Schema.Literal("required"), - NamedToolChoice -]) export type ResponseOutputText = { readonly "type": "output_text" readonly "text": string @@ -3688,22 +3625,6 @@ export const OpenResponsesOutputTextAnnotationAddedEvent = Schema.Struct({ "annotation_index": Schema.Number.check(Schema.isFinite()), "annotation": OpenAIResponsesAnnotation }).annotate({ "description": "Event emitted when a text annotation is added to output" }) -export type ResponseTextConfig = { - readonly "format"?: ResponseFormatTextConfig - readonly "verbosity"?: "high" | "low" | "medium" -} -export const ResponseTextConfig = Schema.Struct({ - "format": Schema.optionalKey(ResponseFormatTextConfig), - "verbosity": Schema.optionalKey(Schema.Literals(["high", "low", "medium"])) -}).annotate({ "description": "Text output configuration including format and verbosity" }) -export type OpenResponsesResponseText = { - readonly "format"?: ResponseFormatTextConfig - readonly "verbosity"?: "high" | "low" | "medium" -} -export const OpenResponsesResponseText = Schema.Struct({ - "format": Schema.optionalKey(ResponseFormatTextConfig), - "verbosity": Schema.optionalKey(Schema.Literals(["high", "low", "medium"])) -}).annotate({ "description": "Text output configuration including format and verbosity" }) export type OpenResponsesTextDeltaEvent = { readonly "type": "response.output_text.delta" readonly "logprobs": ReadonlyArray @@ -3740,8 +3661,6 @@ export const OpenResponsesTextDoneEvent = Schema.Struct({ "sequence_number": Schema.Number.check(Schema.isFinite()), "logprobs": Schema.Array(OpenResponsesLogProbs) }).annotate({ "description": "Event emitted when text streaming is complete" }) -export type ProviderSortUnion = ProviderSort | ProviderSortConfig -export const ProviderSortUnion = Schema.Union([ProviderSort, ProviderSortConfig]) export type ProviderPreferences = { readonly "allow_fallbacks"?: boolean readonly "require_parameters"?: boolean @@ -3810,19 +3729,34 @@ export const ProviderPreferences = Schema.Struct({ ), "sort": Schema.optionalKey( Schema.Union([ - Schema.Union([Schema.Literal("price"), Schema.Literal("price")]).annotate({ + Schema.Union([ + Schema.Literal("price").annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }), + Schema.Literal("price") + ]).annotate({ "description": "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." }), - Schema.Union([Schema.Literal("throughput"), Schema.Literal("throughput")]).annotate({ + Schema.Union([ + Schema.Literal("throughput").annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }), + Schema.Literal("throughput") + ]).annotate({ "description": "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." }), - Schema.Union([Schema.Literal("latency"), Schema.Literal("latency")]).annotate({ + Schema.Union([ + Schema.Literal("latency").annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }), + Schema.Literal("latency") + ]).annotate({ "description": "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." }) - ]) + ]).annotate({ "description": "The provider sorting strategy (price, throughput, latency)" }) ), "max_price": Schema.optionalKey( Schema.Struct({ @@ -4172,19 +4106,34 @@ export const AnthropicMessagesRequest = Schema.Struct({ ), "sort": Schema.optionalKey( Schema.Union([ - Schema.Union([Schema.Literal("price"), Schema.Literal("price")]).annotate({ + Schema.Union([ + Schema.Literal("price").annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }), + Schema.Literal("price") + ]).annotate({ "description": "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." }), - Schema.Union([Schema.Literal("throughput"), Schema.Literal("throughput")]).annotate({ + Schema.Union([ + Schema.Literal("throughput").annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }), + Schema.Literal("throughput") + ]).annotate({ "description": "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." }), - Schema.Union([Schema.Literal("latency"), Schema.Literal("latency")]).annotate({ + Schema.Union([ + Schema.Literal("latency").annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }), + Schema.Literal("latency") + ]).annotate({ "description": "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." }) - ]) + ]).annotate({ "description": "The provider sorting strategy (price, throughput, latency)" }) ), "max_price": Schema.optionalKey( Schema.Struct({ @@ -4288,6 +4237,62 @@ export const AnthropicMessagesRequest = Schema.Struct({ "models": Schema.optionalKey(Schema.Array(Schema.String)), "output_config": Schema.optionalKey(AnthropicOutputConfig) }).annotate({ "description": "Request schema for Anthropic Messages API endpoint" }) +export type SystemMessage = { + readonly "role": "system" + readonly "content": string | ReadonlyArray + readonly "name"?: string +} +export const SystemMessage = Schema.Struct({ + "role": Schema.Literal("system"), + "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItemText)]).annotate({ + "description": "System message content" + }), + "name": Schema.optionalKey(Schema.String.annotate({ "description": "Optional name for the system message" })) +}).annotate({ "description": "System message for setting behavior" }) +export type DeveloperMessage = { + readonly "role": "developer" + readonly "content": string | ReadonlyArray + readonly "name"?: string +} +export const DeveloperMessage = Schema.Struct({ + "role": Schema.Literal("developer"), + "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItemText)]).annotate({ + "description": "Developer message content" + }), + "name": Schema.optionalKey(Schema.String.annotate({ "description": "Optional name for the developer message" })) +}).annotate({ "description": "Developer message" }) +export type ChatMessageContentItem = + | ChatMessageContentItemText + | ChatMessageContentItemImage + | ChatMessageContentItemAudio + | ChatMessageContentItemVideoLegacy + | ChatMessageContentItemVideo +export const ChatMessageContentItem = Schema.Union([ + ChatMessageContentItemText, + ChatMessageContentItemImage, + ChatMessageContentItemAudio, + Schema.Union([ChatMessageContentItemVideoLegacy, ChatMessageContentItemVideo], { mode: "oneOf" }) +], { mode: "oneOf" }).annotate({ "description": "Content part for chat completion messages" }) +export type AssistantMessageReasoningDetails = ReadonlyArray +export const AssistantMessageReasoningDetails = Schema.Array(ReasoningDetailUnion).annotate({ + "description": "Reasoning details for extended thinking models" +}) +export type ResponseTextConfig = { + readonly "format"?: ResponseFormatTextConfig + readonly "verbosity"?: "high" | "low" | "medium" +} +export const ResponseTextConfig = Schema.Struct({ + "format": Schema.optionalKey(ResponseFormatTextConfig), + "verbosity": Schema.optionalKey(Schema.Literals(["high", "low", "medium"])) +}).annotate({ "description": "Text output configuration including format and verbosity" }) +export type OpenResponsesResponseText = { + readonly "format"?: ResponseFormatTextConfig + readonly "verbosity"?: "high" | "low" | "medium" +} +export const OpenResponsesResponseText = Schema.Struct({ + "format": Schema.optionalKey(ResponseFormatTextConfig), + "verbosity": Schema.optionalKey(Schema.Literals(["high", "low", "medium"])) +}).annotate({ "description": "Text output configuration including format and verbosity" }) export type Model = { readonly "id": string readonly "canonical_slug": string @@ -4462,117 +4467,6 @@ export const ListEndpointsResponse = Schema.Struct({ }).annotate({ "description": "Model architecture information" }), "endpoints": Schema.Array(PublicEndpoint).annotate({ "description": "List of available endpoints for this model" }) }).annotate({ "description": "List of available endpoints for a model" }) -export type ChatStreamingMessageChunk = { - readonly "role"?: "assistant" - readonly "content"?: string | null - readonly "reasoning"?: string | null - readonly "refusal"?: string | null - readonly "tool_calls"?: ReadonlyArray - readonly "reasoning_details"?: ReadonlyArray<__schema20> - readonly "images"?: - | ReadonlyArray<{ readonly "type": "image_url"; readonly "image_url": { readonly "url": string } }> - | null - readonly "annotations"?: - | ReadonlyArray< - { - readonly "type": "url_citation" - readonly "url_citation": { - readonly "url": string - readonly "title"?: string - readonly "start_index"?: number - readonly "end_index"?: number - readonly "content"?: string - } - } | { - readonly "type": "file_annotation" - readonly "file_annotation": { readonly "file_id": string; readonly "quote"?: string } - } | { - readonly "type": "file" - readonly "file": { - readonly "hash": string - readonly "name": string - readonly "content"?: ReadonlyArray<{ readonly "type": string; readonly "text"?: string }> - } - } - > - | null -} -export const ChatStreamingMessageChunk = Schema.Struct({ - "role": Schema.optionalKey(Schema.Literal("assistant")), - "content": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "reasoning": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "refusal": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "tool_calls": Schema.optionalKey(Schema.Array(ChatStreamingMessageToolCall)), - "reasoning_details": Schema.optionalKey(Schema.Array(__schema20)), - "images": Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ "type": Schema.Literal("image_url"), "image_url": Schema.Struct({ "url": Schema.String }) }) - ), - Schema.Null - ]) - ), - "annotations": Schema.optionalKey(Schema.Union([ - Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("url_citation"), - "url_citation": Schema.Struct({ - "url": Schema.String, - "title": Schema.optionalKey(Schema.String), - "start_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "end_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "content": Schema.optionalKey(Schema.String) - }) - }), - Schema.Struct({ - "type": Schema.Literal("file_annotation"), - "file_annotation": Schema.Struct({ "file_id": Schema.String, "quote": Schema.optionalKey(Schema.String) }) - }), - Schema.Struct({ - "type": Schema.Literal("file"), - "file": Schema.Struct({ - "hash": Schema.String, - "name": Schema.String, - "content": Schema.optionalKey( - Schema.Array(Schema.Struct({ "type": Schema.String, "text": Schema.optionalKey(Schema.String) })) - ) - }) - }) - ], { mode: "oneOf" })), - Schema.Null - ])) -}) -export type ChatMessageContentItem = - | ChatMessageContentItemText - | ChatMessageContentItemImage - | ChatMessageContentItemAudio - | ChatMessageContentItemVideo -export const ChatMessageContentItem = Schema.Union([ - ChatMessageContentItemText, - ChatMessageContentItemImage, - ChatMessageContentItemAudio, - ChatMessageContentItemVideo -], { mode: "oneOf" }) -export type SystemMessage = { - readonly "role": "system" - readonly "content": string | ReadonlyArray - readonly "name"?: string -} -export const SystemMessage = Schema.Struct({ - "role": Schema.Literal("system"), - "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItemText)]), - "name": Schema.optionalKey(Schema.String) -}) -export type DeveloperMessage = { - readonly "role": "developer" - readonly "content": string | ReadonlyArray - readonly "name"?: string -} -export const DeveloperMessage = Schema.Struct({ - "role": Schema.Literal("developer"), - "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItemText)]), - "name": Schema.optionalKey(Schema.String) -}) export type OutputMessage = { readonly "id": string readonly "role": "assistant" @@ -4633,20 +4527,6 @@ export const OpenResponsesContentPartDoneEvent = Schema.Struct({ "part": Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent]), "sequence_number": Schema.Number.check(Schema.isFinite()) }).annotate({ "description": "Event emitted when a content part is complete" }) -export type ModelsListResponseData = ReadonlyArray -export const ModelsListResponseData = Schema.Array(Model).annotate({ "description": "List of available models" }) -export type ChatStreamingChoice = { - readonly "delta": ChatStreamingMessageChunk - readonly "finish_reason"?: __schema26 - readonly "index": number - readonly "logprobs"?: ChatMessageTokenLogprobs | null -} -export const ChatStreamingChoice = Schema.Struct({ - "delta": ChatStreamingMessageChunk, - "finish_reason": Schema.optionalKey(__schema26), - "index": Schema.Number.check(Schema.isFinite()), - "logprobs": Schema.optionalKey(Schema.Union([ChatMessageTokenLogprobs, Schema.Null])) -}) export type UserMessage = { readonly "role": "user" readonly "content": string | ReadonlyArray @@ -4654,17 +4534,120 @@ export type UserMessage = { } export const UserMessage = Schema.Struct({ "role": Schema.Literal("user"), - "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItem)]), - "name": Schema.optionalKey(Schema.String) -}) + "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItem)]).annotate({ + "description": "User message content" + }), + "name": Schema.optionalKey(Schema.String.annotate({ "description": "Optional name for the user" })) +}).annotate({ "description": "User message" }) +export type ToolResponseMessage = { + readonly "role": "tool" + readonly "content": string | ReadonlyArray + readonly "tool_call_id": string +} +export const ToolResponseMessage = Schema.Struct({ + "role": Schema.Literal("tool"), + "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItem)]).annotate({ + "description": "Tool response content" + }), + "tool_call_id": Schema.String.annotate({ + "description": "ID of the assistant message tool call this message responds to" + }) +}).annotate({ "description": "Tool response message" }) export type AssistantMessage = { readonly "role": "assistant" - readonly "content"?: string | ReadonlyArray | null + readonly "content"?: string | ReadonlyArray | unknown readonly "name"?: string readonly "tool_calls"?: ReadonlyArray - readonly "refusal"?: string | null - readonly "reasoning"?: string | null - readonly "reasoning_details"?: ReadonlyArray<__schema20> + readonly "refusal"?: string + readonly "reasoning"?: string + readonly "reasoning_details"?: AssistantMessageReasoningDetails + readonly "images"?: + | ReadonlyArray<{ readonly "type": "image_url"; readonly "image_url": { readonly "url": string } }> + | null + readonly "annotations"?: + | ReadonlyArray< + { + readonly "type": "url_citation" + readonly "url_citation": { + readonly "url": string + readonly "title"?: string + readonly "start_index"?: number + readonly "end_index"?: number + readonly "content"?: string + } + } | { + readonly "type": "file_annotation" + readonly "file_annotation": { readonly "file_id": string; readonly "quote"?: string } + } | { + readonly "type": "file" + readonly "file": { + readonly "hash": string + readonly "name": string + readonly "content"?: ReadonlyArray<{ readonly "type": string; readonly "text"?: string }> + } + } + > + | null +} +export const AssistantMessage = Schema.Struct({ + "role": Schema.Literal("assistant"), + "content": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Array(ChatMessageContentItem), Schema.Unknown]).annotate({ + "description": "Assistant message content" + }) + ), + "name": Schema.optionalKey(Schema.String.annotate({ "description": "Optional name for the assistant" })), + "tool_calls": Schema.optionalKey( + Schema.Array(ChatMessageToolCall).annotate({ "description": "Tool calls made by the assistant" }) + ), + "refusal": Schema.optionalKey(Schema.String.annotate({ "description": "Refusal message if content was refused" })), + "reasoning": Schema.optionalKey(Schema.String.annotate({ "description": "Reasoning output" })), + "reasoning_details": Schema.optionalKey(AssistantMessageReasoningDetails), + "images": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Struct({ "type": Schema.Literal("image_url"), "image_url": Schema.Struct({ "url": Schema.String }) }) + ), + Schema.Null + ]) + ), + "annotations": Schema.optionalKey(Schema.Union([ + Schema.Array(Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("url_citation"), + "url_citation": Schema.Struct({ + "url": Schema.String, + "title": Schema.optionalKey(Schema.String), + "start_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), + "end_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), + "content": Schema.optionalKey(Schema.String) + }) + }), + Schema.Struct({ + "type": Schema.Literal("file_annotation"), + "file_annotation": Schema.Struct({ "file_id": Schema.String, "quote": Schema.optionalKey(Schema.String) }) + }), + Schema.Struct({ + "type": Schema.Literal("file"), + "file": Schema.Struct({ + "hash": Schema.String, + "name": Schema.String, + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.String, "text": Schema.optionalKey(Schema.String) })) + ) + }) + }) + ], { mode: "oneOf" })), + Schema.Null + ])) +}).annotate({ "description": "Assistant message for requests and responses" }) +export type ChatStreamingMessageChunk = { + readonly "role"?: "assistant" + readonly "content"?: string + readonly "reasoning"?: string + readonly "refusal"?: string + readonly "tool_calls"?: ReadonlyArray + readonly "reasoning_details"?: AssistantMessageReasoningDetails readonly "images"?: | ReadonlyArray<{ readonly "type": "image_url"; readonly "image_url": { readonly "url": string } }> | null @@ -4693,16 +4676,15 @@ export type AssistantMessage = { > | null } -export const AssistantMessage = Schema.Struct({ - "role": Schema.Literal("assistant"), - "content": Schema.optionalKey( - Schema.Union([Schema.Union([Schema.String, Schema.Array(ChatMessageContentItem)]), Schema.Null]) +export const ChatStreamingMessageChunk = Schema.Struct({ + "role": Schema.optionalKey(Schema.Literal("assistant").annotate({ "description": "The role of the message author" })), + "content": Schema.optionalKey(Schema.String.annotate({ "description": "Message content delta" })), + "reasoning": Schema.optionalKey(Schema.String.annotate({ "description": "Reasoning content delta" })), + "refusal": Schema.optionalKey(Schema.String.annotate({ "description": "Refusal message delta" })), + "tool_calls": Schema.optionalKey( + Schema.Array(ChatStreamingMessageToolCall).annotate({ "description": "Tool calls delta" }) ), - "name": Schema.optionalKey(Schema.String), - "tool_calls": Schema.optionalKey(Schema.Array(ChatMessageToolCall)), - "refusal": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "reasoning": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "reasoning_details": Schema.optionalKey(Schema.Array(__schema20)), + "reasoning_details": Schema.optionalKey(AssistantMessageReasoningDetails), "images": Schema.optionalKey( Schema.Union([ Schema.Array( @@ -4740,17 +4722,9 @@ export const AssistantMessage = Schema.Struct({ ], { mode: "oneOf" })), Schema.Null ])) -}) -export type ToolResponseMessage = { - readonly "role": "tool" - readonly "content": string | ReadonlyArray - readonly "tool_call_id": string -} -export const ToolResponseMessage = Schema.Struct({ - "role": Schema.Literal("tool"), - "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItem)]), - "tool_call_id": Schema.String -}) +}).annotate({ "description": "Delta changes in streaming response" }) +export type ModelsListResponseData = ReadonlyArray +export const ModelsListResponseData = Schema.Array(Model).annotate({ "description": "List of available models" }) export type OpenAIResponsesInput = | string | ReadonlyArray< @@ -4912,48 +4886,18 @@ export const OpenResponsesInput = Schema.Union([ ]) ) ]).annotate({ "description": "Input for a response request - can be a string or array of items" }) -export type ModelsListResponse = { readonly "data": ModelsListResponseData } -export const ModelsListResponse = Schema.Struct({ "data": ModelsListResponseData }).annotate({ - "description": "List of available models" -}) -export type ChatStreamingResponseChunk = { - readonly "data": { - readonly "id": string - readonly "choices": ReadonlyArray - readonly "created": number - readonly "model": string - readonly "object": "chat.completion.chunk" - readonly "system_fingerprint"?: string | null - readonly "error"?: { readonly "message": string; readonly "code": number } - readonly "usage"?: ChatGenerationTokenUsage - } -} -export const ChatStreamingResponseChunk = Schema.Struct({ - "data": Schema.Struct({ - "id": Schema.String, - "choices": Schema.Array(ChatStreamingChoice), - "created": Schema.Number.check(Schema.isFinite()), - "model": Schema.String, - "object": Schema.Literal("chat.completion.chunk"), - "system_fingerprint": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "error": Schema.optionalKey( - Schema.Struct({ "message": Schema.String, "code": Schema.Number.check(Schema.isFinite()) }) - ), - "usage": Schema.optionalKey(ChatGenerationTokenUsage) - }) -}) export type ChatResponseChoice = { - readonly "finish_reason": __schema26 + readonly "finish_reason": ChatCompletionFinishReason | unknown | unknown readonly "index": number readonly "message": AssistantMessage - readonly "logprobs"?: ChatMessageTokenLogprobs | null + readonly "logprobs"?: ChatMessageTokenLogprobs } export const ChatResponseChoice = Schema.Struct({ - "finish_reason": __schema26, - "index": Schema.Number.check(Schema.isFinite()), + "finish_reason": Schema.Union([ChatCompletionFinishReason, Schema.Unknown, Schema.Unknown]), + "index": Schema.Number.annotate({ "description": "Choice index" }).check(Schema.isFinite()), "message": AssistantMessage, - "logprobs": Schema.optionalKey(Schema.Union([ChatMessageTokenLogprobs, Schema.Null])) -}) + "logprobs": Schema.optionalKey(ChatMessageTokenLogprobs) +}).annotate({ "description": "Chat completion choice" }) export type Message = SystemMessage | UserMessage | DeveloperMessage | AssistantMessage | ToolResponseMessage export const Message = Schema.Union([ SystemMessage, @@ -4961,7 +4905,23 @@ export const Message = Schema.Union([ DeveloperMessage, AssistantMessage, ToolResponseMessage -], { mode: "oneOf" }) +], { mode: "oneOf" }).annotate({ "description": "Chat completion message with role-based discrimination" }) +export type ChatStreamingChoice = { + readonly "delta": ChatStreamingMessageChunk + readonly "finish_reason"?: ChatCompletionFinishReason | unknown | unknown + readonly "index": number + readonly "logprobs"?: ChatMessageTokenLogprobs +} +export const ChatStreamingChoice = Schema.Struct({ + "delta": ChatStreamingMessageChunk, + "finish_reason": Schema.optionalKey(Schema.Union([ChatCompletionFinishReason, Schema.Unknown, Schema.Unknown])), + "index": Schema.Number.annotate({ "description": "Choice index" }).check(Schema.isFinite()), + "logprobs": Schema.optionalKey(ChatMessageTokenLogprobs) +}).annotate({ "description": "Streaming completion choice chunk" }) +export type ModelsListResponse = { readonly "data": ModelsListResponseData } +export const ModelsListResponse = Schema.Struct({ "data": ModelsListResponseData }).annotate({ + "description": "List of available models" +}) export type OpenAIResponsesNonStreamingResponse = { readonly "id": string readonly "object": "response" @@ -5338,7 +5298,7 @@ export type OpenResponsesNonStreamingResponse = { } | { readonly "type": never readonly "id": string - readonly "content"?: ReadonlyArray + readonly "content"?: ReadonlyArray<{ readonly "type": "reasoning_text"; readonly "text": string }> readonly "summary": ReadonlyArray readonly "encrypted_content"?: string readonly "status"?: "completed" | "incomplete" | "in_progress" @@ -5392,7 +5352,7 @@ export type OpenResponsesNonStreamingResponse = { } | { readonly "type": never readonly "id": string - readonly "content"?: ReadonlyArray + readonly "content"?: ReadonlyArray<{ readonly "type": "reasoning_text"; readonly "text": string }> readonly "summary": ReadonlyArray readonly "encrypted_content"?: string readonly "status": "completed" | "in_progress" @@ -5435,7 +5395,7 @@ export type OpenResponsesNonStreamingResponse = { } | { readonly "type": never readonly "id": string - readonly "content"?: ReadonlyArray + readonly "content"?: ReadonlyArray<{ readonly "type": "reasoning_text"; readonly "text": string }> readonly "summary": ReadonlyArray readonly "encrypted_content"?: string readonly "status": "completed" | "in_progress" @@ -5482,7 +5442,7 @@ export type OpenResponsesNonStreamingResponse = { } | { readonly "type": never readonly "id": string - readonly "content"?: ReadonlyArray + readonly "content"?: ReadonlyArray<{ readonly "type": "reasoning_text"; readonly "text": string }> readonly "summary": ReadonlyArray readonly "encrypted_content"?: string readonly "status": "completed" | "in_progress" @@ -5921,7 +5881,9 @@ export const OpenResponsesNonStreamingResponse = Schema.Struct({ Schema.Struct({ "type": Schema.Never, "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("reasoning_text"), "text": Schema.String })) + ), "summary": Schema.Array(ReasoningSummaryText), "encrypted_content": Schema.optionalKey(Schema.String), "status": Schema.optionalKey( @@ -5992,7 +5954,9 @@ export const OpenResponsesNonStreamingResponse = Schema.Struct({ Schema.Struct({ "type": Schema.Never, "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("reasoning_text"), "text": Schema.String })) + ), "summary": Schema.Array(ReasoningSummaryText), "encrypted_content": Schema.optionalKey(Schema.String), "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), @@ -6058,7 +6022,9 @@ export const OpenResponsesNonStreamingResponse = Schema.Struct({ Schema.Struct({ "type": Schema.Never, "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("reasoning_text"), "text": Schema.String })) + ), "summary": Schema.Array(ReasoningSummaryText), "encrypted_content": Schema.optionalKey(Schema.String), "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), @@ -6128,7 +6094,9 @@ export const OpenResponsesNonStreamingResponse = Schema.Struct({ Schema.Struct({ "type": Schema.Never, "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("reasoning_text"), "text": Schema.String })) + ), "summary": Schema.Array(ReasoningSummaryText), "encrypted_content": Schema.optionalKey(Schema.String), "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), @@ -6553,40 +6521,46 @@ export const OpenResponsesRequest = Schema.Struct({ }) ) }).annotate({ "description": "Request schema for Responses endpoint" }) +export type ChatResponse = { + readonly "id": string + readonly "choices": ReadonlyArray + readonly "created": number + readonly "model": string + readonly "object": "chat.completion" + readonly "system_fingerprint"?: string + readonly "usage"?: ChatGenerationTokenUsage +} +export const ChatResponse = Schema.Struct({ + "id": Schema.String.annotate({ "description": "Unique completion identifier" }), + "choices": Schema.Array(ChatResponseChoice).annotate({ "description": "List of completion choices" }), + "created": Schema.Number.annotate({ "description": "Unix timestamp of creation" }).check(Schema.isFinite()), + "model": Schema.String.annotate({ "description": "Model used for completion" }), + "object": Schema.Literal("chat.completion"), + "system_fingerprint": Schema.optionalKey(Schema.String.annotate({ "description": "System fingerprint" })), + "usage": Schema.optionalKey(ChatGenerationTokenUsage) +}).annotate({ "description": "Chat completion response" }) export type ChatGenerationParams = { readonly "provider"?: { - readonly "allow_fallbacks"?: boolean | null - readonly "require_parameters"?: boolean | null - readonly "data_collection"?: "deny" | "allow" | null - readonly "zdr"?: boolean | null - readonly "enforce_distillable_text"?: boolean | null - readonly "order"?: __schema5 | null - readonly "only"?: __schema5 | null - readonly "ignore"?: __schema5 | null - readonly "quantizations"?: - | ReadonlyArray<"int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown"> - | null - readonly "sort"?: ProviderSortUnion | null + readonly "allow_fallbacks"?: boolean + readonly "require_parameters"?: boolean + readonly "data_collection"?: DataCollection + readonly "zdr"?: boolean + readonly "enforce_distillable_text"?: boolean + readonly "order"?: ReadonlyArray + readonly "only"?: ReadonlyArray + readonly "ignore"?: ReadonlyArray + readonly "quantizations"?: ReadonlyArray + readonly "sort"?: "price" | "price" | "throughput" | "throughput" | "latency" | "latency" readonly "max_price"?: { - readonly "prompt"?: __schema11 | ModelName | __schema13 - readonly "completion"?: __schema11 | ModelName | __schema13 - readonly "image"?: __schema14 - readonly "audio"?: __schema14 - readonly "request"?: __schema14 + readonly "prompt"?: BigNumberUnion + readonly "completion"?: string + readonly "image"?: string + readonly "audio"?: string + readonly "request"?: string } - readonly "preferred_min_throughput"?: number | { - readonly "p50"?: number | null - readonly "p75"?: number | null - readonly "p90"?: number | null - readonly "p99"?: number | null - } | null - readonly "preferred_max_latency"?: number | { - readonly "p50"?: number | null - readonly "p75"?: number | null - readonly "p90"?: number | null - readonly "p99"?: number | null - } | null - } | null + readonly "preferred_min_throughput"?: PreferredMinThroughput + readonly "preferred_max_latency"?: PreferredMaxLatency + } readonly "plugins"?: ReadonlyArray< | { readonly "id": "auto-router"; readonly "enabled"?: boolean; readonly "allowed_models"?: ReadonlyArray } | { readonly "id": "moderation" } @@ -6595,16 +6569,12 @@ export type ChatGenerationParams = { readonly "enabled"?: boolean readonly "max_results"?: number readonly "search_prompt"?: string - readonly "engine"?: "native" | "exa" - } - | { - readonly "id": "file-parser" - readonly "enabled"?: boolean - readonly "pdf"?: { readonly "engine"?: "mistral-ocr" | "pdf-text" | "native" } + readonly "engine"?: WebSearchEngine } + | { readonly "id": "file-parser"; readonly "enabled"?: boolean; readonly "pdf"?: PDFParserOptions } | { readonly "id": "response-healing"; readonly "enabled"?: boolean } > - readonly "route"?: "fallback" | "sort" | null + readonly "route"?: "fallback" | "sort" readonly "user"?: string readonly "session_id"?: string readonly "trace"?: { @@ -6616,173 +6586,194 @@ export type ChatGenerationParams = { } readonly "messages": ReadonlyArray readonly "model"?: ModelName - readonly "models"?: ReadonlyArray - readonly "frequency_penalty"?: number | null - readonly "logit_bias"?: {} | null - readonly "logprobs"?: boolean | null - readonly "top_logprobs"?: number | null - readonly "max_completion_tokens"?: number | null - readonly "max_tokens"?: number | null + readonly "models"?: ModelNames + readonly "frequency_penalty"?: number + readonly "logit_bias"?: {} + readonly "logprobs"?: boolean + readonly "top_logprobs"?: number + readonly "max_completion_tokens"?: number + readonly "max_tokens"?: number readonly "metadata"?: {} - readonly "presence_penalty"?: number | null + readonly "presence_penalty"?: number readonly "reasoning"?: { - readonly "effort"?: "xhigh" | "high" | "medium" | "low" | "minimal" | "none" | null - readonly "summary"?: ReasoningSummaryVerbosity | null + readonly "effort"?: "xhigh" | "high" | "medium" | "low" | "minimal" | "none" + readonly "summary"?: ReasoningSummaryVerbosity | unknown | unknown } readonly "response_format"?: - | { readonly "type": "text" } - | { readonly "type": "json_object" } + | ResponseFormatText + | ResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar - | { readonly "type": "python" } - readonly "seed"?: number | null - readonly "stop"?: string | ReadonlyArray | null + | ResponseFormatTextPython + readonly "seed"?: number + readonly "stop"?: string | ReadonlyArray | unknown readonly "stream"?: boolean - readonly "stream_options"?: ChatStreamOptions | null - readonly "temperature"?: number | null - readonly "parallel_tool_calls"?: boolean | null + readonly "stream_options"?: ChatStreamOptions + readonly "temperature"?: number + readonly "parallel_tool_calls"?: boolean readonly "tool_choice"?: ToolChoiceOption readonly "tools"?: ReadonlyArray - readonly "top_p"?: number | null - readonly "debug"?: { readonly "echo_upstream_body"?: boolean } + readonly "top_p"?: number + readonly "debug"?: DebugOptions readonly "image_config"?: {} readonly "modalities"?: ReadonlyArray<"text" | "image"> } export const ChatGenerationParams = Schema.Struct({ "provider": Schema.optionalKey( - Schema.Union([ - Schema.Struct({ - "allow_fallbacks": Schema.optionalKey( - Schema.Union([Schema.Boolean, Schema.Null]).annotate({ - "description": - "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" - }) - ), - "require_parameters": Schema.optionalKey( - Schema.Union([Schema.Boolean, Schema.Null]).annotate({ - "description": - "Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest." - }) - ), - "data_collection": Schema.optionalKey( - Schema.Union([Schema.Literals(["deny", "allow"]), Schema.Null]).annotate({ + Schema.Struct({ + "allow_fallbacks": Schema.optionalKey(Schema.Boolean.annotate({ + "description": + "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" + })), + "require_parameters": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest." + }) + ), + "data_collection": Schema.optionalKey(DataCollection), + "zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used." + }) + ), + "enforce_distillable_text": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used." + }) + ), + "order": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message." + }) + ), + "only": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request." + }) + ), + "ignore": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request." + }) + ), + "quantizations": Schema.optionalKey( + Schema.Array(Quantization).annotate({ + "description": "A list of quantization levels to filter the provider by." + }) + ), + "sort": Schema.optionalKey( + Schema.Union([ + Schema.Union([ + Schema.Literal("price").annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }), + Schema.Literal("price") + ]).annotate({ "description": - "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." - }) - ), - "zdr": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - "enforce_distillable_text": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - "order": Schema.optionalKey( - Schema.Union([__schema5, Schema.Null]).annotate({ + "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." + }), + Schema.Union([ + Schema.Literal("throughput").annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }), + Schema.Literal("throughput") + ]).annotate({ "description": - "An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message." - }) - ), - "only": Schema.optionalKey( - Schema.Union([__schema5, Schema.Null]).annotate({ + "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." + }), + Schema.Union([ + Schema.Literal("latency").annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" + }), + Schema.Literal("latency") + ]).annotate({ "description": - "List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request." + "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." }) - ), - "ignore": Schema.optionalKey( - Schema.Union([__schema5, Schema.Null]).annotate({ - "description": - "List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request." + ]).annotate({ "description": "The provider sorting strategy (price, throughput, latency)" }) + ), + "max_price": Schema.optionalKey( + Schema.Struct({ + "prompt": Schema.optionalKey(BigNumberUnion), + "completion": Schema.optionalKey( + Schema.String.annotate({ "description": "Price per million completion tokens" }) + ), + "image": Schema.optionalKey(Schema.String.annotate({ "description": "Price per image" })), + "audio": Schema.optionalKey(Schema.String.annotate({ "description": "Price per audio unit" })), + "request": Schema.optionalKey(Schema.String.annotate({ "description": "Price per request" })) + }).annotate({ + "description": + "The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion." + }) + ), + "preferred_min_throughput": Schema.optionalKey(PreferredMinThroughput), + "preferred_max_latency": Schema.optionalKey(PreferredMaxLatency) + }).annotate({ + "description": "When multiple model providers are available, optionally indicate your routing preference." + }) + ), + "plugins": Schema.optionalKey( + Schema.Array(Schema.Union([ + Schema.Struct({ + "id": Schema.Literal("auto-router"), + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the auto-router plugin for this request. Defaults to true." }) ), - "quantizations": Schema.optionalKey( - Schema.Union([ - Schema.Array(Schema.Literals(["int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown"])), - Schema.Null - ]).annotate({ "description": "A list of quantization levels to filter the provider by." }) - ), - "sort": Schema.optionalKey( - Schema.Union([ProviderSortUnion, Schema.Null]).annotate({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": - "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." + "List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list." }) - ), - "max_price": Schema.optionalKey( - Schema.Struct({ - "prompt": Schema.optionalKey(Schema.Union([__schema11, ModelName, __schema13])), - "completion": Schema.optionalKey(Schema.Union([__schema11, ModelName, __schema13])), - "image": Schema.optionalKey(__schema14), - "audio": Schema.optionalKey(__schema14), - "request": Schema.optionalKey(__schema14) - }).annotate({ - "description": - "The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion." + ) + }), + Schema.Struct({ "id": Schema.Literal("moderation") }), + Schema.Struct({ + "id": Schema.Literal("web"), + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the web-search plugin for this request. Defaults to true." }) ), - "preferred_min_throughput": Schema.optionalKey( - Schema.Union([ - Schema.Union([ - Schema.Number.check(Schema.isFinite()), - Schema.Struct({ - "p50": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p75": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p90": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p99": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])) - }) - ]), - Schema.Null - ]).annotate({ - "description": - "Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold." + "max_results": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), + "search_prompt": Schema.optionalKey(Schema.String), + "engine": Schema.optionalKey(WebSearchEngine) + }), + Schema.Struct({ + "id": Schema.Literal("file-parser"), + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the file-parser plugin for this request. Defaults to true." }) ), - "preferred_max_latency": Schema.optionalKey( - Schema.Union([ - Schema.Union([ - Schema.Number.check(Schema.isFinite()), - Schema.Struct({ - "p50": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p75": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p90": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p99": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])) - }) - ]), - Schema.Null - ]).annotate({ - "description": - "Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold." + "pdf": Schema.optionalKey(PDFParserOptions) + }), + Schema.Struct({ + "id": Schema.Literal("response-healing"), + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the response-healing plugin for this request. Defaults to true." }) ) - }), - Schema.Null - ]).annotate({ - "description": "When multiple model providers are available, optionally indicate your routing preference." + }) + ], { mode: "oneOf" })).annotate({ + "description": "Plugins you want to enable for this request, including their settings." }) ), - "plugins": Schema.optionalKey( - Schema.Array( - Schema.Union([ - Schema.Struct({ - "id": Schema.Literal("auto-router"), - "enabled": Schema.optionalKey(Schema.Boolean), - "allowed_models": Schema.optionalKey(Schema.Array(Schema.String)) - }), - Schema.Struct({ "id": Schema.Literal("moderation") }), - Schema.Struct({ - "id": Schema.Literal("web"), - "enabled": Schema.optionalKey(Schema.Boolean), - "max_results": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "search_prompt": Schema.optionalKey(Schema.String), - "engine": Schema.optionalKey(Schema.Literals(["native", "exa"])) - }), - Schema.Struct({ - "id": Schema.Literal("file-parser"), - "enabled": Schema.optionalKey(Schema.Boolean), - "pdf": Schema.optionalKey( - Schema.Struct({ "engine": Schema.optionalKey(Schema.Literals(["mistral-ocr", "pdf-text", "native"])) }) - ) - }), - Schema.Struct({ "id": Schema.Literal("response-healing"), "enabled": Schema.optionalKey(Schema.Boolean) }) - ], { mode: "oneOf" }) - ).annotate({ "description": "Plugins you want to enable for this request, including their settings." }) + "route": Schema.optionalKey( + Schema.Literals(["fallback", "sort"]).annotate({ + "description": + "**DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: \"fallback\" (maps to \"model\"), \"sort\" (maps to \"none\")." + }) ), - "route": Schema.optionalKey(Schema.Union([Schema.Literals(["fallback", "sort"]), Schema.Null])), - "user": Schema.optionalKey(Schema.String), + "user": Schema.optionalKey(Schema.String.annotate({ "description": "Unique user identifier" })), "session_id": Schema.optionalKey( Schema.String.annotate({ "description": @@ -6801,97 +6792,125 @@ export const ChatGenerationParams = Schema.Struct({ "Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations." }) ), - "messages": Schema.Array(Message).check(Schema.isMinLength(1)), + "messages": Schema.Array(Message).annotate({ "description": "List of messages for the conversation" }).check( + Schema.isMinLength(1) + ), "model": Schema.optionalKey(ModelName), - "models": Schema.optionalKey(Schema.Array(ModelName)), + "models": Schema.optionalKey(ModelNames), "frequency_penalty": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(-2)).check( - Schema.isLessThanOrEqualTo(2) - ), - Schema.Null - ]) + Schema.Number.annotate({ "description": "Frequency penalty (-2.0 to 2.0)" }).check(Schema.isFinite()).check( + Schema.isGreaterThanOrEqualTo(-2) + ).check(Schema.isLessThanOrEqualTo(2)) ), - "logit_bias": Schema.optionalKey( - Schema.Union([Schema.Struct({}).check(Schema.isPropertyNames(Schema.String)), Schema.Null]) - ), - "logprobs": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + "logit_bias": Schema.optionalKey(Schema.Struct({}).annotate({ "description": "Token logit bias adjustments" })), + "logprobs": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Return log probabilities" })), "top_logprobs": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check( - Schema.isLessThanOrEqualTo(20) - ), - Schema.Null - ]) + Schema.Number.annotate({ "description": "Number of top log probabilities to return (0-20)" }).check( + Schema.isFinite() + ).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)) ), "max_completion_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]) + Schema.Number.annotate({ "description": "Maximum tokens in completion" }).check(Schema.isFinite()).check( + Schema.isGreaterThanOrEqualTo(1) + ) ), "max_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]) + Schema.Number.annotate({ "description": "Maximum tokens (deprecated, use max_completion_tokens)" }).check( + Schema.isFinite() + ).check(Schema.isGreaterThanOrEqualTo(1)) + ), + "metadata": Schema.optionalKey( + Schema.Struct({}).annotate({ + "description": "Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)" + }) ), - "metadata": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))), "presence_penalty": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(-2)).check( - Schema.isLessThanOrEqualTo(2) - ), - Schema.Null - ]) + Schema.Number.annotate({ "description": "Presence penalty (-2.0 to 2.0)" }).check(Schema.isFinite()).check( + Schema.isGreaterThanOrEqualTo(-2) + ).check(Schema.isLessThanOrEqualTo(2)) ), "reasoning": Schema.optionalKey( Schema.Struct({ "effort": Schema.optionalKey( - Schema.Union([Schema.Literals(["xhigh", "high", "medium", "low", "minimal", "none"]), Schema.Null]) + Schema.Literals(["xhigh", "high", "medium", "low", "minimal", "none"]).annotate({ + "description": "Constrains effort on reasoning for reasoning models" + }) ), - "summary": Schema.optionalKey(Schema.Union([ReasoningSummaryVerbosity, Schema.Null])) - }) + "summary": Schema.optionalKey(Schema.Union([ReasoningSummaryVerbosity, Schema.Unknown, Schema.Unknown])) + }).annotate({ "description": "Configuration options for reasoning models" }) ), "response_format": Schema.optionalKey( Schema.Union([ - Schema.Struct({ "type": Schema.Literal("text") }), - Schema.Struct({ "type": Schema.Literal("json_object") }), + ResponseFormatText, + ResponseFormatJSONObject, ResponseFormatJSONSchema, ResponseFormatTextGrammar, - Schema.Struct({ "type": Schema.Literal("python") }) - ], { mode: "oneOf" }) + ResponseFormatTextPython + ], { mode: "oneOf" }).annotate({ "description": "Response format configuration" }) ), "seed": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(-9007199254740991)).check( - Schema.isLessThanOrEqualTo(9007199254740991) - ), - Schema.Null - ]) + Schema.Number.annotate({ "description": "Random seed for deterministic outputs" }).check(Schema.isInt()) ), "stop": Schema.optionalKey( - Schema.Union([Schema.Union([Schema.String, Schema.Array(ModelName).check(Schema.isMaxLength(4))]), Schema.Null]) + Schema.Union([Schema.String, Schema.Array(Schema.String).check(Schema.isMaxLength(4)), Schema.Unknown]).annotate({ + "description": "Stop sequences (up to 4)" + }) ), - "stream": Schema.optionalKey(Schema.Boolean), - "stream_options": Schema.optionalKey(Schema.Union([ChatStreamOptions, Schema.Null])), + "stream": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Enable streaming response" })), + "stream_options": Schema.optionalKey(ChatStreamOptions), "temperature": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check( - Schema.isLessThanOrEqualTo(2) - ), - Schema.Null - ]) + Schema.Number.annotate({ "description": "Sampling temperature (0-2)" }).check(Schema.isFinite()).check( + Schema.isGreaterThanOrEqualTo(0) + ).check(Schema.isLessThanOrEqualTo(2)) ), - "parallel_tool_calls": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), + "parallel_tool_calls": Schema.optionalKey(Schema.Boolean), "tool_choice": Schema.optionalKey(ToolChoiceOption), - "tools": Schema.optionalKey(Schema.Array(ToolDefinitionJson)), + "tools": Schema.optionalKey( + Schema.Array(ToolDefinitionJson).annotate({ "description": "Available tools for function calling" }) + ), "top_p": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check( - Schema.isLessThanOrEqualTo(1) - ), - Schema.Null - ]) + Schema.Number.annotate({ "description": "Nucleus sampling parameter (0-1)" }).check(Schema.isFinite()).check( + Schema.isGreaterThanOrEqualTo(0) + ).check(Schema.isLessThanOrEqualTo(1)) ), - "debug": Schema.optionalKey(Schema.Struct({ "echo_upstream_body": Schema.optionalKey(Schema.Boolean) })), - "image_config": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))), - "modalities": Schema.optionalKey(Schema.Array(Schema.Literals(["text", "image"]))) -}) + "debug": Schema.optionalKey(DebugOptions), + "image_config": Schema.optionalKey( + Schema.Struct({}).annotate({ + "description": + "Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details." + }) + ), + "modalities": Schema.optionalKey( + Schema.Array(Schema.Literals(["text", "image"])).annotate({ + "description": "Output modalities for the response. Supported values are \"text\" and \"image\"." + }) + ) +}).annotate({ "description": "Chat completion request parameters" }) +export type ChatStreamingResponseChunk = { + readonly "id": string + readonly "choices": ReadonlyArray + readonly "created": number + readonly "model": string + readonly "object": "chat.completion.chunk" + readonly "system_fingerprint"?: string + readonly "error"?: { readonly "message": string; readonly "code": number } + readonly "usage"?: ChatGenerationTokenUsage +} +export const ChatStreamingResponseChunk = Schema.Struct({ + "id": Schema.String.annotate({ "description": "Unique chunk identifier" }), + "choices": Schema.Array(ChatStreamingChoice).annotate({ "description": "List of streaming chunk choices" }), + "created": Schema.Number.annotate({ "description": "Unix timestamp of creation" }).check(Schema.isFinite()), + "model": Schema.String.annotate({ "description": "Model used for completion" }), + "object": Schema.Literal("chat.completion.chunk"), + "system_fingerprint": Schema.optionalKey(Schema.String.annotate({ "description": "System fingerprint" })), + "error": Schema.optionalKey( + Schema.Struct({ + "message": Schema.String.annotate({ "description": "Error message" }), + "code": Schema.Number.annotate({ "description": "Error code" }).check(Schema.isFinite()) + }).annotate({ "description": "Error information" }) + ), + "usage": Schema.optionalKey(ChatGenerationTokenUsage) +}).annotate({ "description": "Streaming chat completion chunk" }) export type OpenResponsesCreatedEvent = { readonly "type": "response.created" readonly "response": OpenAIResponsesNonStreamingResponse @@ -7120,6 +7139,38 @@ export type GetUserActivity403 = ForbiddenResponse export const GetUserActivity403 = ForbiddenResponse export type GetUserActivity500 = InternalServerResponse export const GetUserActivity500 = InternalServerResponse +export type SendChatCompletionRequestRequestJson = ChatGenerationParams +export const SendChatCompletionRequestRequestJson = ChatGenerationParams +export type SendChatCompletionRequest200 = ChatResponse +export const SendChatCompletionRequest200 = ChatResponse +export type SendChatCompletionRequest200Sse = { readonly "data": ChatStreamingResponseChunk } +export const SendChatCompletionRequest200Sse = Schema.Struct({ "data": ChatStreamingResponseChunk }) +export type SendChatCompletionRequest400 = BadRequestResponse +export const SendChatCompletionRequest400 = BadRequestResponse +export type SendChatCompletionRequest401 = UnauthorizedResponse +export const SendChatCompletionRequest401 = UnauthorizedResponse +export type SendChatCompletionRequest402 = PaymentRequiredResponse +export const SendChatCompletionRequest402 = PaymentRequiredResponse +export type SendChatCompletionRequest404 = NotFoundResponse +export const SendChatCompletionRequest404 = NotFoundResponse +export type SendChatCompletionRequest408 = RequestTimeoutResponse +export const SendChatCompletionRequest408 = RequestTimeoutResponse +export type SendChatCompletionRequest413 = PayloadTooLargeResponse +export const SendChatCompletionRequest413 = PayloadTooLargeResponse +export type SendChatCompletionRequest422 = UnprocessableEntityResponse +export const SendChatCompletionRequest422 = UnprocessableEntityResponse +export type SendChatCompletionRequest429 = TooManyRequestsResponse +export const SendChatCompletionRequest429 = TooManyRequestsResponse +export type SendChatCompletionRequest500 = InternalServerResponse +export const SendChatCompletionRequest500 = InternalServerResponse +export type SendChatCompletionRequest502 = BadGatewayResponse +export const SendChatCompletionRequest502 = BadGatewayResponse +export type SendChatCompletionRequest503 = ServiceUnavailableResponse +export const SendChatCompletionRequest503 = ServiceUnavailableResponse +export type SendChatCompletionRequest524 = EdgeNetworkTimeoutResponse +export const SendChatCompletionRequest524 = EdgeNetworkTimeoutResponse +export type SendChatCompletionRequest529 = ProviderOverloadedResponse +export const SendChatCompletionRequest529 = ProviderOverloadedResponse export type GetCredits200 = { readonly "data": { readonly "total_credits": number; readonly "total_usage": number } } export const GetCredits200 = Schema.Struct({ "data": Schema.Struct({ @@ -7409,6 +7460,7 @@ export type GetGeneration200 = { | "Inception" | "Inceptron" | "InferenceNet" + | "Ionstream" | "Infermatic" | "Io Net" | "Inflection" @@ -7590,6 +7642,7 @@ export const GetGeneration200 = Schema.Struct({ "Inception", "Inceptron", "InferenceNet", + "Ionstream", "Infermatic", "Io Net", "Inflection", @@ -8787,6 +8840,10 @@ export type CreateAuthKeysCodeRequestJson = { readonly "code_challenge_method"?: "S256" | "plain" readonly "limit"?: number readonly "expires_at"?: string + readonly "key_label"?: string + readonly "usage_limit_type"?: "daily" | "weekly" | "monthly" + readonly "spawn_agent"?: string + readonly "spawn_cloud"?: string } export const CreateAuthKeysCodeRequestJson = Schema.Struct({ "callback_url": Schema.String.annotate({ @@ -8808,7 +8865,19 @@ export const CreateAuthKeysCodeRequestJson = Schema.Struct({ "description": "Optional expiration time for the API key to be created", "format": "date-time" }) - ) + ), + "key_label": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional custom label for the API key. Defaults to the app name if not provided." + }).check(Schema.isMaxLength(100)) + ), + "usage_limit_type": Schema.optionalKey( + Schema.Literals(["daily", "weekly", "monthly"]).annotate({ + "description": "Optional credit limit reset interval. When set, the credit limit resets on this interval." + }) + ), + "spawn_agent": Schema.optionalKey(Schema.String.annotate({ "description": "Agent identifier for spawn telemetry" })), + "spawn_cloud": Schema.optionalKey(Schema.String.annotate({ "description": "Cloud identifier for spawn telemetry" })) }) export type CreateAuthKeysCode200 = { readonly "data": { readonly "id": string; readonly "app_id": number; readonly "created_at": string } @@ -8828,36 +8897,6 @@ export type CreateAuthKeysCode401 = UnauthorizedResponse export const CreateAuthKeysCode401 = UnauthorizedResponse export type CreateAuthKeysCode500 = InternalServerResponse export const CreateAuthKeysCode500 = InternalServerResponse -export type SendChatCompletionRequestRequestJson = ChatGenerationParams -export const SendChatCompletionRequestRequestJson = ChatGenerationParams -export type SendChatCompletionRequest200 = { - readonly "id": string - readonly "choices": ReadonlyArray - readonly "created": number - readonly "model": string - readonly "object": "chat.completion" - readonly "system_fingerprint"?: string | null - readonly "usage"?: ChatGenerationTokenUsage -} -export const SendChatCompletionRequest200 = Schema.Struct({ - "id": Schema.String, - "choices": Schema.Array(ChatResponseChoice), - "created": Schema.Number.check(Schema.isFinite()), - "model": Schema.String, - "object": Schema.Literal("chat.completion"), - "system_fingerprint": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "usage": Schema.optionalKey(ChatGenerationTokenUsage) -}).annotate({ "description": "Chat completion response" }) -export type SendChatCompletionRequest200Sse = ChatStreamingResponseChunk -export const SendChatCompletionRequest200Sse = ChatStreamingResponseChunk -export type SendChatCompletionRequest400 = ChatError -export const SendChatCompletionRequest400 = ChatError -export type SendChatCompletionRequest401 = ChatError -export const SendChatCompletionRequest401 = ChatError -export type SendChatCompletionRequest429 = ChatError -export const SendChatCompletionRequest429 = ChatError -export type SendChatCompletionRequest500 = ChatError -export const SendChatCompletionRequest500 = ChatError export interface OperationConfig { /** @@ -9009,6 +9048,32 @@ export const make = ( orElse: unexpectedStatus })) ), + "sendChatCompletionRequest": (options) => + HttpClientRequest.post(`/chat/completions`).pipe( + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(SendChatCompletionRequest200), + "400": decodeError("SendChatCompletionRequest400", SendChatCompletionRequest400), + "401": decodeError("SendChatCompletionRequest401", SendChatCompletionRequest401), + "402": decodeError("SendChatCompletionRequest402", SendChatCompletionRequest402), + "404": decodeError("SendChatCompletionRequest404", SendChatCompletionRequest404), + "408": decodeError("SendChatCompletionRequest408", SendChatCompletionRequest408), + "413": decodeError("SendChatCompletionRequest413", SendChatCompletionRequest413), + "422": decodeError("SendChatCompletionRequest422", SendChatCompletionRequest422), + "429": decodeError("SendChatCompletionRequest429", SendChatCompletionRequest429), + "500": decodeError("SendChatCompletionRequest500", SendChatCompletionRequest500), + "502": decodeError("SendChatCompletionRequest502", SendChatCompletionRequest502), + "503": decodeError("SendChatCompletionRequest503", SendChatCompletionRequest503), + "524": decodeError("SendChatCompletionRequest524", SendChatCompletionRequest524), + "529": decodeError("SendChatCompletionRequest529", SendChatCompletionRequest529), + orElse: unexpectedStatus + })) + ), + "sendChatCompletionRequestSse": (options) => + HttpClientRequest.post(`/chat/completions`).pipe( + HttpClientRequest.bodyJsonUnsafe(options.payload), + sseRequest(SendChatCompletionRequest200Sse) + ), "getCredits": (options) => HttpClientRequest.get(`/credits`).pipe( withResponse(options?.config)(HttpClientResponse.matchStatus({ @@ -9384,23 +9449,6 @@ export const make = ( "500": decodeError("CreateAuthKeysCode500", CreateAuthKeysCode500), orElse: unexpectedStatus })) - ), - "sendChatCompletionRequest": (options) => - HttpClientRequest.post(`/chat/completions`).pipe( - HttpClientRequest.bodyJsonUnsafe(options.payload), - withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(SendChatCompletionRequest200), - "400": decodeError("SendChatCompletionRequest400", SendChatCompletionRequest400), - "401": decodeError("SendChatCompletionRequest401", SendChatCompletionRequest401), - "429": decodeError("SendChatCompletionRequest429", SendChatCompletionRequest429), - "500": decodeError("SendChatCompletionRequest500", SendChatCompletionRequest500), - orElse: unexpectedStatus - })) - ), - "sendChatCompletionRequestSse": (options) => - HttpClientRequest.post(`/chat/completions`).pipe( - HttpClientRequest.bodyJsonUnsafe(options.payload), - sseRequest(SendChatCompletionRequest200Sse) ) } } @@ -9485,6 +9533,46 @@ export interface OpenRouterClient { | OpenRouterClientError<"GetUserActivity403", typeof GetUserActivity403.Type> | OpenRouterClientError<"GetUserActivity500", typeof GetUserActivity500.Type> > + /** + * Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. + */ + readonly "sendChatCompletionRequest": ( + options: { + readonly payload: typeof SendChatCompletionRequestRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"SendChatCompletionRequest400", typeof SendChatCompletionRequest400.Type> + | OpenRouterClientError<"SendChatCompletionRequest401", typeof SendChatCompletionRequest401.Type> + | OpenRouterClientError<"SendChatCompletionRequest402", typeof SendChatCompletionRequest402.Type> + | OpenRouterClientError<"SendChatCompletionRequest404", typeof SendChatCompletionRequest404.Type> + | OpenRouterClientError<"SendChatCompletionRequest408", typeof SendChatCompletionRequest408.Type> + | OpenRouterClientError<"SendChatCompletionRequest413", typeof SendChatCompletionRequest413.Type> + | OpenRouterClientError<"SendChatCompletionRequest422", typeof SendChatCompletionRequest422.Type> + | OpenRouterClientError<"SendChatCompletionRequest429", typeof SendChatCompletionRequest429.Type> + | OpenRouterClientError<"SendChatCompletionRequest500", typeof SendChatCompletionRequest500.Type> + | OpenRouterClientError<"SendChatCompletionRequest502", typeof SendChatCompletionRequest502.Type> + | OpenRouterClientError<"SendChatCompletionRequest503", typeof SendChatCompletionRequest503.Type> + | OpenRouterClientError<"SendChatCompletionRequest524", typeof SendChatCompletionRequest524.Type> + | OpenRouterClientError<"SendChatCompletionRequest529", typeof SendChatCompletionRequest529.Type> + > + /** + * Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. + */ + readonly "sendChatCompletionRequestSse": ( + options: { readonly payload: typeof SendChatCompletionRequestRequestJson.Encoded } + ) => Stream.Stream< + { + readonly event: string + readonly id: string | undefined + readonly data: typeof SendChatCompletionRequest200Sse.Type + }, + HttpClientError.HttpClientError | SchemaError | Sse.Retry, + typeof SendChatCompletionRequest200Sse.DecodingServices + > /** * Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ @@ -9968,37 +10056,6 @@ export interface OpenRouterClient { | OpenRouterClientError<"CreateAuthKeysCode401", typeof CreateAuthKeysCode401.Type> | OpenRouterClientError<"CreateAuthKeysCode500", typeof CreateAuthKeysCode500.Type> > - /** - * Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. - */ - readonly "sendChatCompletionRequest": ( - options: { - readonly payload: typeof SendChatCompletionRequestRequestJson.Encoded - readonly config?: Config | undefined - } - ) => Effect.Effect< - WithOptionalResponse, - | HttpClientError.HttpClientError - | SchemaError - | OpenRouterClientError<"SendChatCompletionRequest400", typeof SendChatCompletionRequest400.Type> - | OpenRouterClientError<"SendChatCompletionRequest401", typeof SendChatCompletionRequest401.Type> - | OpenRouterClientError<"SendChatCompletionRequest429", typeof SendChatCompletionRequest429.Type> - | OpenRouterClientError<"SendChatCompletionRequest500", typeof SendChatCompletionRequest500.Type> - > - /** - * Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. - */ - readonly "sendChatCompletionRequestSse": ( - options: { readonly payload: typeof SendChatCompletionRequestRequestJson.Encoded } - ) => Stream.Stream< - { - readonly event: string - readonly id: string | undefined - readonly data: typeof SendChatCompletionRequest200Sse.Type - }, - HttpClientError.HttpClientError | SchemaError | Sse.Retry, - typeof SendChatCompletionRequest200Sse.DecodingServices - > } export interface OpenRouterClientError {