From a822a73d1a85f8fbeacfdd506d38a5b2bd1f0fec Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Fri, 18 Sep 2026 17:36:56 -0700 Subject: [PATCH 01/11] fix(types): describe Workers AI model reasoning controls --- types/defines/ai.d.ts | 58 +++++++----- .../experimental/index.d.ts | 88 ++++++++++++++----- .../generated-snapshot/experimental/index.ts | 88 ++++++++++++++----- types/generated-snapshot/index.d.ts | 88 ++++++++++++++----- types/generated-snapshot/index.ts | 88 ++++++++++++++----- types/test/types/ai-reasoning.ts | 67 ++++++++++++++ 6 files changed, 367 insertions(+), 110 deletions(-) create mode 100644 types/test/types/ai-reasoning.ts diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index 21ea87b5575..320458e6ab7 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -521,14 +521,17 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -export type ChatTemplateKwargs = { - /** Whether to enable reasoning, enabled by default. */ - enable_thinking?: boolean; +export type ChatTemplateKwargs = { + /** Whether to enable reasoning. Support and defaults depend on the model. */ + enable_thinking?: ThinkingEnabled; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -export type ChatCompletionsCommonOptions = { +export type ChatCompletionsCommonOptions< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -543,8 +546,8 @@ export type ChatCompletionsCommonOptions = { parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: "low" | "medium" | "high" | null; - chat_template_kwargs?: ChatTemplateKwargs; + reasoning_effort?: Effort | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -633,9 +636,12 @@ export type ChatCompletionChoice = { logprobs: ChatCompletionLogprobs | null; }; -export type ChatCompletionsMessagesInput = { +export type ChatCompletionsMessagesInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; export type ChatCompletionsOutput = { id: string; @@ -658,7 +664,7 @@ export type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -export type ResponsesInput = { +export type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -668,7 +674,7 @@ export type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -729,8 +735,8 @@ export type ResponsePrompt = { } | null; version?: string | null; }; -export type Reasoning = { - effort?: ReasoningEffort | null; +export type Reasoning = { + effort?: Effort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -4730,11 +4736,11 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { - inputs: XOR; + inputs: XOR, ChatCompletionsInput<"low" | "medium" | "high", true>>; postProcessedOutputs: XOR; } export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { - inputs: XOR; + inputs: XOR, ChatCompletionsInput<"low" | "medium" | "high", true>>; postProcessedOutputs: XOR; } export interface Ai_Cf_Leonardo_Phoenix_1_0_Input { @@ -5824,7 +5830,7 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"high" | "none" | "low" | "medium" | "max", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { @@ -5832,15 +5838,15 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"high" | "none" | "low" | "medium" | "max", true>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -5977,19 +5983,23 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { + inputs: ChatCompletionsInput<"max" | "high" | "low" | "none" | "medium", true>; + postProcessedOutputs: ChatCompletionsOutput; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", true>; postProcessedOutputs: ChatCompletionsOutput; } @@ -6091,6 +6101,7 @@ export interface AiModels { "@cf/deepseek-ai/deepseek-v4-flash-0731": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731; "@cf/deepseek-ai/deepseek-v4-pro-0813": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813; "@cf/qwen/qwen3.8-27b": Base_Ai_Cf_Qwen_Qwen3_8_27B; + "@cf/zai-org/glm-5.3": Base_Ai_Cf_Zai_Org_Glm_5_3; "@cf/zai-org/glm-5.3-flash": Base_Ai_Cf_Zai_Org_Glm_5_3_Flash; } export type AiOptions = { @@ -6146,7 +6157,10 @@ export type AiModelsSearchObject = { }; export type ChatCompletionsBase = ChatCompletionsMessagesInput; -export type ChatCompletionsInput = ChatCompletionsMessagesInput; +export type ChatCompletionsInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = ChatCompletionsMessagesInput; export interface InferenceUpstreamError extends Error {} export interface AiInternalError extends Error {} diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 2d13a470932..1d152d8cef7 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -6483,14 +6483,17 @@ type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -type ChatTemplateKwargs = { - /** Whether to enable reasoning, enabled by default. */ - enable_thinking?: boolean; +type ChatTemplateKwargs = { + /** Whether to enable reasoning. Support and defaults depend on the model. */ + enable_thinking?: ThinkingEnabled; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -type ChatCompletionsCommonOptions = { +type ChatCompletionsCommonOptions< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -6505,8 +6508,8 @@ type ChatCompletionsCommonOptions = { parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: "low" | "medium" | "high" | null; - chat_template_kwargs?: ChatTemplateKwargs; + reasoning_effort?: Effort | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -6595,9 +6598,12 @@ type ChatCompletionChoice = { "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; logprobs: ChatCompletionLogprobs | null; }; -type ChatCompletionsMessagesInput = { +type ChatCompletionsMessagesInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; type ChatCompletionsOutput = { id: string; object: string; @@ -6618,7 +6624,7 @@ type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -type ResponsesInput = { +type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -6628,7 +6634,7 @@ type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6689,8 +6695,8 @@ type ResponsePrompt = { } | null; version?: string | null; }; -type Reasoning = { - effort?: ReasoningEffort | null; +type Reasoning = { + effort?: Effort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -10713,11 +10719,17 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { - inputs: XOR; + inputs: XOR< + ResponsesInput<"low" | "medium" | "high">, + ChatCompletionsInput<"low" | "medium" | "high", true> + >; postProcessedOutputs: XOR; } declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { - inputs: XOR; + inputs: XOR< + ResponsesInput<"low" | "medium" | "high">, + ChatCompletionsInput<"low" | "medium" | "high", true> + >; postProcessedOutputs: XOR; } interface Ai_Cf_Leonardo_Phoenix_1_0_Input { @@ -11808,7 +11820,10 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "low" | "medium" | "max", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { @@ -11816,15 +11831,24 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "low" | "medium" | "max", + true + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -11961,19 +11985,35 @@ declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "medium", + true + >; + postProcessedOutputs: ChatCompletionsOutput; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + true + >; postProcessedOutputs: ChatCompletionsOutput; } interface AiModels { @@ -12074,6 +12114,7 @@ interface AiModels { "@cf/deepseek-ai/deepseek-v4-flash-0731": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731; "@cf/deepseek-ai/deepseek-v4-pro-0813": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813; "@cf/qwen/qwen3.8-27b": Base_Ai_Cf_Qwen_Qwen3_8_27B; + "@cf/zai-org/glm-5.3": Base_Ai_Cf_Zai_Org_Glm_5_3; "@cf/zai-org/glm-5.3-flash": Base_Ai_Cf_Zai_Org_Glm_5_3_Flash; } type AiOptions = { @@ -12128,7 +12169,10 @@ type AiModelsSearchObject = { }[]; }; type ChatCompletionsBase = ChatCompletionsMessagesInput; -type ChatCompletionsInput = ChatCompletionsMessagesInput; +type ChatCompletionsInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = ChatCompletionsMessagesInput; interface InferenceUpstreamError extends Error {} interface AiInternalError extends Error {} type AiModelListType = Record; diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 402342e9c94..48865ef80c7 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -6494,14 +6494,17 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -export type ChatTemplateKwargs = { - /** Whether to enable reasoning, enabled by default. */ - enable_thinking?: boolean; +export type ChatTemplateKwargs = { + /** Whether to enable reasoning. Support and defaults depend on the model. */ + enable_thinking?: ThinkingEnabled; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -export type ChatCompletionsCommonOptions = { +export type ChatCompletionsCommonOptions< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -6516,8 +6519,8 @@ export type ChatCompletionsCommonOptions = { parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: "low" | "medium" | "high" | null; - chat_template_kwargs?: ChatTemplateKwargs; + reasoning_effort?: Effort | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -6606,9 +6609,12 @@ export type ChatCompletionChoice = { "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; logprobs: ChatCompletionLogprobs | null; }; -export type ChatCompletionsMessagesInput = { +export type ChatCompletionsMessagesInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; export type ChatCompletionsOutput = { id: string; object: string; @@ -6629,7 +6635,7 @@ export type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -export type ResponsesInput = { +export type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -6639,7 +6645,7 @@ export type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6700,8 +6706,8 @@ export type ResponsePrompt = { } | null; version?: string | null; }; -export type Reasoning = { - effort?: ReasoningEffort | null; +export type Reasoning = { + effort?: Effort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -10725,11 +10731,17 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { - inputs: XOR; + inputs: XOR< + ResponsesInput<"low" | "medium" | "high">, + ChatCompletionsInput<"low" | "medium" | "high", true> + >; postProcessedOutputs: XOR; } export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { - inputs: XOR; + inputs: XOR< + ResponsesInput<"low" | "medium" | "high">, + ChatCompletionsInput<"low" | "medium" | "high", true> + >; postProcessedOutputs: XOR; } export interface Ai_Cf_Leonardo_Phoenix_1_0_Input { @@ -11820,7 +11832,10 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "low" | "medium" | "max", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { @@ -11828,15 +11843,24 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "low" | "medium" | "max", + true + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -11973,19 +11997,35 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "medium", + true + >; + postProcessedOutputs: ChatCompletionsOutput; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + true + >; postProcessedOutputs: ChatCompletionsOutput; } export interface AiModels { @@ -12086,6 +12126,7 @@ export interface AiModels { "@cf/deepseek-ai/deepseek-v4-flash-0731": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731; "@cf/deepseek-ai/deepseek-v4-pro-0813": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813; "@cf/qwen/qwen3.8-27b": Base_Ai_Cf_Qwen_Qwen3_8_27B; + "@cf/zai-org/glm-5.3": Base_Ai_Cf_Zai_Org_Glm_5_3; "@cf/zai-org/glm-5.3-flash": Base_Ai_Cf_Zai_Org_Glm_5_3_Flash; } export type AiOptions = { @@ -12140,7 +12181,10 @@ export type AiModelsSearchObject = { }[]; }; export type ChatCompletionsBase = ChatCompletionsMessagesInput; -export type ChatCompletionsInput = ChatCompletionsMessagesInput; +export type ChatCompletionsInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = ChatCompletionsMessagesInput; export interface InferenceUpstreamError extends Error {} export interface AiInternalError extends Error {} export type AiModelListType = Record; diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index ec0b5782110..b361d03c31b 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -6200,14 +6200,17 @@ type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -type ChatTemplateKwargs = { - /** Whether to enable reasoning, enabled by default. */ - enable_thinking?: boolean; +type ChatTemplateKwargs = { + /** Whether to enable reasoning. Support and defaults depend on the model. */ + enable_thinking?: ThinkingEnabled; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -type ChatCompletionsCommonOptions = { +type ChatCompletionsCommonOptions< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -6222,8 +6225,8 @@ type ChatCompletionsCommonOptions = { parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: "low" | "medium" | "high" | null; - chat_template_kwargs?: ChatTemplateKwargs; + reasoning_effort?: Effort | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -6312,9 +6315,12 @@ type ChatCompletionChoice = { "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; logprobs: ChatCompletionLogprobs | null; }; -type ChatCompletionsMessagesInput = { +type ChatCompletionsMessagesInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; type ChatCompletionsOutput = { id: string; object: string; @@ -6335,7 +6341,7 @@ type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -type ResponsesInput = { +type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -6345,7 +6351,7 @@ type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6406,8 +6412,8 @@ type ResponsePrompt = { } | null; version?: string | null; }; -type Reasoning = { - effort?: ReasoningEffort | null; +type Reasoning = { + effort?: Effort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -10430,11 +10436,17 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { - inputs: XOR; + inputs: XOR< + ResponsesInput<"low" | "medium" | "high">, + ChatCompletionsInput<"low" | "medium" | "high", true> + >; postProcessedOutputs: XOR; } declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { - inputs: XOR; + inputs: XOR< + ResponsesInput<"low" | "medium" | "high">, + ChatCompletionsInput<"low" | "medium" | "high", true> + >; postProcessedOutputs: XOR; } interface Ai_Cf_Leonardo_Phoenix_1_0_Input { @@ -11525,7 +11537,10 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "low" | "medium" | "max", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { @@ -11533,15 +11548,24 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "low" | "medium" | "max", + true + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -11678,19 +11702,35 @@ declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "medium", + true + >; + postProcessedOutputs: ChatCompletionsOutput; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + true + >; postProcessedOutputs: ChatCompletionsOutput; } interface AiModels { @@ -11791,6 +11831,7 @@ interface AiModels { "@cf/deepseek-ai/deepseek-v4-flash-0731": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731; "@cf/deepseek-ai/deepseek-v4-pro-0813": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813; "@cf/qwen/qwen3.8-27b": Base_Ai_Cf_Qwen_Qwen3_8_27B; + "@cf/zai-org/glm-5.3": Base_Ai_Cf_Zai_Org_Glm_5_3; "@cf/zai-org/glm-5.3-flash": Base_Ai_Cf_Zai_Org_Glm_5_3_Flash; } type AiOptions = { @@ -11845,7 +11886,10 @@ type AiModelsSearchObject = { }[]; }; type ChatCompletionsBase = ChatCompletionsMessagesInput; -type ChatCompletionsInput = ChatCompletionsMessagesInput; +type ChatCompletionsInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = ChatCompletionsMessagesInput; interface InferenceUpstreamError extends Error {} interface AiInternalError extends Error {} type AiModelListType = Record; diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index 4b0698eef97..2920cb1fe64 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -6211,14 +6211,17 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -export type ChatTemplateKwargs = { - /** Whether to enable reasoning, enabled by default. */ - enable_thinking?: boolean; +export type ChatTemplateKwargs = { + /** Whether to enable reasoning. Support and defaults depend on the model. */ + enable_thinking?: ThinkingEnabled; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -export type ChatCompletionsCommonOptions = { +export type ChatCompletionsCommonOptions< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -6233,8 +6236,8 @@ export type ChatCompletionsCommonOptions = { parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: "low" | "medium" | "high" | null; - chat_template_kwargs?: ChatTemplateKwargs; + reasoning_effort?: Effort | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -6323,9 +6326,12 @@ export type ChatCompletionChoice = { "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; logprobs: ChatCompletionLogprobs | null; }; -export type ChatCompletionsMessagesInput = { +export type ChatCompletionsMessagesInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; export type ChatCompletionsOutput = { id: string; object: string; @@ -6346,7 +6352,7 @@ export type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -export type ResponsesInput = { +export type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -6356,7 +6362,7 @@ export type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6417,8 +6423,8 @@ export type ResponsePrompt = { } | null; version?: string | null; }; -export type Reasoning = { - effort?: ReasoningEffort | null; +export type Reasoning = { + effort?: Effort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -10442,11 +10448,17 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { - inputs: XOR; + inputs: XOR< + ResponsesInput<"low" | "medium" | "high">, + ChatCompletionsInput<"low" | "medium" | "high", true> + >; postProcessedOutputs: XOR; } export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { - inputs: XOR; + inputs: XOR< + ResponsesInput<"low" | "medium" | "high">, + ChatCompletionsInput<"low" | "medium" | "high", true> + >; postProcessedOutputs: XOR; } export interface Ai_Cf_Leonardo_Phoenix_1_0_Input { @@ -11537,7 +11549,10 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "low" | "medium" | "max", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { @@ -11545,15 +11560,24 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "high" | "none" | "low" | "medium" | "max", + true + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -11690,19 +11714,35 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + boolean + >; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "medium", + true + >; + postProcessedOutputs: ChatCompletionsOutput; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput< + "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", + true + >; postProcessedOutputs: ChatCompletionsOutput; } export interface AiModels { @@ -11803,6 +11843,7 @@ export interface AiModels { "@cf/deepseek-ai/deepseek-v4-flash-0731": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731; "@cf/deepseek-ai/deepseek-v4-pro-0813": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813; "@cf/qwen/qwen3.8-27b": Base_Ai_Cf_Qwen_Qwen3_8_27B; + "@cf/zai-org/glm-5.3": Base_Ai_Cf_Zai_Org_Glm_5_3; "@cf/zai-org/glm-5.3-flash": Base_Ai_Cf_Zai_Org_Glm_5_3_Flash; } export type AiOptions = { @@ -11857,7 +11898,10 @@ export type AiModelsSearchObject = { }[]; }; export type ChatCompletionsBase = ChatCompletionsMessagesInput; -export type ChatCompletionsInput = ChatCompletionsMessagesInput; +export type ChatCompletionsInput< + Effort extends string = "low" | "medium" | "high", + ThinkingEnabled extends boolean = boolean, +> = ChatCompletionsMessagesInput; export interface InferenceUpstreamError extends Error {} export interface AiInternalError extends Error {} export type AiModelListType = Record; diff --git a/types/test/types/ai-reasoning.ts b/types/test/types/ai-reasoning.ts new file mode 100644 index 00000000000..36c2d0179f6 --- /dev/null +++ b/types/test/types/ai-reasoning.ts @@ -0,0 +1,67 @@ +// Copyright (c) 2026 Cloudflare, Inc. +// Licensed under the Apache 2.0 license found in the LICENSE file or at: +// https://opensource.org/licenses/Apache-2.0 + +declare const ai: Ai; +const messages = [{ role: 'user' as const, content: 'Hello' }]; + +// Canonical controls and compatibility aliases remain accepted. +void ai.run('@cf/google/gemma-4-26b-a4b-it', { + messages, + reasoning_effort: 'none', +}); +void ai.run('@cf/google/gemma-4-26b-a4b-it', { + messages, + reasoning_effort: 'auto', +}); +void ai.run('@cf/moonshotai/kimi-k2.6', { + messages, + reasoning_effort: 'medium', +}); +void ai.run('@cf/zai-org/glm-5.3', { messages, reasoning_effort: 'max' }); +void ai.run('@cf/zai-org/glm-5.3-flash', { messages, reasoning_effort: 'max' }); +void ai.run('@cf/deepseek-ai/deepseek-v4-pro-0813', { + messages, + reasoning_effort: 'low', +}); +void ai.run('@cf/zai-org/glm-4.7-flash', { + messages, + chat_template_kwargs: { enable_thinking: false }, +}); + +void ai.run('@cf/openai/gpt-oss-20b', { + input: 'Hello', + reasoning: { effort: 'medium' }, +}); +void ai.run('@cf/openai/gpt-oss-120b', { messages, reasoning_effort: 'high' }); +// A legacy alias is an accepted input even when it does not disable reasoning. +void ai.run('@cf/moonshotai/kimi-k2.7-code', { + messages, + reasoning_effort: 'none', +}); + +// @ts-expect-error: an unsupported effort must not reach the gateway fallback overload +void ai.run('@cf/google/gemma-4-26b-a4b-it', { + messages, + reasoning_effort: 'turbo', +}); +// @ts-expect-error: GPT-OSS reasoning is mandatory +void ai.run('@cf/openai/gpt-oss-20b', { + input: 'Hello', + reasoning: { effort: 'none' }, +}); +// @ts-expect-error: mandatory reasoning cannot be disabled with enable_thinking +void ai.run('@cf/moonshotai/kimi-k2.7-code', { + messages, + chat_template_kwargs: { enable_thinking: false }, +}); + +// Unrelated options remain available on both input formats. +void ai.run('@cf/google/gemma-4-26b-a4b-it', { + messages, + service_tier: 'priority', +}); +void ai.run('@cf/openai/gpt-oss-20b', { + input: 'Hello', + service_tier: 'priority', +}); From d07d334d96ddab3bdf2fbd2c5bf3c64c88f4f2cc Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Mon, 21 Sep 2026 16:07:57 -0700 Subject: [PATCH 02/11] fix(types): add Qwen and Nemotron reasoning efforts --- types/defines/ai.d.ts | 4 ++-- .../generated-snapshot/experimental/index.d.ts | 4 ++-- types/generated-snapshot/experimental/index.ts | 4 ++-- types/generated-snapshot/index.d.ts | 4 ++-- types/generated-snapshot/index.ts | 4 ++-- types/test/types/ai-reasoning.ts | 18 ++++++++++++++++++ 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index 320458e6ab7..ad14dd327e7 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -5834,7 +5834,7 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { @@ -5991,7 +5991,7 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 1d152d8cef7..453e97ca6d0 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11827,7 +11827,7 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { @@ -11999,7 +11999,7 @@ declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 48865ef80c7..e169698cac1 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11839,7 +11839,7 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { @@ -12011,7 +12011,7 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index b361d03c31b..5c6295cbe1f 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -11544,7 +11544,7 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { @@ -11716,7 +11716,7 @@ declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index 2920cb1fe64..9b16f56713e 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -11556,7 +11556,7 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { @@ -11728,7 +11728,7 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { diff --git a/types/test/types/ai-reasoning.ts b/types/test/types/ai-reasoning.ts index 36c2d0179f6..621041fb186 100644 --- a/types/test/types/ai-reasoning.ts +++ b/types/test/types/ai-reasoning.ts @@ -20,6 +20,14 @@ void ai.run('@cf/moonshotai/kimi-k2.6', { }); void ai.run('@cf/zai-org/glm-5.3', { messages, reasoning_effort: 'max' }); void ai.run('@cf/zai-org/glm-5.3-flash', { messages, reasoning_effort: 'max' }); +void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { + messages, + reasoning_effort: 'none', +}); +void ai.run('@cf/qwen/qwen3.8-27b', { + messages, + reasoning_effort: 'xhigh', +}); void ai.run('@cf/deepseek-ai/deepseek-v4-pro-0813', { messages, reasoning_effort: 'low', @@ -55,6 +63,16 @@ void ai.run('@cf/moonshotai/kimi-k2.7-code', { messages, chat_template_kwargs: { enable_thinking: false }, }); +// @ts-expect-error: Nemotron does not accept high reasoning effort +void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { + messages, + reasoning_effort: 'high', +}); +// @ts-expect-error: Qwen 3.8 does not accept none reasoning effort +void ai.run('@cf/qwen/qwen3.8-27b', { + messages, + reasoning_effort: 'none', +}); // Unrelated options remain available on both input formats. void ai.run('@cf/google/gemma-4-26b-a4b-it', { From 3002cb8d40e4eba23885c4b1770b593ac355cfd3 Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Mon, 21 Sep 2026 17:37:15 -0700 Subject: [PATCH 03/11] fix(types): publish Nemotron native reasoning controls --- types/defines/ai.d.ts | 16 +++++++++++++++- .../experimental/index.d.ts | 16 +++++++++++++++- .../generated-snapshot/experimental/index.ts | 16 +++++++++++++++- types/generated-snapshot/index.d.ts | 16 +++++++++++++++- types/generated-snapshot/index.ts | 16 +++++++++++++++- types/test/types/ai-reasoning.ts | 19 ++++++++++++++++--- 6 files changed, 91 insertions(+), 8 deletions(-) diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index ad14dd327e7..051ba9b6111 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -5833,8 +5833,22 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { inputs: ChatCompletionsInput<"high" | "none" | "low" | "medium" | "max", boolean>; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { + /** Whether to enable reasoning. Reasoning is enabled by default. */ + enable_thinking?: boolean; + /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ + low_effort?: boolean; + /** For coding agents, force non-empty assistant content. */ + force_nonempty_content?: boolean; +} +export type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsMessagesInput, + "reasoning_effort" | "chat_template_kwargs" +> & { + chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; +}; export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 453e97ca6d0..6efab7a7971 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11826,8 +11826,22 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { >; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { + /** Whether to enable reasoning. Reasoning is enabled by default. */ + enable_thinking?: boolean; + /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ + low_effort?: boolean; + /** For coding agents, force non-empty assistant content. */ + force_nonempty_content?: boolean; +} +type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsMessagesInput, + "reasoning_effort" | "chat_template_kwargs" +> & { + chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; +}; declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index e169698cac1..ddd2086cac7 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11838,8 +11838,22 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { >; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { + /** Whether to enable reasoning. Reasoning is enabled by default. */ + enable_thinking?: boolean; + /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ + low_effort?: boolean; + /** For coding agents, force non-empty assistant content. */ + force_nonempty_content?: boolean; +} +export type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsMessagesInput, + "reasoning_effort" | "chat_template_kwargs" +> & { + chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; +}; export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index 5c6295cbe1f..2c17ccb52dd 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -11543,8 +11543,22 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { >; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { + /** Whether to enable reasoning. Reasoning is enabled by default. */ + enable_thinking?: boolean; + /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ + low_effort?: boolean; + /** For coding agents, force non-empty assistant content. */ + force_nonempty_content?: boolean; +} +type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsMessagesInput, + "reasoning_effort" | "chat_template_kwargs" +> & { + chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; +}; declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index 9b16f56713e..4951d1fbcf0 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -11555,8 +11555,22 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { >; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { + /** Whether to enable reasoning. Reasoning is enabled by default. */ + enable_thinking?: boolean; + /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ + low_effort?: boolean; + /** For coding agents, force non-empty assistant content. */ + force_nonempty_content?: boolean; +} +export type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsMessagesInput, + "reasoning_effort" | "chat_template_kwargs" +> & { + chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; +}; export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput<"medium" | "low" | "none", boolean>; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { diff --git a/types/test/types/ai-reasoning.ts b/types/test/types/ai-reasoning.ts index 621041fb186..3f52198d1d5 100644 --- a/types/test/types/ai-reasoning.ts +++ b/types/test/types/ai-reasoning.ts @@ -22,7 +22,15 @@ void ai.run('@cf/zai-org/glm-5.3', { messages, reasoning_effort: 'max' }); void ai.run('@cf/zai-org/glm-5.3-flash', { messages, reasoning_effort: 'max' }); void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { messages, - reasoning_effort: 'none', + chat_template_kwargs: { + enable_thinking: true, + low_effort: true, + force_nonempty_content: true, + }, +}); +void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { + messages, + chat_template_kwargs: { enable_thinking: false }, }); void ai.run('@cf/qwen/qwen3.8-27b', { messages, @@ -63,10 +71,15 @@ void ai.run('@cf/moonshotai/kimi-k2.7-code', { messages, chat_template_kwargs: { enable_thinking: false }, }); -// @ts-expect-error: Nemotron does not accept high reasoning effort +// @ts-expect-error: Nemotron uses native chat-template controls, not reasoning_effort +void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { + messages, + reasoning_effort: 'low', +}); +// @ts-expect-error: Nemotron does not support the generic clear_thinking control void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { messages, - reasoning_effort: 'high', + chat_template_kwargs: { enable_thinking: true, clear_thinking: false }, }); // @ts-expect-error: Qwen 3.8 does not accept none reasoning effort void ai.run('@cf/qwen/qwen3.8-27b', { From 9f6ad387b31316b20484bd4de28a65a5abcdacc8 Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Tue, 22 Sep 2026 13:03:45 -0700 Subject: [PATCH 04/11] fix(types): regenerate Workers AI reasoning types from production metadata Regenerated with the updated Workers AI type generator against production model metadata: - GLM 4.7 Flash only toggles reasoning, so it accepts no effort levels. - Kimi K2.7 Code keeps the default efforts; reasoning cannot be disabled. - Gemma 4 keeps its skip_special_tokens option alongside its efforts. - Nemotron 3 uses the shared Chat Completions input that production publishes. - Qwen 3.8 effort order follows its metadata. - Name the default effort union ChatCompletionsReasoningEffort. --- types/defines/ai.d.ts | 38 +++++++-------- .../experimental/index.d.ts | 47 ++++++++----------- .../generated-snapshot/experimental/index.ts | 47 ++++++++----------- types/generated-snapshot/index.d.ts | 47 ++++++++----------- types/generated-snapshot/index.ts | 47 ++++++++----------- types/test/types/ai-reasoning.ts | 24 ++-------- 6 files changed, 97 insertions(+), 153 deletions(-) diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index 051ba9b6111..863ac3a39f3 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -521,6 +521,8 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +/** Default reasoning efforts for models without published reasoning metadata. */ +export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: ThinkingEnabled; @@ -529,7 +531,7 @@ export type ChatTemplateKwargs = { }; /** Shared optional properties used by both Prompt and Messages input branches. */ export type ChatCompletionsCommonOptions< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { model?: string; @@ -637,7 +639,7 @@ export type ChatCompletionChoice = { }; export type ChatCompletionsMessagesInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { messages: Array; @@ -5822,7 +5824,7 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { @@ -5833,30 +5835,22 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { inputs: ChatCompletionsInput<"high" | "none" | "low" | "medium" | "max", boolean>; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { - /** Whether to enable reasoning. Reasoning is enabled by default. */ - enable_thinking?: boolean; - /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ - low_effort?: boolean; - /** For coding agents, force non-empty assistant content. */ - force_nonempty_content?: boolean; -} -export type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< - ChatCompletionsMessagesInput, - "reasoning_effort" | "chat_template_kwargs" -> & { - chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; -}; export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +export type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput<"high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean> & { + /** + * @default false + */ + skip_special_tokens?: boolean; +}; export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput<"high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean>; + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput<"high" | "none" | "low" | "medium" | "max", true>; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { @@ -6005,7 +5999,7 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; + inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { @@ -6172,7 +6166,7 @@ export type AiModelsSearchObject = { export type ChatCompletionsBase = ChatCompletionsMessagesInput; export type ChatCompletionsInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = ChatCompletionsMessagesInput; diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index be3a4ce1e5b..0d8d3632549 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -6483,6 +6483,8 @@ type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +/** Default reasoning efforts for models without published reasoning metadata. */ +type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: ThinkingEnabled; @@ -6491,7 +6493,7 @@ type ChatTemplateKwargs = { }; /** Shared optional properties used by both Prompt and Messages input branches. */ type ChatCompletionsCommonOptions< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { model?: string; @@ -6599,7 +6601,7 @@ type ChatCompletionChoice = { logprobs: ChatCompletionLogprobs | null; }; type ChatCompletionsMessagesInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { messages: Array; @@ -11812,7 +11814,7 @@ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { @@ -11826,36 +11828,25 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { >; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { - /** Whether to enable reasoning. Reasoning is enabled by default. */ - enable_thinking?: boolean; - /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ - low_effort?: boolean; - /** For coding agents, force non-empty assistant content. */ - force_nonempty_content?: boolean; -} -type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< - ChatCompletionsMessagesInput, - "reasoning_effort" | "chat_template_kwargs" -> & { - chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; -}; declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< + "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", + boolean +> & { + /** + * @default false + */ + skip_special_tokens?: boolean; +}; declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput< - "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", - boolean - >; + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput< - "high" | "none" | "low" | "medium" | "max", - true - >; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { @@ -12013,7 +12004,7 @@ declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; + inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { @@ -12184,7 +12175,7 @@ type AiModelsSearchObject = { }; type ChatCompletionsBase = ChatCompletionsMessagesInput; type ChatCompletionsInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = ChatCompletionsMessagesInput; interface InferenceUpstreamError extends Error {} diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 55e11af89b0..6f0ca3d202b 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -6494,6 +6494,8 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +/** Default reasoning efforts for models without published reasoning metadata. */ +export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: ThinkingEnabled; @@ -6502,7 +6504,7 @@ export type ChatTemplateKwargs = { }; /** Shared optional properties used by both Prompt and Messages input branches. */ export type ChatCompletionsCommonOptions< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { model?: string; @@ -6610,7 +6612,7 @@ export type ChatCompletionChoice = { logprobs: ChatCompletionLogprobs | null; }; export type ChatCompletionsMessagesInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { messages: Array; @@ -11824,7 +11826,7 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { @@ -11838,36 +11840,25 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { >; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { - /** Whether to enable reasoning. Reasoning is enabled by default. */ - enable_thinking?: boolean; - /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ - low_effort?: boolean; - /** For coding agents, force non-empty assistant content. */ - force_nonempty_content?: boolean; -} -export type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< - ChatCompletionsMessagesInput, - "reasoning_effort" | "chat_template_kwargs" -> & { - chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; -}; export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +export type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< + "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", + boolean +> & { + /** + * @default false + */ + skip_special_tokens?: boolean; +}; export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput< - "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", - boolean - >; + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput< - "high" | "none" | "low" | "medium" | "max", - true - >; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { @@ -12025,7 +12016,7 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; + inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { @@ -12196,7 +12187,7 @@ export type AiModelsSearchObject = { }; export type ChatCompletionsBase = ChatCompletionsMessagesInput; export type ChatCompletionsInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = ChatCompletionsMessagesInput; export interface InferenceUpstreamError extends Error {} diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index 5c10c1e85ed..c3282460b97 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -6200,6 +6200,8 @@ type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +/** Default reasoning efforts for models without published reasoning metadata. */ +type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: ThinkingEnabled; @@ -6208,7 +6210,7 @@ type ChatTemplateKwargs = { }; /** Shared optional properties used by both Prompt and Messages input branches. */ type ChatCompletionsCommonOptions< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { model?: string; @@ -6316,7 +6318,7 @@ type ChatCompletionChoice = { logprobs: ChatCompletionLogprobs | null; }; type ChatCompletionsMessagesInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { messages: Array; @@ -11529,7 +11531,7 @@ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { @@ -11543,36 +11545,25 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { >; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { - /** Whether to enable reasoning. Reasoning is enabled by default. */ - enable_thinking?: boolean; - /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ - low_effort?: boolean; - /** For coding agents, force non-empty assistant content. */ - force_nonempty_content?: boolean; -} -type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< - ChatCompletionsMessagesInput, - "reasoning_effort" | "chat_template_kwargs" -> & { - chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; -}; declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< + "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", + boolean +> & { + /** + * @default false + */ + skip_special_tokens?: boolean; +}; declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput< - "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", - boolean - >; + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput< - "high" | "none" | "low" | "medium" | "max", - true - >; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { @@ -11730,7 +11721,7 @@ declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; + inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { @@ -11901,7 +11892,7 @@ type AiModelsSearchObject = { }; type ChatCompletionsBase = ChatCompletionsMessagesInput; type ChatCompletionsInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = ChatCompletionsMessagesInput; interface InferenceUpstreamError extends Error {} diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index 4082c0c6cbf..51f752f510b 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -6211,6 +6211,8 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +/** Default reasoning efforts for models without published reasoning metadata. */ +export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: ThinkingEnabled; @@ -6219,7 +6221,7 @@ export type ChatTemplateKwargs = { }; /** Shared optional properties used by both Prompt and Messages input branches. */ export type ChatCompletionsCommonOptions< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { model?: string; @@ -6327,7 +6329,7 @@ export type ChatCompletionChoice = { logprobs: ChatCompletionLogprobs | null; }; export type ChatCompletionsMessagesInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = { messages: Array; @@ -11541,7 +11543,7 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { @@ -11555,36 +11557,25 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { >; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs { - /** Whether to enable reasoning. Reasoning is enabled by default. */ - enable_thinking?: boolean; - /** Use Nemotron low-effort reasoning, which consumes significantly fewer reasoning tokens. */ - low_effort?: boolean; - /** For coding agents, force non-empty assistant content. */ - force_nonempty_content?: boolean; -} -export type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< - ChatCompletionsMessagesInput, - "reasoning_effort" | "chat_template_kwargs" -> & { - chat_template_kwargs?: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_ChatTemplateKwargs; -}; export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +export type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< + "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", + boolean +> & { + /** + * @default false + */ + skip_special_tokens?: boolean; +}; export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: ChatCompletionsInput< - "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", - boolean - >; + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput< - "high" | "none" | "low" | "medium" | "max", - true - >; + inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { @@ -11742,7 +11733,7 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"xhigh" | "medium" | "low", boolean>; + inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { @@ -11913,7 +11904,7 @@ export type AiModelsSearchObject = { }; export type ChatCompletionsBase = ChatCompletionsMessagesInput; export type ChatCompletionsInput< - Effort extends string = "low" | "medium" | "high", + Effort extends string = ChatCompletionsReasoningEffort, ThinkingEnabled extends boolean = boolean, > = ChatCompletionsMessagesInput; export interface InferenceUpstreamError extends Error {} diff --git a/types/test/types/ai-reasoning.ts b/types/test/types/ai-reasoning.ts index 3f52198d1d5..4ec88d3f12e 100644 --- a/types/test/types/ai-reasoning.ts +++ b/types/test/types/ai-reasoning.ts @@ -20,17 +20,9 @@ void ai.run('@cf/moonshotai/kimi-k2.6', { }); void ai.run('@cf/zai-org/glm-5.3', { messages, reasoning_effort: 'max' }); void ai.run('@cf/zai-org/glm-5.3-flash', { messages, reasoning_effort: 'max' }); -void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { - messages, - chat_template_kwargs: { - enable_thinking: true, - low_effort: true, - force_nonempty_content: true, - }, -}); -void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { +void ai.run('@cf/google/gemma-4-26b-a4b-it', { messages, - chat_template_kwargs: { enable_thinking: false }, + skip_special_tokens: true, }); void ai.run('@cf/qwen/qwen3.8-27b', { messages, @@ -50,10 +42,9 @@ void ai.run('@cf/openai/gpt-oss-20b', { reasoning: { effort: 'medium' }, }); void ai.run('@cf/openai/gpt-oss-120b', { messages, reasoning_effort: 'high' }); -// A legacy alias is an accepted input even when it does not disable reasoning. void ai.run('@cf/moonshotai/kimi-k2.7-code', { messages, - reasoning_effort: 'none', + reasoning_effort: 'high', }); // @ts-expect-error: an unsupported effort must not reach the gateway fallback overload @@ -71,16 +62,11 @@ void ai.run('@cf/moonshotai/kimi-k2.7-code', { messages, chat_template_kwargs: { enable_thinking: false }, }); -// @ts-expect-error: Nemotron uses native chat-template controls, not reasoning_effort -void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { +// @ts-expect-error: GLM 4.7 Flash only toggles reasoning; it has no effort levels +void ai.run('@cf/zai-org/glm-4.7-flash', { messages, reasoning_effort: 'low', }); -// @ts-expect-error: Nemotron does not support the generic clear_thinking control -void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { - messages, - chat_template_kwargs: { enable_thinking: true, clear_thinking: false }, -}); // @ts-expect-error: Qwen 3.8 does not accept none reasoning effort void ai.run('@cf/qwen/qwen3.8-27b', { messages, From 0b36e1d640a7f55bd71dcea3797dcb32fb958063 Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Tue, 22 Sep 2026 13:27:11 -0700 Subject: [PATCH 05/11] fix(types): match generated Gemma 4 class name and keep the original as an alias --- types/defines/ai.d.ts | 10 ++++++---- types/generated-snapshot/experimental/index.d.ts | 10 ++++++---- types/generated-snapshot/experimental/index.ts | 10 ++++++---- types/generated-snapshot/index.d.ts | 10 ++++++---- types/generated-snapshot/index.ts | 10 ++++++---- types/test/types/ai-reasoning.ts | 9 +++++++++ 6 files changed, 39 insertions(+), 20 deletions(-) diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index 863ac3a39f3..a1e6599608c 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -5839,16 +5839,18 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput<"high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean> & { +export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput<"high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean> & { /** * @default false */ skip_special_tokens?: boolean; }; -export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; +export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } +/** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ +export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; @@ -6102,7 +6104,7 @@ export interface AiModels { "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5; "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; - "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT; + "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 0d8d3632549..44842503b7b 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11832,7 +11832,7 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< +type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput< "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean > & { @@ -11841,10 +11841,12 @@ type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< */ skip_special_tokens?: boolean; }; -declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; +declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } +/** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ +declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; @@ -12112,7 +12114,7 @@ interface AiModels { "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5; "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; - "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT; + "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 6f0ca3d202b..600c6b2b951 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11844,7 +11844,7 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< +export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput< "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean > & { @@ -11853,10 +11853,12 @@ export type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< */ skip_special_tokens?: boolean; }; -export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; +export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } +/** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ +export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; @@ -12124,7 +12126,7 @@ export interface AiModels { "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5; "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; - "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT; + "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index c3282460b97..3492a673024 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -11549,7 +11549,7 @@ declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< +type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput< "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean > & { @@ -11558,10 +11558,12 @@ type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< */ skip_special_tokens?: boolean; }; -declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; +declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } +/** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ +declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; @@ -11829,7 +11831,7 @@ interface AiModels { "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5; "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; - "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT; + "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index 51f752f510b..3316e19bf40 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -11561,7 +11561,7 @@ export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< +export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput< "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean > & { @@ -11570,10 +11570,12 @@ export type Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input = ChatCompletionsInput< */ skip_special_tokens?: boolean; }; -export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { - inputs: Ai_Cf_Google_Gemma_4_26B_A4B_IT_Input; +export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { + inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } +/** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ +export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; @@ -11841,7 +11843,7 @@ export interface AiModels { "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5; "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; - "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT; + "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/test/types/ai-reasoning.ts b/types/test/types/ai-reasoning.ts index 4ec88d3f12e..1b930e4b59d 100644 --- a/types/test/types/ai-reasoning.ts +++ b/types/test/types/ai-reasoning.ts @@ -82,3 +82,12 @@ void ai.run('@cf/openai/gpt-oss-20b', { input: 'Hello', service_tier: 'priority', }); + +// The original Gemma class name remains available for existing code. +const legacyGemma: Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT['inputs'] = { + messages, + reasoning_effort: 'none', +}; +const gemmaInputs: AiModels['@cf/google/gemma-4-26b-a4b-it']['inputs'] = + legacyGemma; +void gemmaInputs; From 415663970119adfaa2ffd83f0d939e0474da1c6f Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Tue, 22 Sep 2026 14:20:58 -0700 Subject: [PATCH 06/11] fix(types): make Workers AI reasoning types suggestions instead of restrictions Regenerated from the SDK generator (cloudflare/ai/sdk!1778) against production model metadata. No code that type-checked before is rejected: - `AiReasoningEffortHint` suggests a model's supported efforts in editors but accepts any string. Shared Chat Completions `reasoning_effort` and Responses request `reasoning.effort` use it too. - Response types (`Reasoning`, `ReasoningEffort`, outputs) are unchanged. - Models with reasoning metadata get `_ChatInput` / `_ChatTemplateKwargs` (and `_ResponsesInput` / `_Reasoning` for gpt-oss) interfaces extending the shared types with per-model docs: supported levels, aliases, defaults, and whether reasoning can be disabled. - `enable_thinking` stays `boolean` for every model. - Adds the public `@cf/zai-org/glm-5.3` model. - Keeps `Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT` as a deprecated alias of the generated `..._It` class. --- types/defines/ai.d.ts | 296 ++++++++++++++-- .../experimental/index.d.ts | 332 ++++++++++++++---- .../generated-snapshot/experimental/index.ts | 332 ++++++++++++++---- types/generated-snapshot/index.d.ts | 332 ++++++++++++++---- types/generated-snapshot/index.ts | 332 ++++++++++++++---- types/test/types/ai-reasoning.ts | 141 +++++--- 6 files changed, 1447 insertions(+), 318 deletions(-) diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index a1e6599608c..385befac771 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -521,19 +521,26 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -/** Default reasoning efforts for models without published reasoning metadata. */ +/** + * A reasoning effort. The listed values are suggestions: the efforts the model supports. + * Any other string also type-checks, so new or provider-specific efforts are never blocked + * by the types, but the model may reject or ignore values it does not support. + */ +export type AiReasoningEffortHint = + | Suggested + | (string & NonNullable); + +/** Reasoning efforts suggested for models without published reasoning metadata. */ export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; -export type ChatTemplateKwargs = { + +export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ - enable_thinking?: ThinkingEnabled; + enable_thinking?: boolean; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -export type ChatCompletionsCommonOptions< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +export type ChatCompletionsCommonOptions = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -548,8 +555,9 @@ export type ChatCompletionsCommonOptions< parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: Effort | null; - chat_template_kwargs?: ChatTemplateKwargs; + /** Reasoning effort. Supported levels depend on the model. */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -638,12 +646,9 @@ export type ChatCompletionChoice = { logprobs: ChatCompletionLogprobs | null; }; -export type ChatCompletionsMessagesInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +export type ChatCompletionsMessagesInput = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; export type ChatCompletionsOutput = { id: string; @@ -666,7 +671,7 @@ export type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -export type ResponsesInput = { +export type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -676,7 +681,7 @@ export type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: ResponsesInputReasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -737,8 +742,18 @@ export type ResponsePrompt = { } | null; version?: string | null; }; -export type Reasoning = { - effort?: Effort | null; +/** + * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses + * echo back), `effort` suggests the shared efforts but accepts any string, like + * AiReasoningEffortHint (spelled out because this file cannot import it). + */ +export interface ResponsesInputReasoning extends Omit { + /** Reasoning effort. Supported levels depend on the model. */ + effort?: Exclude | (string & NonNullable) | null; +} + +export type Reasoning = { + effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -4737,12 +4752,68 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } +export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; +} +export interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +export interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; +} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { - inputs: XOR, ChatCompletionsInput<"low" | "medium" | "high", true>>; + inputs: XOR; postProcessedOutputs: XOR; } +export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; +} +export interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +export interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; +} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { - inputs: XOR, ChatCompletionsInput<"low" | "medium" | "high", true>>; + inputs: XOR; postProcessedOutputs: XOR; } export interface Ai_Cf_Leonardo_Phoenix_1_0_Input { @@ -5823,23 +5894,70 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } +export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput<"high" | "none" | "low" | "medium" | "max", boolean>; + inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput<"high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", boolean> & { +export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; +} +export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { /** * @default false */ @@ -5851,12 +5969,40 @@ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput<"max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", boolean>; + inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -5992,24 +6138,109 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput<"max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", boolean>; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput<"max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", boolean>; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; + inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: ChatCompletionsInput<"max" | "high" | "low" | "none" | "medium", true>; + inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput<"max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", true>; + inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } @@ -6167,10 +6398,7 @@ export type AiModelsSearchObject = { }; export type ChatCompletionsBase = ChatCompletionsMessagesInput; -export type ChatCompletionsInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = ChatCompletionsMessagesInput; +export type ChatCompletionsInput = ChatCompletionsMessagesInput; export interface InferenceUpstreamError extends Error {} export interface AiInternalError extends Error {} diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 44842503b7b..19825cf9cef 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -6483,19 +6483,25 @@ type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -/** Default reasoning efforts for models without published reasoning metadata. */ +/** + * A reasoning effort. The listed values are suggestions: the efforts the model supports. + * Any other string also type-checks, so new or provider-specific efforts are never blocked + * by the types, but the model may reject or ignore values it does not support. + */ +type AiReasoningEffortHint = + Suggested | (string & NonNullable); + +/** Reasoning efforts suggested for models without published reasoning metadata. */ type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; -type ChatTemplateKwargs = { + +type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ - enable_thinking?: ThinkingEnabled; + enable_thinking?: boolean; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -type ChatCompletionsCommonOptions< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +type ChatCompletionsCommonOptions = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -6510,8 +6516,9 @@ type ChatCompletionsCommonOptions< parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: Effort | null; - chat_template_kwargs?: ChatTemplateKwargs; + /** Reasoning effort. Supported levels depend on the model. */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -6600,12 +6607,9 @@ type ChatCompletionChoice = { "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; logprobs: ChatCompletionLogprobs | null; }; -type ChatCompletionsMessagesInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +type ChatCompletionsMessagesInput = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; type ChatCompletionsOutput = { id: string; object: string; @@ -6626,7 +6630,7 @@ type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -type ResponsesInput = { +type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -6636,7 +6640,7 @@ type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: ResponsesInputReasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6697,8 +6701,19 @@ type ResponsePrompt = { } | null; version?: string | null; }; -type Reasoning = { - effort?: Effort | null; +/** + * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses + * echo back), `effort` suggests the shared efforts but accepts any string, like + * AiReasoningEffortHint (spelled out because this file cannot import it). + */ +interface ResponsesInputReasoning extends Omit { + /** Reasoning effort. Supported levels depend on the model. */ + effort?: + Exclude | (string & NonNullable) | null; +} + +type Reasoning = { + effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -10720,17 +10735,73 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } +interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; +} +interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; +} declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< - ResponsesInput<"low" | "medium" | "high">, - ChatCompletionsInput<"low" | "medium" | "high", true> + Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput, + Ai_Cf_Openai_Gpt_Oss_120B_ChatInput >; postProcessedOutputs: XOR; } +interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; +} +interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; +} declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< - ResponsesInput<"low" | "medium" | "high">, - ChatCompletionsInput<"low" | "medium" | "high", true> + Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput, + Ai_Cf_Openai_Gpt_Oss_20B_ChatInput >; postProcessedOutputs: XOR; } @@ -11813,49 +11884,116 @@ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } +interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput< - "high" | "none" | "low" | "medium" | "max", - boolean - >; + inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput< - "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", - boolean -> & { +interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { /** - * @default false + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. */ - skip_special_tokens?: boolean; -}; + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; +} +type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = + Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { + /** + * @default false + */ + skip_special_tokens?: boolean; + }; declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput< - "max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", - boolean - >; + inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -11991,36 +12129,113 @@ declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } +interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - boolean - >; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - boolean - >; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; + inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "medium", - true - >; + inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - true - >; + inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } interface AiModels { @@ -12176,10 +12391,7 @@ type AiModelsSearchObject = { }[]; }; type ChatCompletionsBase = ChatCompletionsMessagesInput; -type ChatCompletionsInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = ChatCompletionsMessagesInput; +type ChatCompletionsInput = ChatCompletionsMessagesInput; interface InferenceUpstreamError extends Error {} interface AiInternalError extends Error {} type AiModelListType = Record; diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 600c6b2b951..47cbcb22488 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -6494,19 +6494,25 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -/** Default reasoning efforts for models without published reasoning metadata. */ +/** + * A reasoning effort. The listed values are suggestions: the efforts the model supports. + * Any other string also type-checks, so new or provider-specific efforts are never blocked + * by the types, but the model may reject or ignore values it does not support. + */ +export type AiReasoningEffortHint = + Suggested | (string & NonNullable); + +/** Reasoning efforts suggested for models without published reasoning metadata. */ export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; -export type ChatTemplateKwargs = { + +export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ - enable_thinking?: ThinkingEnabled; + enable_thinking?: boolean; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -export type ChatCompletionsCommonOptions< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +export type ChatCompletionsCommonOptions = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -6521,8 +6527,9 @@ export type ChatCompletionsCommonOptions< parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: Effort | null; - chat_template_kwargs?: ChatTemplateKwargs; + /** Reasoning effort. Supported levels depend on the model. */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -6611,12 +6618,9 @@ export type ChatCompletionChoice = { "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; logprobs: ChatCompletionLogprobs | null; }; -export type ChatCompletionsMessagesInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +export type ChatCompletionsMessagesInput = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; export type ChatCompletionsOutput = { id: string; object: string; @@ -6637,7 +6641,7 @@ export type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -export type ResponsesInput = { +export type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -6647,7 +6651,7 @@ export type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: ResponsesInputReasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6708,8 +6712,19 @@ export type ResponsePrompt = { } | null; version?: string | null; }; -export type Reasoning = { - effort?: Effort | null; +/** + * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses + * echo back), `effort` suggests the shared efforts but accepts any string, like + * AiReasoningEffortHint (spelled out because this file cannot import it). + */ +export interface ResponsesInputReasoning extends Omit { + /** Reasoning effort. Supported levels depend on the model. */ + effort?: + Exclude | (string & NonNullable) | null; +} + +export type Reasoning = { + effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -10732,17 +10747,73 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } +export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; +} +export interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +export interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; +} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< - ResponsesInput<"low" | "medium" | "high">, - ChatCompletionsInput<"low" | "medium" | "high", true> + Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput, + Ai_Cf_Openai_Gpt_Oss_120B_ChatInput >; postProcessedOutputs: XOR; } +export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; +} +export interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +export interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; +} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< - ResponsesInput<"low" | "medium" | "high">, - ChatCompletionsInput<"low" | "medium" | "high", true> + Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput, + Ai_Cf_Openai_Gpt_Oss_20B_ChatInput >; postProcessedOutputs: XOR; } @@ -11825,49 +11896,116 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } +export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput< - "high" | "none" | "low" | "medium" | "max", - boolean - >; + inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput< - "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", - boolean -> & { +export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { /** - * @default false + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. */ - skip_special_tokens?: boolean; -}; + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; +} +export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = + Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { + /** + * @default false + */ + skip_special_tokens?: boolean; + }; export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput< - "max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", - boolean - >; + inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -12003,36 +12141,113 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - boolean - >; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - boolean - >; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; + inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "medium", - true - >; + inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - true - >; + inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export interface AiModels { @@ -12188,10 +12403,7 @@ export type AiModelsSearchObject = { }[]; }; export type ChatCompletionsBase = ChatCompletionsMessagesInput; -export type ChatCompletionsInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = ChatCompletionsMessagesInput; +export type ChatCompletionsInput = ChatCompletionsMessagesInput; export interface InferenceUpstreamError extends Error {} export interface AiInternalError extends Error {} export type AiModelListType = Record; diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index 3492a673024..a7df7f9bf69 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -6200,19 +6200,25 @@ type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -/** Default reasoning efforts for models without published reasoning metadata. */ +/** + * A reasoning effort. The listed values are suggestions: the efforts the model supports. + * Any other string also type-checks, so new or provider-specific efforts are never blocked + * by the types, but the model may reject or ignore values it does not support. + */ +type AiReasoningEffortHint = + Suggested | (string & NonNullable); + +/** Reasoning efforts suggested for models without published reasoning metadata. */ type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; -type ChatTemplateKwargs = { + +type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ - enable_thinking?: ThinkingEnabled; + enable_thinking?: boolean; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -type ChatCompletionsCommonOptions< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +type ChatCompletionsCommonOptions = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -6227,8 +6233,9 @@ type ChatCompletionsCommonOptions< parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: Effort | null; - chat_template_kwargs?: ChatTemplateKwargs; + /** Reasoning effort. Supported levels depend on the model. */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -6317,12 +6324,9 @@ type ChatCompletionChoice = { "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; logprobs: ChatCompletionLogprobs | null; }; -type ChatCompletionsMessagesInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +type ChatCompletionsMessagesInput = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; type ChatCompletionsOutput = { id: string; object: string; @@ -6343,7 +6347,7 @@ type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -type ResponsesInput = { +type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -6353,7 +6357,7 @@ type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: ResponsesInputReasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6414,8 +6418,19 @@ type ResponsePrompt = { } | null; version?: string | null; }; -type Reasoning = { - effort?: Effort | null; +/** + * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses + * echo back), `effort` suggests the shared efforts but accepts any string, like + * AiReasoningEffortHint (spelled out because this file cannot import it). + */ +interface ResponsesInputReasoning extends Omit { + /** Reasoning effort. Supported levels depend on the model. */ + effort?: + Exclude | (string & NonNullable) | null; +} + +type Reasoning = { + effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -10437,17 +10452,73 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } +interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; +} +interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; +} declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< - ResponsesInput<"low" | "medium" | "high">, - ChatCompletionsInput<"low" | "medium" | "high", true> + Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput, + Ai_Cf_Openai_Gpt_Oss_120B_ChatInput >; postProcessedOutputs: XOR; } +interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; +} +interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; +} declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< - ResponsesInput<"low" | "medium" | "high">, - ChatCompletionsInput<"low" | "medium" | "high", true> + Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput, + Ai_Cf_Openai_Gpt_Oss_20B_ChatInput >; postProcessedOutputs: XOR; } @@ -11530,49 +11601,116 @@ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } +interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput< - "high" | "none" | "low" | "medium" | "max", - boolean - >; + inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput< - "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", - boolean -> & { +interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { /** - * @default false + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. */ - skip_special_tokens?: boolean; -}; + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; +} +type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = + Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { + /** + * @default false + */ + skip_special_tokens?: boolean; + }; declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput< - "max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", - boolean - >; + inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -11708,36 +11846,113 @@ declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } +interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - boolean - >; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - boolean - >; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; + inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "medium", - true - >; + inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; +} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - true - >; + inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } interface AiModels { @@ -11893,10 +12108,7 @@ type AiModelsSearchObject = { }[]; }; type ChatCompletionsBase = ChatCompletionsMessagesInput; -type ChatCompletionsInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = ChatCompletionsMessagesInput; +type ChatCompletionsInput = ChatCompletionsMessagesInput; interface InferenceUpstreamError extends Error {} interface AiInternalError extends Error {} type AiModelListType = Record; diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index 3316e19bf40..dc59413b467 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -6211,19 +6211,25 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; -/** Default reasoning efforts for models without published reasoning metadata. */ +/** + * A reasoning effort. The listed values are suggestions: the efforts the model supports. + * Any other string also type-checks, so new or provider-specific efforts are never blocked + * by the types, but the model may reject or ignore values it does not support. + */ +export type AiReasoningEffortHint = + Suggested | (string & NonNullable); + +/** Reasoning efforts suggested for models without published reasoning metadata. */ export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; -export type ChatTemplateKwargs = { + +export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ - enable_thinking?: ThinkingEnabled; + enable_thinking?: boolean; /** If false, preserves reasoning context between turns. */ clear_thinking?: boolean; }; /** Shared optional properties used by both Prompt and Messages input branches. */ -export type ChatCompletionsCommonOptions< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +export type ChatCompletionsCommonOptions = { model?: string; audio?: AudioParams; frequency_penalty?: number | null; @@ -6238,8 +6244,9 @@ export type ChatCompletionsCommonOptions< parallel_tool_calls?: boolean; prediction?: PredictionContent; presence_penalty?: number | null; - reasoning_effort?: Effort | null; - chat_template_kwargs?: ChatTemplateKwargs; + /** Reasoning effort. Supported levels depend on the model. */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; @@ -6328,12 +6335,9 @@ export type ChatCompletionChoice = { "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; logprobs: ChatCompletionLogprobs | null; }; -export type ChatCompletionsMessagesInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = { +export type ChatCompletionsMessagesInput = { messages: Array; -} & ChatCompletionsCommonOptions; +} & ChatCompletionsCommonOptions; export type ChatCompletionsOutput = { id: string; object: string; @@ -6354,7 +6358,7 @@ export type ChatCompletionsOutput = { * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. * We plan to add those incrementally as model + platform capabilities evolve. */ -export type ResponsesInput = { +export type ResponsesInput = { background?: boolean | null; conversation?: string | ResponseConversationParam | null; include?: Array | null; @@ -6364,7 +6368,7 @@ export type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: Reasoning | null; + reasoning?: ResponsesInputReasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6425,8 +6429,19 @@ export type ResponsePrompt = { } | null; version?: string | null; }; -export type Reasoning = { - effort?: Effort | null; +/** + * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses + * echo back), `effort` suggests the shared efforts but accepts any string, like + * AiReasoningEffortHint (spelled out because this file cannot import it). + */ +export interface ResponsesInputReasoning extends Omit { + /** Reasoning effort. Supported levels depend on the model. */ + effort?: + Exclude | (string & NonNullable) | null; +} + +export type Reasoning = { + effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; summary?: "auto" | "concise" | "detailed" | null; }; @@ -10449,17 +10464,73 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } +export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; +} +export interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +export interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; +} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< - ResponsesInput<"low" | "medium" | "high">, - ChatCompletionsInput<"low" | "medium" | "high", true> + Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput, + Ai_Cf_Openai_Gpt_Oss_120B_ChatInput >; postProcessedOutputs: XOR; } +export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; +} +export interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; +} +export interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { + reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; +} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< - ResponsesInput<"low" | "medium" | "high">, - ChatCompletionsInput<"low" | "medium" | "high", true> + Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput, + Ai_Cf_Openai_Gpt_Oss_20B_ChatInput >; postProcessedOutputs: XOR; } @@ -11542,49 +11613,116 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } +export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: ChatCompletionsInput< - "high" | "none" | "low" | "medium" | "max", - boolean - >; + inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = ChatCompletionsInput< - "high" | "none" | "minimal" | "low" | "medium" | "max" | "auto", - boolean -> & { +export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { /** - * @default false + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. */ - skip_special_tokens?: boolean; -}; + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; +} +export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = + Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { + /** + * @default false + */ + skip_special_tokens?: boolean; + }; export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: ChatCompletionsInput< - "max" | "high" | "none" | "low" | "medium" | "xhigh" | "minimal", - boolean - >; + inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -11720,36 +11858,113 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - boolean - >; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - boolean - >; + inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: ChatCompletionsInput<"low" | "medium" | "xhigh", boolean>; + inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "medium", - true - >; + inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } +export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; +} +export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; +} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: ChatCompletionsInput< - "max" | "high" | "low" | "none" | "minimal" | "medium" | "xhigh", - true - >; + inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; postProcessedOutputs: ChatCompletionsOutput; } export interface AiModels { @@ -11905,10 +12120,7 @@ export type AiModelsSearchObject = { }[]; }; export type ChatCompletionsBase = ChatCompletionsMessagesInput; -export type ChatCompletionsInput< - Effort extends string = ChatCompletionsReasoningEffort, - ThinkingEnabled extends boolean = boolean, -> = ChatCompletionsMessagesInput; +export type ChatCompletionsInput = ChatCompletionsMessagesInput; export interface InferenceUpstreamError extends Error {} export interface AiInternalError extends Error {} export type AiModelListType = Record; diff --git a/types/test/types/ai-reasoning.ts b/types/test/types/ai-reasoning.ts index 1b930e4b59d..162854882f5 100644 --- a/types/test/types/ai-reasoning.ts +++ b/types/test/types/ai-reasoning.ts @@ -5,77 +5,119 @@ declare const ai: Ai; const messages = [{ role: 'user' as const, content: 'Hello' }]; -// Canonical controls and compatibility aliases remain accepted. +// Reasoning types suggest each model's supported efforts but never reject a +// value that type-checked before: any string effort and any boolean +// enable_thinking are accepted for every model. + +type Equal = + (() => X extends A ? 1 : 2) extends () => X extends B ? 1 : 2 + ? true + : false; +// The literal suggestions an effort type offers (drops the open `string` part). +type Suggested = T extends string ? (string extends T ? never : T) : never; +type ChatEffort = + AiModels[Model]['inputs'] extends infer Input + ? Input extends { reasoning_effort?: infer Effort } + ? Suggested> + : never + : never; +type ResponsesEffort = + AiModels[Model]['inputs'] extends infer Input + ? Input extends { reasoning?: infer Options } + ? NonNullable extends { effort?: infer Effort } + ? Suggested> + : never + : never + : never; + +// Suggestions are the canonical supported efforts from model metadata. +const glm52: Equal< + ChatEffort<'@cf/zai-org/glm-5.2'>, + 'max' | 'high' | 'none' +> = true; +const qwen: Equal< + ChatEffort<'@cf/qwen/qwen3.8-27b'>, + 'low' | 'medium' | 'xhigh' +> = true; +const gptOss: Equal< + ResponsesEffort<'@cf/openai/gpt-oss-20b'>, + 'low' | 'medium' | 'high' +> = true; +// Toggle-only models suggest no effort levels. +const glm47: Equal, never> = true; +const gemma: Equal, never> = true; +// Models without metadata keep the shared suggestions. +const shared: Equal< + ChatEffort<'@cf/nvidia/nemotron-3-120b-a12b'>, + 'low' | 'medium' | 'high' +> = true; +void [glm52, qwen, gptOss, glm47, gemma, shared]; + +// Values outside the suggestions still type-check. +void ai.run('@cf/qwen/qwen3.8-27b', { messages, reasoning_effort: 'high' }); +void ai.run('@cf/qwen/qwen3.8-27b', { messages, reasoning_effort: 'none' }); +void ai.run('@cf/zai-org/glm-4.7-flash', { messages, reasoning_effort: 'low' }); void ai.run('@cf/google/gemma-4-26b-a4b-it', { messages, reasoning_effort: 'none', }); void ai.run('@cf/google/gemma-4-26b-a4b-it', { messages, - reasoning_effort: 'auto', -}); -void ai.run('@cf/moonshotai/kimi-k2.6', { - messages, - reasoning_effort: 'medium', -}); -void ai.run('@cf/zai-org/glm-5.3', { messages, reasoning_effort: 'max' }); -void ai.run('@cf/zai-org/glm-5.3-flash', { messages, reasoning_effort: 'max' }); -void ai.run('@cf/google/gemma-4-26b-a4b-it', { - messages, - skip_special_tokens: true, -}); -void ai.run('@cf/qwen/qwen3.8-27b', { - messages, - reasoning_effort: 'xhigh', -}); -void ai.run('@cf/deepseek-ai/deepseek-v4-pro-0813', { - messages, - reasoning_effort: 'low', + reasoning_effort: 'turbo', }); -void ai.run('@cf/zai-org/glm-4.7-flash', { - messages, - chat_template_kwargs: { enable_thinking: false }, +void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: 'medium' }); +void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: null }); +void ai.run('@cf/openai/gpt-oss-20b', { + input: 'Hello', + reasoning: { effort: 'minimal' }, }); - void ai.run('@cf/openai/gpt-oss-20b', { input: 'Hello', - reasoning: { effort: 'medium' }, + reasoning: { effort: 'none' }, }); -void ai.run('@cf/openai/gpt-oss-120b', { messages, reasoning_effort: 'high' }); + +// enable_thinking stays boolean, including for models with mandatory reasoning. void ai.run('@cf/moonshotai/kimi-k2.7-code', { messages, - reasoning_effort: 'high', + chat_template_kwargs: { enable_thinking: false }, }); - -// @ts-expect-error: an unsupported effort must not reach the gateway fallback overload -void ai.run('@cf/google/gemma-4-26b-a4b-it', { +void ai.run('@cf/zai-org/glm-5.3', { messages, - reasoning_effort: 'turbo', + chat_template_kwargs: { enable_thinking: false }, }); -// @ts-expect-error: GPT-OSS reasoning is mandatory void ai.run('@cf/openai/gpt-oss-20b', { - input: 'Hello', - reasoning: { effort: 'none' }, -}); -// @ts-expect-error: mandatory reasoning cannot be disabled with enable_thinking -void ai.run('@cf/moonshotai/kimi-k2.7-code', { messages, chat_template_kwargs: { enable_thinking: false }, }); -// @ts-expect-error: GLM 4.7 Flash only toggles reasoning; it has no effort levels void ai.run('@cf/zai-org/glm-4.7-flash', { messages, - reasoning_effort: 'low', + chat_template_kwargs: { enable_thinking: false, clear_thinking: false }, }); -// @ts-expect-error: Qwen 3.8 does not accept none reasoning effort -void ai.run('@cf/qwen/qwen3.8-27b', { + +// Values typed with the shared types are accepted by every model. +declare const effort: string; +declare const flag: boolean; +declare const chatInput: ChatCompletionsInput; +declare const responsesInput: ResponsesInput; +void ai.run('@cf/zai-org/glm-5.2', { messages, - reasoning_effort: 'none', -}); + reasoning_effort: effort, + chat_template_kwargs: { enable_thinking: flag }, +}); +void ai.run('@cf/qwen/qwen3.8-27b', chatInput); +void ai.run('@cf/moonshotai/kimi-k2.6', chatInput); +void ai.run('@cf/google/gemma-4-26b-a4b-it', chatInput); +void ai.run('@cf/openai/gpt-oss-120b', chatInput); +void ai.run('@cf/openai/gpt-oss-120b', responsesInput); +const sharedReasoning: Reasoning = { effort: 'high' }; +const sharedOptions: ChatCompletionsCommonOptions = { reasoning_effort: 'max' }; +const sharedKwargs: ChatTemplateKwargs = { enable_thinking: false }; +void [sharedReasoning, sharedOptions, sharedKwargs]; -// Unrelated options remain available on both input formats. +// Other model-specific options are unaffected. void ai.run('@cf/google/gemma-4-26b-a4b-it', { messages, + skip_special_tokens: true, service_tier: 'priority', }); void ai.run('@cf/openai/gpt-oss-20b', { @@ -91,3 +133,14 @@ const legacyGemma: Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT['inputs'] = { const gemmaInputs: AiModels['@cf/google/gemma-4-26b-a4b-it']['inputs'] = legacyGemma; void gemmaInputs; + +// Types still reject values of the wrong kind. +// @ts-expect-error: efforts are strings +void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: 1 }); +// @ts-expect-error: enable_thinking is a boolean +void ai.run('@cf/moonshotai/kimi-k2.7-code', { + messages, + chat_template_kwargs: { enable_thinking: 'no' }, +}); +// @ts-expect-error: Responses and Chat Completions inputs are mutually exclusive +void ai.run('@cf/openai/gpt-oss-20b', { input: 'Hello', messages }); From 9a3bdd2c19d54a60645161cba0370518f64d18e5 Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Tue, 22 Sep 2026 14:41:03 -0700 Subject: [PATCH 07/11] fix(types): suggest no reasoning efforts for Kimi K2.7 Code Its metadata lists no supported efforts, so it has no effort levels even though reasoning is always on. reasoning_effort still accepts any string. --- types/defines/ai.d.ts | 4 ++++ types/generated-snapshot/experimental/index.d.ts | 4 ++++ types/generated-snapshot/experimental/index.ts | 4 ++++ types/generated-snapshot/index.d.ts | 4 ++++ types/generated-snapshot/index.ts | 4 ++++ types/test/types/ai-reasoning.ts | 7 ++++++- 6 files changed, 26 insertions(+), 1 deletion(-) diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index 385befac771..5400b02f8d1 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -5978,6 +5978,10 @@ export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends Chat enable_thinking?: boolean; } export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 19825cf9cef..d9b7f476a59 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -11969,6 +11969,10 @@ interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplat enable_thinking?: boolean; } interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 47cbcb22488..209bf5860aa 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -11981,6 +11981,10 @@ export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends Chat enable_thinking?: boolean; } export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index a7df7f9bf69..504d11351d2 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -11686,6 +11686,10 @@ interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplat enable_thinking?: boolean; } interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index dc59413b467..fe474ac16a6 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -11698,6 +11698,10 @@ export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends Chat enable_thinking?: boolean; } export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { diff --git a/types/test/types/ai-reasoning.ts b/types/test/types/ai-reasoning.ts index 162854882f5..d9ed9a9e233 100644 --- a/types/test/types/ai-reasoning.ts +++ b/types/test/types/ai-reasoning.ts @@ -46,12 +46,17 @@ const gptOss: Equal< // Toggle-only models suggest no effort levels. const glm47: Equal, never> = true; const gemma: Equal, never> = true; +// So do models whose metadata lists no efforts, even if reasoning is always on. +const kimiCode: Equal< + ChatEffort<'@cf/moonshotai/kimi-k2.7-code'>, + never +> = true; // Models without metadata keep the shared suggestions. const shared: Equal< ChatEffort<'@cf/nvidia/nemotron-3-120b-a12b'>, 'low' | 'medium' | 'high' > = true; -void [glm52, qwen, gptOss, glm47, gemma, shared]; +void [glm52, qwen, gptOss, glm47, gemma, kimiCode, shared]; // Values outside the suggestions still type-check. void ai.run('@cf/qwen/qwen3.8-27b', { messages, reasoning_effort: 'high' }); From 2379168a69b757bbb77f7b63e0414de171fd52cc Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Tue, 22 Sep 2026 14:52:52 -0700 Subject: [PATCH 08/11] fix(types): inline per-model Workers AI reasoning types Replace the exported per-model reasoning interfaces with unnamed types on each model's Base_ class. Editor suggestions and per-model docs are unchanged, and no new per-model type names are published, so editing model metadata can never remove a name that user code references. --- types/defines/ai.d.ts | 431 ++++++++-------- .../experimental/index.d.ts | 483 +++++++++--------- .../generated-snapshot/experimental/index.ts | 483 +++++++++--------- types/generated-snapshot/index.d.ts | 483 +++++++++--------- types/generated-snapshot/index.ts | 483 +++++++++--------- 5 files changed, 1187 insertions(+), 1176 deletions(-) diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index 5400b02f8d1..7e061b1383e 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -4752,68 +4752,60 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } -export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; -} -export interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -export interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; -} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { - inputs: XOR; + inputs: XOR & { + reasoning?: (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) | null; + }, Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }>; postProcessedOutputs: XOR; } -export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; -} -export interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -export interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; -} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { - inputs: XOR; + inputs: XOR & { + reasoning?: (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) | null; + }, Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }>; postProcessedOutputs: XOR; } export interface Ai_Cf_Leonardo_Phoenix_1_0_Input { @@ -5894,70 +5886,67 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } -export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; + inputs: Omit & { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; + inputs: Omit & { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { +export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" +> & { /** * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. */ reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; -} -export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; +} & { /** * @default false */ @@ -5969,44 +5958,40 @@ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} -export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; + inputs: Omit & { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; + inputs: Omit & { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -6142,109 +6127,99 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; + inputs: Omit & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; + inputs: Omit & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, xhigh. - * - * @default "xhigh" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; - chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; + inputs: Omit & { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; + inputs: Omit & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; + inputs: Omit & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index d9b7f476a59..86cf5c118c7 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -10735,73 +10735,73 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } -interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; -} -interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; -} declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< - Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput, - Ai_Cf_Openai_Gpt_Oss_120B_ChatInput + Omit & { + reasoning?: + | (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) + | null; + }, + Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint< + "low" | "medium" | "high" + > | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + } >; postProcessedOutputs: XOR; } -interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; -} -interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; -} declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< - Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput, - Ai_Cf_Openai_Gpt_Oss_20B_ChatInput + Omit & { + reasoning?: + | (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) + | null; + }, + Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint< + "low" | "medium" | "high" + > | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + } >; postProcessedOutputs: XOR; } @@ -11884,120 +11884,124 @@ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } -interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { +type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" +> & { /** * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. */ reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; -} -type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = - Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { + chat_template_kwargs?: Omit & { /** - * @default false + * Whether to enable reasoning for this model. + * + * @default true */ - skip_special_tokens?: boolean; + enable_thinking?: boolean; }; +} & { + /** + * @default false + */ + skip_special_tokens?: boolean; +}; declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} -interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -12133,113 +12137,118 @@ declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } -interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, xhigh. - * - * @default "xhigh" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; - chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } interface AiModels { diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 209bf5860aa..2d8c4f200f6 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -10747,73 +10747,73 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } -export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; -} -export interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -export interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; -} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< - Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput, - Ai_Cf_Openai_Gpt_Oss_120B_ChatInput + Omit & { + reasoning?: + | (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) + | null; + }, + Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint< + "low" | "medium" | "high" + > | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + } >; postProcessedOutputs: XOR; } -export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; -} -export interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -export interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; -} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< - Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput, - Ai_Cf_Openai_Gpt_Oss_20B_ChatInput + Omit & { + reasoning?: + | (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) + | null; + }, + Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint< + "low" | "medium" | "high" + > | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + } >; postProcessedOutputs: XOR; } @@ -11896,120 +11896,124 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } -export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { +export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" +> & { /** * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. */ reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; -} -export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = - Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { + chat_template_kwargs?: Omit & { /** - * @default false + * Whether to enable reasoning for this model. + * + * @default true */ - skip_special_tokens?: boolean; + enable_thinking?: boolean; }; +} & { + /** + * @default false + */ + skip_special_tokens?: boolean; +}; export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} -export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -12145,113 +12149,118 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, xhigh. - * - * @default "xhigh" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; - chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export interface AiModels { diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index 504d11351d2..2690a23269f 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -10452,73 +10452,73 @@ declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } -interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; -} -interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; -} declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< - Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput, - Ai_Cf_Openai_Gpt_Oss_120B_ChatInput + Omit & { + reasoning?: + | (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) + | null; + }, + Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint< + "low" | "medium" | "high" + > | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + } >; postProcessedOutputs: XOR; } -interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; -} -interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; -} declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< - Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput, - Ai_Cf_Openai_Gpt_Oss_20B_ChatInput + Omit & { + reasoning?: + | (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) + | null; + }, + Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint< + "low" | "medium" | "high" + > | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + } >; postProcessedOutputs: XOR; } @@ -11601,120 +11601,124 @@ declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } -interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { +type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" +> & { /** * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. */ reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; -} -type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = - Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { + chat_template_kwargs?: Omit & { /** - * @default false + * Whether to enable reasoning for this model. + * + * @default true */ - skip_special_tokens?: boolean; + enable_thinking?: boolean; }; +} & { + /** + * @default false + */ + skip_special_tokens?: boolean; +}; declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} -interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -11850,113 +11854,118 @@ declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } -interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, xhigh. - * - * @default "xhigh" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; - chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; -} declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } interface AiModels { diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index fe474ac16a6..ca2a1d9af80 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -10464,73 +10464,73 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; } -export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Openai_Gpt_Oss_120B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_120B_ChatTemplateKwargs; -} -export interface Ai_Cf_Openai_Gpt_Oss_120B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -export interface Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_120B_Reasoning | null; -} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< - Ai_Cf_Openai_Gpt_Oss_120B_ResponsesInput, - Ai_Cf_Openai_Gpt_Oss_120B_ChatInput + Omit & { + reasoning?: + | (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) + | null; + }, + Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint< + "low" | "medium" | "high" + > | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + } >; postProcessedOutputs: XOR; } -export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Openai_Gpt_Oss_20B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; - chat_template_kwargs?: Ai_Cf_Openai_Gpt_Oss_20B_ChatTemplateKwargs; -} -export interface Ai_Cf_Openai_Gpt_Oss_20B_Reasoning extends ResponsesInputReasoning { - /** - * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. - * - * @default "medium" - */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; -} -export interface Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput extends ResponsesInput { - reasoning?: Ai_Cf_Openai_Gpt_Oss_20B_Reasoning | null; -} export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< - Ai_Cf_Openai_Gpt_Oss_20B_ResponsesInput, - Ai_Cf_Openai_Gpt_Oss_20B_ChatInput + Omit & { + reasoning?: + | (Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + }) + | null; + }, + Omit & { + /** + * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. + * + * @default "medium" + */ + reasoning_effort?: AiReasoningEffortHint< + "low" | "medium" | "high" + > | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + } >; postProcessedOutputs: XOR; } @@ -11613,120 +11613,124 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; } -export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { - inputs: Ai_Cf_Zai_Org_Glm_4_7_Flash_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_6_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { - inputs: Ai_Cf_Moonshotai_Kimi_K2_6_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput extends ChatCompletionsInput { +export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" +> & { /** * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. */ reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatTemplateKwargs; -} -export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = - Ai_Cf_Google_Gemma_4_26B_A4B_It_ChatInput & { + chat_template_kwargs?: Omit & { /** - * @default false + * Whether to enable reasoning for this model. + * + * @default true */ - skip_special_tokens?: boolean; + enable_thinking?: boolean; }; +} & { + /** + * @default false + */ + skip_special_tokens?: boolean; +}; export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { inputs: Ai_Cf_Google_Gemma_4_26B_A4B_It_Input; postProcessedOutputs: ChatCompletionsOutput; } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} -export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput extends ChatCompletionsInput { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; - chat_template_kwargs?: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { - inputs: Ai_Cf_Moonshotai_Kimi_K2_7_Code_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * This model has no reasoning effort levels. Reasoning is always enabled. + */ + reasoning_effort?: AiReasoningEffortHint | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_5_2_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_2_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { - inputs: Ai_Cf_Zai_Org_Glm_5_2_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { @@ -11862,113 +11866,118 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; } -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. - * - * @default "high" - */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; - chat_template_kwargs?: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { - inputs: Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * + * @default "high" + */ + reasoning_effort?: AiReasoningEffortHint< + "max" | "high" | "low" | "none" + > | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Whether to enable reasoning for this model. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Qwen_Qwen3_8_27B_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: low, medium, xhigh. - * - * @default "xhigh" - */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; - chat_template_kwargs?: Ai_Cf_Qwen_Qwen3_8_27B_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { - inputs: Ai_Cf_Qwen_Qwen3_8_27B_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: low, medium, xhigh. + * + * @default "xhigh" + */ + reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + chat_template_kwargs?: Omit & { + /** + * Whether to enable reasoning for this model. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_5_3_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { - inputs: Ai_Cf_Zai_Org_Glm_5_3_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } -export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs extends ChatTemplateKwargs { - /** - * Reasoning is always enabled for this model and cannot be disabled. - * - * @default true - */ - enable_thinking?: boolean; -} -export interface Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput extends ChatCompletionsInput { - /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. - * - * @default "max" - */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; - chat_template_kwargs?: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatTemplateKwargs; -} export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { - inputs: Ai_Cf_Zai_Org_Glm_5_3_Flash_ChatInput; + inputs: Omit< + ChatCompletionsInput, + "reasoning_effort" | "chat_template_kwargs" + > & { + /** + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * + * @default "max" + */ + reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + chat_template_kwargs?: Omit & { + /** + * Reasoning is always enabled for this model and cannot be disabled. + * + * @default true + */ + enable_thinking?: boolean; + }; + }; postProcessedOutputs: ChatCompletionsOutput; } export interface AiModels { From e30f033637cb064af8f9fb47eeb5e524af2cecdd Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Tue, 22 Sep 2026 15:00:02 -0700 Subject: [PATCH 09/11] docs(types): point Workers AI reasoning types at their source of truth --- types/defines/ai.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index 7e061b1383e..b2b2a82a5f5 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -521,6 +521,11 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +// Source of truth for per-model reasoning types: each model's `reasoning_effort` metadata +// in Workers AI ConfigAPI (supported efforts, aliases, defaults, and whether reasoning can +// be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, +// apps/worker-constellation-entry/scripts/build-types) turns it into the per-model +// `inputs` types below; the developer docs model schemas come from the same metadata. /** * A reasoning effort. The listed values are suggestions: the efforts the model supports. * Any other string also type-checks, so new or provider-specific efforts are never blocked From 18cb3ce7aa1178394390bf075e5c5054e2e6d935 Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Tue, 22 Sep 2026 15:38:49 -0700 Subject: [PATCH 10/11] chore(types): regenerate snapshots with bazel --- types/generated-snapshot/experimental/index.d.ts | 8 +++++--- types/generated-snapshot/experimental/index.ts | 8 +++++--- types/generated-snapshot/index.d.ts | 8 +++++--- types/generated-snapshot/index.ts | 8 +++++--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 86cf5c118c7..1f33d60f7fd 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -6483,6 +6483,11 @@ type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +// Source of truth for per-model reasoning types: each model's `reasoning_effort` metadata +// in Workers AI ConfigAPI (supported efforts, aliases, defaults, and whether reasoning can +// be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, +// apps/worker-constellation-entry/scripts/build-types) turns it into the per-model +// `inputs` types below; the developer docs model schemas come from the same metadata. /** * A reasoning effort. The listed values are suggestions: the efforts the model supports. * Any other string also type-checks, so new or provider-specific efforts are never blocked @@ -6490,10 +6495,8 @@ type WebSearchOptions = { */ type AiReasoningEffortHint = Suggested | (string & NonNullable); - /** Reasoning efforts suggested for models without published reasoning metadata. */ type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; - type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: boolean; @@ -6711,7 +6714,6 @@ interface ResponsesInputReasoning extends Omit { effort?: Exclude | (string & NonNullable) | null; } - type Reasoning = { effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 2d8c4f200f6..c70d9180bfe 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -6494,6 +6494,11 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +// Source of truth for per-model reasoning types: each model's `reasoning_effort` metadata +// in Workers AI ConfigAPI (supported efforts, aliases, defaults, and whether reasoning can +// be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, +// apps/worker-constellation-entry/scripts/build-types) turns it into the per-model +// `inputs` types below; the developer docs model schemas come from the same metadata. /** * A reasoning effort. The listed values are suggestions: the efforts the model supports. * Any other string also type-checks, so new or provider-specific efforts are never blocked @@ -6501,10 +6506,8 @@ export type WebSearchOptions = { */ export type AiReasoningEffortHint = Suggested | (string & NonNullable); - /** Reasoning efforts suggested for models without published reasoning metadata. */ export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; - export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: boolean; @@ -6722,7 +6725,6 @@ export interface ResponsesInputReasoning extends Omit { effort?: Exclude | (string & NonNullable) | null; } - export type Reasoning = { effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index 2690a23269f..f6da4f854e0 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -6200,6 +6200,11 @@ type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +// Source of truth for per-model reasoning types: each model's `reasoning_effort` metadata +// in Workers AI ConfigAPI (supported efforts, aliases, defaults, and whether reasoning can +// be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, +// apps/worker-constellation-entry/scripts/build-types) turns it into the per-model +// `inputs` types below; the developer docs model schemas come from the same metadata. /** * A reasoning effort. The listed values are suggestions: the efforts the model supports. * Any other string also type-checks, so new or provider-specific efforts are never blocked @@ -6207,10 +6212,8 @@ type WebSearchOptions = { */ type AiReasoningEffortHint = Suggested | (string & NonNullable); - /** Reasoning efforts suggested for models without published reasoning metadata. */ type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; - type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: boolean; @@ -6428,7 +6431,6 @@ interface ResponsesInputReasoning extends Omit { effort?: Exclude | (string & NonNullable) | null; } - type Reasoning = { effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index ca2a1d9af80..0580c9b0c2c 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -6211,6 +6211,11 @@ export type WebSearchOptions = { search_context_size?: "low" | "medium" | "high"; user_location?: WebSearchUserLocation; }; +// Source of truth for per-model reasoning types: each model's `reasoning_effort` metadata +// in Workers AI ConfigAPI (supported efforts, aliases, defaults, and whether reasoning can +// be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, +// apps/worker-constellation-entry/scripts/build-types) turns it into the per-model +// `inputs` types below; the developer docs model schemas come from the same metadata. /** * A reasoning effort. The listed values are suggestions: the efforts the model supports. * Any other string also type-checks, so new or provider-specific efforts are never blocked @@ -6218,10 +6223,8 @@ export type WebSearchOptions = { */ export type AiReasoningEffortHint = Suggested | (string & NonNullable); - /** Reasoning efforts suggested for models without published reasoning metadata. */ export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; - export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: boolean; @@ -6439,7 +6442,6 @@ export interface ResponsesInputReasoning extends Omit { effort?: Exclude | (string & NonNullable) | null; } - export type Reasoning = { effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; From 2501936d05f21497c442a84ba9692cd482eae6aa Mon Sep 17 00:00:00 2001 From: Kastan Day Date: Wed, 23 Sep 2026 15:14:25 -0700 Subject: [PATCH 11/11] types: exact per-model Workers AI reasoning types Regenerated from the Workers AI SDK type generator (cloudflare/ai/sdk!1778) and production ConfigAPI. Reasoning types now enforce what each model supports instead of suggesting values while accepting any string: - reasoning_effort (and Responses reasoning.effort) accepts exactly the model's supported efforts; compatibility aliases are listed in the hover docs as accepted by the API but not by the types. - Models without effort levels (Gemma 4, GLM-4.7-Flash, Kimi K2.7 Code) have no reasoning_effort; mandatory reasoning (GPT-OSS, Kimi K2.7 Code, GLM-5.3, GLM-5.3-Flash) types enable_thinking as true. - Nemotron 3 publishes its own controls: no reasoning_effort, and chat_template_kwargs with enable_thinking, low_effort and force_nonempty_content. - The shared ChatCompletionsInput and ResponsesInput keep main's types and still apply to models without reasoning metadata. - Adds GLM-5.3 and Nemotron Speech Streaming; removes stable-diffusion-v1-5-img2img, which is no longer offered. This intentionally rejects values these models do not support that the types previously accepted. --- types/defines/ai.d.ts | 167 ++++++++----- .../experimental/index.d.ts | 178 ++++++++------ .../generated-snapshot/experimental/index.ts | 178 ++++++++------ types/generated-snapshot/index.d.ts | 178 ++++++++------ types/generated-snapshot/index.ts | 178 ++++++++------ types/test/types/ai-reasoning.ts | 226 ++++++++++++------ 6 files changed, 686 insertions(+), 419 deletions(-) diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index 957075bd090..b4573af6831 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -526,18 +526,6 @@ export type WebSearchOptions = { // be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, // apps/worker-constellation-entry/scripts/build-types) turns it into the per-model // `inputs` types below; the developer docs model schemas come from the same metadata. -/** - * A reasoning effort. The listed values are suggestions: the efforts the model supports. - * Any other string also type-checks, so new or provider-specific efforts are never blocked - * by the types, but the model may reject or ignore values it does not support. - */ -export type AiReasoningEffortHint = - | Suggested - | (string & NonNullable); - -/** Reasoning efforts suggested for models without published reasoning metadata. */ -export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; - export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: boolean; @@ -561,7 +549,7 @@ export type ChatCompletionsCommonOptions = { prediction?: PredictionContent; presence_penalty?: number | null; /** Reasoning effort. Supported levels depend on the model. */ - reasoning_effort?: AiReasoningEffortHint | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; @@ -686,7 +674,7 @@ export type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: ResponsesInputReasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -747,16 +735,6 @@ export type ResponsePrompt = { } | null; version?: string | null; }; -/** - * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses - * echo back), `effort` suggests the shared efforts but accepts any string, like - * AiReasoningEffortHint (spelled out because this file cannot import it). - */ -export interface ResponsesInputReasoning extends Omit { - /** Reasoning effort. Supported levels depend on the model. */ - effort?: Exclude | (string & NonNullable) | null; -} - export type Reasoning = { effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; @@ -4759,13 +4737,13 @@ export declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { } export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR & { - reasoning?: (Omit & { + reasoning?: (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, Omit & { /** @@ -4773,27 +4751,27 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }>; postProcessedOutputs: XOR; } export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR & { - reasoning?: (Omit & { + reasoning?: (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, Omit & { /** @@ -4801,14 +4779,14 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }>; postProcessedOutputs: XOR; @@ -5893,13 +5871,9 @@ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { } export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { inputs: Omit & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -5915,11 +5889,11 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { inputs: Omit & { /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * Reasoning effort. Supported levels: high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; max maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + reasoning_effort?: "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -5931,21 +5905,61 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { }; postProcessedOutputs: ChatCompletionsOutput; } +export type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsInput, + "model" | "max_tokens" | "metadata" | "modalities" | "chat_template_kwargs" | "store" | "reasoning_effort" +> & { + /** + * ID of the model to use (for example, '@cf/nvidia/nemotron-3-120b-a12b'). + */ + model?: ChatCompletionsInput["model"]; + /** + * The maximum number of tokens to generate. + */ + max_tokens?: ChatCompletionsInput["max_tokens"]; + /** + * Set of key-value pairs that can be attached to the object. + */ + metadata?: ChatCompletionsInput["metadata"]; + /** + * Output types requested from the model. + */ + modalities?: ChatCompletionsInput["modalities"]; + /** + * Nemotron chat-template controls for normal reasoning, low-effort reasoning, and non-reasoning responses. + */ + chat_template_kwargs?: { + /** + * Whether to enable reasoning. Reasoning is enabled by default. + */ + enable_thinking?: boolean; + /** + * When reasoning is enabled, use Nemotron's low-effort reasoning mode, which uses significantly fewer reasoning tokens. + */ + low_effort?: boolean; + /** + * For coding agent use, Nvidia suggests setting force_nonempty_content=true + */ + force_nonempty_content?: boolean; + }; + /** + * Whether to store the output for model distillation or evaluation. + * + * @default false + */ + store?: ChatCompletionsInput["store"]; +}; export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -5963,19 +5977,42 @@ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +export type Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input = + | { + /** + * readable stream with audio data and content-type specified for that data + */ + audio: { + body: object; + contentType: string; + }; + } + | { + /** + * base64 encoded audio data + */ + audio: string; + encoding?: "wav" | "flac" | "ogg" | "linear16"; + sample_rate?: number; + channels?: number; + }; +export interface Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output { + text?: string; + duration?: number; +} +export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B { + inputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input; + postProcessedOutputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output; +} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: Omit & { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Reasoning is always enabled for this model and cannot be disabled. + * Reasoning is always enabled for this model and cannot be disabled. This model has no reasoning effort levels. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -5983,11 +6020,11 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { inputs: Omit & { /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + reasoning_effort?: "max" | "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -6135,11 +6172,11 @@ export declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { inputs: Omit & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low" | "none"> | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -6154,11 +6191,11 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { inputs: Omit & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low" | "none"> | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -6177,7 +6214,7 @@ export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { * * @default "xhigh" */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + reasoning_effort?: "low" | "medium" | "xhigh" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -6192,18 +6229,18 @@ export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { inputs: Omit & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -6211,18 +6248,18 @@ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { inputs: Omit & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -6232,7 +6269,6 @@ export interface AiModels { "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage; - "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage; "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage; "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage; "@cf/myshell-ai/melotts": BaseAiTextToSpeech; @@ -6320,6 +6356,7 @@ export interface AiModels { "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; + "@cf/nvidia/nemotron-speech-streaming-en-0.6b": Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index a6d817667e7..ff54f74f2b9 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -6491,15 +6491,6 @@ type WebSearchOptions = { // be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, // apps/worker-constellation-entry/scripts/build-types) turns it into the per-model // `inputs` types below; the developer docs model schemas come from the same metadata. -/** - * A reasoning effort. The listed values are suggestions: the efforts the model supports. - * Any other string also type-checks, so new or provider-specific efforts are never blocked - * by the types, but the model may reject or ignore values it does not support. - */ -type AiReasoningEffortHint = - Suggested | (string & NonNullable); -/** Reasoning efforts suggested for models without published reasoning metadata. */ -type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: boolean; @@ -6523,7 +6514,7 @@ type ChatCompletionsCommonOptions = { prediction?: PredictionContent; presence_penalty?: number | null; /** Reasoning effort. Supported levels depend on the model. */ - reasoning_effort?: AiReasoningEffortHint | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; @@ -6646,7 +6637,7 @@ type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: ResponsesInputReasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6707,16 +6698,6 @@ type ResponsePrompt = { } | null; version?: string | null; }; -/** - * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses - * echo back), `effort` suggests the shared efforts but accepts any string, like - * AiReasoningEffortHint (spelled out because this file cannot import it). - */ -interface ResponsesInputReasoning extends Omit { - /** Reasoning effort. Supported levels depend on the model. */ - effort?: - Exclude | (string & NonNullable) | null; -} type Reasoning = { effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; @@ -10744,13 +10725,13 @@ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< Omit & { reasoning?: - | (Omit & { + | (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, @@ -10760,16 +10741,14 @@ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint< - "low" | "medium" | "high" - > | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; } >; @@ -10779,13 +10758,13 @@ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< Omit & { reasoning?: - | (Omit & { + | (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, @@ -10795,16 +10774,14 @@ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint< - "low" | "medium" | "high" - > | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; } >; @@ -11894,13 +11871,9 @@ declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -11919,11 +11892,11 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * Reasoning effort. Supported levels: high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; max maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + reasoning_effort?: "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11935,21 +11908,67 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { }; postProcessedOutputs: ChatCompletionsOutput; } +type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsInput, + | "model" + | "max_tokens" + | "metadata" + | "modalities" + | "chat_template_kwargs" + | "store" + | "reasoning_effort" +> & { + /** + * ID of the model to use (for example, '@cf/nvidia/nemotron-3-120b-a12b'). + */ + model?: ChatCompletionsInput["model"]; + /** + * The maximum number of tokens to generate. + */ + max_tokens?: ChatCompletionsInput["max_tokens"]; + /** + * Set of key-value pairs that can be attached to the object. + */ + metadata?: ChatCompletionsInput["metadata"]; + /** + * Output types requested from the model. + */ + modalities?: ChatCompletionsInput["modalities"]; + /** + * Nemotron chat-template controls for normal reasoning, low-effort reasoning, and non-reasoning responses. + */ + chat_template_kwargs?: { + /** + * Whether to enable reasoning. Reasoning is enabled by default. + */ + enable_thinking?: boolean; + /** + * When reasoning is enabled, use Nemotron's low-effort reasoning mode, which uses significantly fewer reasoning tokens. + */ + low_effort?: boolean; + /** + * For coding agent use, Nvidia suggests setting force_nonempty_content=true + */ + force_nonempty_content?: boolean; + }; + /** + * Whether to store the output for model distillation or evaluation. + * + * @default false + */ + store?: ChatCompletionsInput["store"]; +}; declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -11967,22 +11986,45 @@ declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +type Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input = + | { + /** + * readable stream with audio data and content-type specified for that data + */ + audio: { + body: object; + contentType: string; + }; + } + | { + /** + * base64 encoded audio data + */ + audio: string; + encoding?: "wav" | "flac" | "ogg" | "linear16"; + sample_rate?: number; + channels?: number; + }; +interface Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output { + text?: string; + duration?: number; +} +declare abstract class Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B { + inputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input; + postProcessedOutputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output; +} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: Omit< ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Reasoning is always enabled for this model and cannot be disabled. + * Reasoning is always enabled for this model and cannot be disabled. This model has no reasoning effort levels. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -11993,11 +12035,11 @@ declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + reasoning_effort?: "max" | "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -12148,13 +12190,11 @@ declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -12172,13 +12212,11 @@ declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -12200,7 +12238,7 @@ declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { * * @default "xhigh" */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + reasoning_effort?: "low" | "medium" | "xhigh" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -12218,18 +12256,18 @@ declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -12240,18 +12278,18 @@ declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -12260,7 +12298,6 @@ interface AiModels { "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage; - "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage; "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage; "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage; "@cf/myshell-ai/melotts": BaseAiTextToSpeech; @@ -12348,6 +12385,7 @@ interface AiModels { "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; + "@cf/nvidia/nemotron-speech-streaming-en-0.6b": Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 0ec3758d47e..f8edcb22d53 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -6502,15 +6502,6 @@ export type WebSearchOptions = { // be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, // apps/worker-constellation-entry/scripts/build-types) turns it into the per-model // `inputs` types below; the developer docs model schemas come from the same metadata. -/** - * A reasoning effort. The listed values are suggestions: the efforts the model supports. - * Any other string also type-checks, so new or provider-specific efforts are never blocked - * by the types, but the model may reject or ignore values it does not support. - */ -export type AiReasoningEffortHint = - Suggested | (string & NonNullable); -/** Reasoning efforts suggested for models without published reasoning metadata. */ -export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: boolean; @@ -6534,7 +6525,7 @@ export type ChatCompletionsCommonOptions = { prediction?: PredictionContent; presence_penalty?: number | null; /** Reasoning effort. Supported levels depend on the model. */ - reasoning_effort?: AiReasoningEffortHint | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; @@ -6657,7 +6648,7 @@ export type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: ResponsesInputReasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6718,16 +6709,6 @@ export type ResponsePrompt = { } | null; version?: string | null; }; -/** - * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses - * echo back), `effort` suggests the shared efforts but accepts any string, like - * AiReasoningEffortHint (spelled out because this file cannot import it). - */ -export interface ResponsesInputReasoning extends Omit { - /** Reasoning effort. Supported levels depend on the model. */ - effort?: - Exclude | (string & NonNullable) | null; -} export type Reasoning = { effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; @@ -10756,13 +10737,13 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< Omit & { reasoning?: - | (Omit & { + | (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, @@ -10772,16 +10753,14 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint< - "low" | "medium" | "high" - > | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; } >; @@ -10791,13 +10770,13 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< Omit & { reasoning?: - | (Omit & { + | (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, @@ -10807,16 +10786,14 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint< - "low" | "medium" | "high" - > | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; } >; @@ -11906,13 +11883,9 @@ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -11931,11 +11904,11 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * Reasoning effort. Supported levels: high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; max maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + reasoning_effort?: "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11947,21 +11920,67 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { }; postProcessedOutputs: ChatCompletionsOutput; } +export type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsInput, + | "model" + | "max_tokens" + | "metadata" + | "modalities" + | "chat_template_kwargs" + | "store" + | "reasoning_effort" +> & { + /** + * ID of the model to use (for example, '@cf/nvidia/nemotron-3-120b-a12b'). + */ + model?: ChatCompletionsInput["model"]; + /** + * The maximum number of tokens to generate. + */ + max_tokens?: ChatCompletionsInput["max_tokens"]; + /** + * Set of key-value pairs that can be attached to the object. + */ + metadata?: ChatCompletionsInput["metadata"]; + /** + * Output types requested from the model. + */ + modalities?: ChatCompletionsInput["modalities"]; + /** + * Nemotron chat-template controls for normal reasoning, low-effort reasoning, and non-reasoning responses. + */ + chat_template_kwargs?: { + /** + * Whether to enable reasoning. Reasoning is enabled by default. + */ + enable_thinking?: boolean; + /** + * When reasoning is enabled, use Nemotron's low-effort reasoning mode, which uses significantly fewer reasoning tokens. + */ + low_effort?: boolean; + /** + * For coding agent use, Nvidia suggests setting force_nonempty_content=true + */ + force_nonempty_content?: boolean; + }; + /** + * Whether to store the output for model distillation or evaluation. + * + * @default false + */ + store?: ChatCompletionsInput["store"]; +}; export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -11979,22 +11998,45 @@ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +export type Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input = + | { + /** + * readable stream with audio data and content-type specified for that data + */ + audio: { + body: object; + contentType: string; + }; + } + | { + /** + * base64 encoded audio data + */ + audio: string; + encoding?: "wav" | "flac" | "ogg" | "linear16"; + sample_rate?: number; + channels?: number; + }; +export interface Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output { + text?: string; + duration?: number; +} +export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B { + inputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input; + postProcessedOutputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output; +} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: Omit< ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Reasoning is always enabled for this model and cannot be disabled. + * Reasoning is always enabled for this model and cannot be disabled. This model has no reasoning effort levels. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -12005,11 +12047,11 @@ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + reasoning_effort?: "max" | "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -12160,13 +12202,11 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -12184,13 +12224,11 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -12212,7 +12250,7 @@ export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { * * @default "xhigh" */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + reasoning_effort?: "low" | "medium" | "xhigh" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -12230,18 +12268,18 @@ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -12252,18 +12290,18 @@ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -12272,7 +12310,6 @@ export interface AiModels { "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage; - "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage; "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage; "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage; "@cf/myshell-ai/melotts": BaseAiTextToSpeech; @@ -12360,6 +12397,7 @@ export interface AiModels { "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; + "@cf/nvidia/nemotron-speech-streaming-en-0.6b": Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index 3ce3741c46f..3afdf83a888 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -6208,15 +6208,6 @@ type WebSearchOptions = { // be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, // apps/worker-constellation-entry/scripts/build-types) turns it into the per-model // `inputs` types below; the developer docs model schemas come from the same metadata. -/** - * A reasoning effort. The listed values are suggestions: the efforts the model supports. - * Any other string also type-checks, so new or provider-specific efforts are never blocked - * by the types, but the model may reject or ignore values it does not support. - */ -type AiReasoningEffortHint = - Suggested | (string & NonNullable); -/** Reasoning efforts suggested for models without published reasoning metadata. */ -type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: boolean; @@ -6240,7 +6231,7 @@ type ChatCompletionsCommonOptions = { prediction?: PredictionContent; presence_penalty?: number | null; /** Reasoning effort. Supported levels depend on the model. */ - reasoning_effort?: AiReasoningEffortHint | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; @@ -6363,7 +6354,7 @@ type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: ResponsesInputReasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6424,16 +6415,6 @@ type ResponsePrompt = { } | null; version?: string | null; }; -/** - * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses - * echo back), `effort` suggests the shared efforts but accepts any string, like - * AiReasoningEffortHint (spelled out because this file cannot import it). - */ -interface ResponsesInputReasoning extends Omit { - /** Reasoning effort. Supported levels depend on the model. */ - effort?: - Exclude | (string & NonNullable) | null; -} type Reasoning = { effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; @@ -10461,13 +10442,13 @@ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< Omit & { reasoning?: - | (Omit & { + | (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, @@ -10477,16 +10458,14 @@ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint< - "low" | "medium" | "high" - > | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; } >; @@ -10496,13 +10475,13 @@ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< Omit & { reasoning?: - | (Omit & { + | (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, @@ -10512,16 +10491,14 @@ declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint< - "low" | "medium" | "high" - > | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; } >; @@ -11611,13 +11588,9 @@ declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -11636,11 +11609,11 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * Reasoning effort. Supported levels: high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; max maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + reasoning_effort?: "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11652,21 +11625,67 @@ declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { }; postProcessedOutputs: ChatCompletionsOutput; } +type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsInput, + | "model" + | "max_tokens" + | "metadata" + | "modalities" + | "chat_template_kwargs" + | "store" + | "reasoning_effort" +> & { + /** + * ID of the model to use (for example, '@cf/nvidia/nemotron-3-120b-a12b'). + */ + model?: ChatCompletionsInput["model"]; + /** + * The maximum number of tokens to generate. + */ + max_tokens?: ChatCompletionsInput["max_tokens"]; + /** + * Set of key-value pairs that can be attached to the object. + */ + metadata?: ChatCompletionsInput["metadata"]; + /** + * Output types requested from the model. + */ + modalities?: ChatCompletionsInput["modalities"]; + /** + * Nemotron chat-template controls for normal reasoning, low-effort reasoning, and non-reasoning responses. + */ + chat_template_kwargs?: { + /** + * Whether to enable reasoning. Reasoning is enabled by default. + */ + enable_thinking?: boolean; + /** + * When reasoning is enabled, use Nemotron's low-effort reasoning mode, which uses significantly fewer reasoning tokens. + */ + low_effort?: boolean; + /** + * For coding agent use, Nvidia suggests setting force_nonempty_content=true + */ + force_nonempty_content?: boolean; + }; + /** + * Whether to store the output for model distillation or evaluation. + * + * @default false + */ + store?: ChatCompletionsInput["store"]; +}; declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -11684,22 +11703,45 @@ declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +type Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input = + | { + /** + * readable stream with audio data and content-type specified for that data + */ + audio: { + body: object; + contentType: string; + }; + } + | { + /** + * base64 encoded audio data + */ + audio: string; + encoding?: "wav" | "flac" | "ogg" | "linear16"; + sample_rate?: number; + channels?: number; + }; +interface Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output { + text?: string; + duration?: number; +} +declare abstract class Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B { + inputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input; + postProcessedOutputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output; +} declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: Omit< ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Reasoning is always enabled for this model and cannot be disabled. + * Reasoning is always enabled for this model and cannot be disabled. This model has no reasoning effort levels. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -11710,11 +11752,11 @@ declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + reasoning_effort?: "max" | "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11865,13 +11907,11 @@ declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11889,13 +11929,11 @@ declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11917,7 +11955,7 @@ declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { * * @default "xhigh" */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + reasoning_effort?: "low" | "medium" | "xhigh" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11935,18 +11973,18 @@ declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -11957,18 +11995,18 @@ declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -11977,7 +12015,6 @@ interface AiModels { "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage; - "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage; "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage; "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage; "@cf/myshell-ai/melotts": BaseAiTextToSpeech; @@ -12065,6 +12102,7 @@ interface AiModels { "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; + "@cf/nvidia/nemotron-speech-streaming-en-0.6b": Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index c610dd8a10b..bd7a29d9d50 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -6219,15 +6219,6 @@ export type WebSearchOptions = { // be turned off). The Workers AI SDK type generator (cloudflare/ai/sdk, // apps/worker-constellation-entry/scripts/build-types) turns it into the per-model // `inputs` types below; the developer docs model schemas come from the same metadata. -/** - * A reasoning effort. The listed values are suggestions: the efforts the model supports. - * Any other string also type-checks, so new or provider-specific efforts are never blocked - * by the types, but the model may reject or ignore values it does not support. - */ -export type AiReasoningEffortHint = - Suggested | (string & NonNullable); -/** Reasoning efforts suggested for models without published reasoning metadata. */ -export type ChatCompletionsReasoningEffort = "low" | "medium" | "high"; export type ChatTemplateKwargs = { /** Whether to enable reasoning. Support and defaults depend on the model. */ enable_thinking?: boolean; @@ -6251,7 +6242,7 @@ export type ChatCompletionsCommonOptions = { prediction?: PredictionContent; presence_penalty?: number | null; /** Reasoning effort. Supported levels depend on the model. */ - reasoning_effort?: AiReasoningEffortHint | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: ChatTemplateKwargs; response_format?: ResponseFormat; seed?: number | null; @@ -6374,7 +6365,7 @@ export type ResponsesInput = { parallel_tool_calls?: boolean | null; previous_response_id?: string | null; prompt_cache_key?: string; - reasoning?: ResponsesInputReasoning | null; + reasoning?: Reasoning | null; safety_identifier?: string; service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; stream?: boolean | null; @@ -6435,16 +6426,6 @@ export type ResponsePrompt = { } | null; version?: string | null; }; -/** - * Reasoning options accepted in a Responses request. Unlike `Reasoning` (which responses - * echo back), `effort` suggests the shared efforts but accepts any string, like - * AiReasoningEffortHint (spelled out because this file cannot import it). - */ -export interface ResponsesInputReasoning extends Omit { - /** Reasoning effort. Supported levels depend on the model. */ - effort?: - Exclude | (string & NonNullable) | null; -} export type Reasoning = { effort?: ReasoningEffort | null; generate_summary?: "auto" | "concise" | "detailed" | null; @@ -10473,13 +10454,13 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { inputs: XOR< Omit & { reasoning?: - | (Omit & { + | (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, @@ -10489,16 +10470,14 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint< - "low" | "medium" | "high" - > | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; } >; @@ -10508,13 +10487,13 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { inputs: XOR< Omit & { reasoning?: - | (Omit & { + | (Omit & { /** * Reasoning effort. Supported levels: low, medium, high. Reasoning cannot be disabled. * * @default "medium" */ - effort?: AiReasoningEffortHint<"low" | "medium" | "high"> | null; + effort?: "low" | "medium" | "high" | null; }) | null; }, @@ -10524,16 +10503,14 @@ export declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { * * @default "medium" */ - reasoning_effort?: AiReasoningEffortHint< - "low" | "medium" | "high" - > | null; + reasoning_effort?: "low" | "medium" | "high" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; } >; @@ -11623,13 +11600,9 @@ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -11648,11 +11621,11 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: high, none. Compatibility aliases: low maps to high; medium maps to high; max maps to high. + * Reasoning effort. Supported levels: high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; max maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint<"high" | "none"> | null; + reasoning_effort?: "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11664,21 +11637,67 @@ export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { }; postProcessedOutputs: ChatCompletionsOutput; } +export type Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input = Omit< + ChatCompletionsInput, + | "model" + | "max_tokens" + | "metadata" + | "modalities" + | "chat_template_kwargs" + | "store" + | "reasoning_effort" +> & { + /** + * ID of the model to use (for example, '@cf/nvidia/nemotron-3-120b-a12b'). + */ + model?: ChatCompletionsInput["model"]; + /** + * The maximum number of tokens to generate. + */ + max_tokens?: ChatCompletionsInput["max_tokens"]; + /** + * Set of key-value pairs that can be attached to the object. + */ + metadata?: ChatCompletionsInput["metadata"]; + /** + * Output types requested from the model. + */ + modalities?: ChatCompletionsInput["modalities"]; + /** + * Nemotron chat-template controls for normal reasoning, low-effort reasoning, and non-reasoning responses. + */ + chat_template_kwargs?: { + /** + * Whether to enable reasoning. Reasoning is enabled by default. + */ + enable_thinking?: boolean; + /** + * When reasoning is enabled, use Nemotron's low-effort reasoning mode, which uses significantly fewer reasoning tokens. + */ + low_effort?: boolean; + /** + * For coding agent use, Nvidia suggests setting force_nonempty_content=true + */ + force_nonempty_content?: boolean; + }; + /** + * Whether to store the output for model distillation or evaluation. + * + * @default false + */ + store?: ChatCompletionsInput["store"]; +}; export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { - inputs: ChatCompletionsInput; + inputs: Ai_Cf_Nvidia_Nemotron_3_120B_A12B_Input; postProcessedOutputs: ChatCompletionsOutput; } export type Ai_Cf_Google_Gemma_4_26B_A4B_It_Input = Omit< ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Use `chat_template_kwargs.enable_thinking` to turn reasoning on or off. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Whether to enable reasoning for this model. + * Whether to enable reasoning for this model. This model has no reasoning effort levels. * * @default true */ @@ -11696,22 +11715,45 @@ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_It { } /** @deprecated Use Base_Ai_Cf_Google_Gemma_4_26B_A4B_It. */ export declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT extends Base_Ai_Cf_Google_Gemma_4_26B_A4B_It {} +export type Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input = + | { + /** + * readable stream with audio data and content-type specified for that data + */ + audio: { + body: object; + contentType: string; + }; + } + | { + /** + * base64 encoded audio data + */ + audio: string; + encoding?: "wav" | "flac" | "ogg" | "linear16"; + sample_rate?: number; + channels?: number; + }; +export interface Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output { + text?: string; + duration?: number; +} +export declare abstract class Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B { + inputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Input; + postProcessedOutputs: Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B_Output; +} export declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { inputs: Omit< ChatCompletionsInput, "reasoning_effort" | "chat_template_kwargs" > & { - /** - * This model has no reasoning effort levels. Reasoning is always enabled. - */ - reasoning_effort?: AiReasoningEffortHint | null; chat_template_kwargs?: Omit & { /** - * Reasoning is always enabled for this model and cannot be disabled. + * Reasoning is always enabled for this model and cannot be disabled. This model has no reasoning effort levels. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -11722,11 +11764,11 @@ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, none. Compatibility aliases: low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. + * Reasoning effort. Supported levels: max, high, none. Compatibility aliases (accepted by the API, not by these types): low maps to high; medium maps to high; xhigh maps to max; minimal maps to none. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "none"> | null; + reasoning_effort?: "max" | "high" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11877,13 +11919,11 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11901,13 +11941,11 @@ export declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases: minimal maps to low; medium maps to high; xhigh maps to high. + * Reasoning effort. Supported levels: max, high, low, none. Compatibility aliases (accepted by the API, not by these types): minimal maps to low; medium maps to high; xhigh maps to high. * * @default "high" */ - reasoning_effort?: AiReasoningEffortHint< - "max" | "high" | "low" | "none" - > | null; + reasoning_effort?: "max" | "high" | "low" | "none" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11929,7 +11967,7 @@ export declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { * * @default "xhigh" */ - reasoning_effort?: AiReasoningEffortHint<"low" | "medium" | "xhigh"> | null; + reasoning_effort?: "low" | "medium" | "xhigh" | null; chat_template_kwargs?: Omit & { /** * Whether to enable reasoning for this model. @@ -11947,18 +11985,18 @@ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3 { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; medium maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -11969,18 +12007,18 @@ export declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { "reasoning_effort" | "chat_template_kwargs" > & { /** - * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases: none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. + * Reasoning effort. Supported levels: max, high, low. Reasoning cannot be disabled. Compatibility aliases (accepted by the API, not by these types): none maps to max; minimal maps to max; medium maps to max; xhigh maps to max. * * @default "max" */ - reasoning_effort?: AiReasoningEffortHint<"max" | "high" | "low"> | null; + reasoning_effort?: "max" | "high" | "low" | null; chat_template_kwargs?: Omit & { /** * Reasoning is always enabled for this model and cannot be disabled. * * @default true */ - enable_thinking?: boolean; + enable_thinking?: true; }; }; postProcessedOutputs: ChatCompletionsOutput; @@ -11989,7 +12027,6 @@ export interface AiModels { "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage; - "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage; "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage; "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage; "@cf/myshell-ai/melotts": BaseAiTextToSpeech; @@ -12077,6 +12114,7 @@ export interface AiModels { "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_It; + "@cf/nvidia/nemotron-speech-streaming-en-0.6b": Base_Ai_Cf_Nvidia_Nemotron_Speech_Streaming_En_0_6B; "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; diff --git a/types/test/types/ai-reasoning.ts b/types/test/types/ai-reasoning.ts index d9ed9a9e233..1f90b4bcc01 100644 --- a/types/test/types/ai-reasoning.ts +++ b/types/test/types/ai-reasoning.ts @@ -5,147 +5,225 @@ declare const ai: Ai; const messages = [{ role: 'user' as const, content: 'Hello' }]; -// Reasoning types suggest each model's supported efforts but never reject a -// value that type-checked before: any string effort and any boolean -// enable_thinking are accepted for every model. +// Reasoning models accept exactly the reasoning controls they support: their +// supported efforts (compatibility aliases are documented, not typed), no +// effort property when they have no effort levels, and `enable_thinking: true` +// only when reasoning is mandatory. Models with their own schema (Nemotron) get +// exactly that schema's controls. type Equal = (() => X extends A ? 1 : 2) extends () => X extends B ? 1 : 2 ? true : false; -// The literal suggestions an effort type offers (drops the open `string` part). -type Suggested = T extends string ? (string extends T ? never : T) : never; type ChatEffort = AiModels[Model]['inputs'] extends infer Input ? Input extends { reasoning_effort?: infer Effort } - ? Suggested> + ? Exclude : never : never; type ResponsesEffort = AiModels[Model]['inputs'] extends infer Input ? Input extends { reasoning?: infer Options } - ? NonNullable extends { effort?: infer Effort } - ? Suggested> - : never + ? // Skip XOR's Chat branch, whose `reasoning` is `never`. + [NonNullable] extends [never] + ? never + : NonNullable extends { effort?: infer Effort } + ? Exclude + : never : never : never; -// Suggestions are the canonical supported efforts from model metadata. const glm52: Equal< ChatEffort<'@cf/zai-org/glm-5.2'>, 'max' | 'high' | 'none' > = true; +const dsv4: Equal< + ChatEffort<'@cf/deepseek-ai/deepseek-v4-flash-0731'>, + 'max' | 'high' | 'low' | 'none' +> = true; +const glm53: Equal< + ChatEffort<'@cf/zai-org/glm-5.3'>, + 'max' | 'high' | 'low' +> = true; +const glm53Flash: Equal< + ChatEffort<'@cf/zai-org/glm-5.3-flash'>, + 'max' | 'high' | 'low' +> = true; +const kimi26: Equal< + ChatEffort<'@cf/moonshotai/kimi-k2.6'>, + 'high' | 'none' +> = true; const qwen: Equal< ChatEffort<'@cf/qwen/qwen3.8-27b'>, 'low' | 'medium' | 'xhigh' > = true; -const gptOss: Equal< +const gptOssChat: Equal< + ChatEffort<'@cf/openai/gpt-oss-20b'>, + 'low' | 'medium' | 'high' +> = true; +const gptOssResponses: Equal< ResponsesEffort<'@cf/openai/gpt-oss-20b'>, 'low' | 'medium' | 'high' > = true; -// Toggle-only models suggest no effort levels. +// No effort levels, or the model's own schema: no reasoning_effort at all. const glm47: Equal, never> = true; const gemma: Equal, never> = true; -// So do models whose metadata lists no efforts, even if reasoning is always on. const kimiCode: Equal< ChatEffort<'@cf/moonshotai/kimi-k2.7-code'>, never > = true; -// Models without metadata keep the shared suggestions. -const shared: Equal< +const nemotron: Equal< ChatEffort<'@cf/nvidia/nemotron-3-120b-a12b'>, + never +> = true; +// Models without reasoning metadata keep the shared type. +const shared: Equal< + ChatEffort<'@cf/moonshotai/kimi-k2.5'>, 'low' | 'medium' | 'high' > = true; -void [glm52, qwen, gptOss, glm47, gemma, kimiCode, shared]; +void [ + glm52, + dsv4, + glm53, + glm53Flash, + kimi26, + qwen, + gptOssChat, + gptOssResponses, + glm47, + gemma, + kimiCode, + nemotron, + shared, +]; -// Values outside the suggestions still type-check. -void ai.run('@cf/qwen/qwen3.8-27b', { messages, reasoning_effort: 'high' }); -void ai.run('@cf/qwen/qwen3.8-27b', { messages, reasoning_effort: 'none' }); -void ai.run('@cf/zai-org/glm-4.7-flash', { messages, reasoning_effort: 'low' }); -void ai.run('@cf/google/gemma-4-26b-a4b-it', { - messages, - reasoning_effort: 'none', -}); -void ai.run('@cf/google/gemma-4-26b-a4b-it', { - messages, - reasoning_effort: 'turbo', -}); -void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: 'medium' }); +// Supported controls type-check. +void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: 'max' }); void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: null }); -void ai.run('@cf/openai/gpt-oss-20b', { - input: 'Hello', - reasoning: { effort: 'minimal' }, -}); -void ai.run('@cf/openai/gpt-oss-20b', { - input: 'Hello', - reasoning: { effort: 'none' }, -}); - -// enable_thinking stays boolean, including for models with mandatory reasoning. -void ai.run('@cf/moonshotai/kimi-k2.7-code', { - messages, - chat_template_kwargs: { enable_thinking: false }, -}); -void ai.run('@cf/zai-org/glm-5.3', { +void ai.run('@cf/zai-org/glm-5.2', { messages, chat_template_kwargs: { enable_thinking: false }, }); +void ai.run('@cf/qwen/qwen3.8-27b', { messages, reasoning_effort: 'xhigh' }); void ai.run('@cf/openai/gpt-oss-20b', { + input: 'Hello', + reasoning: { effort: 'low' }, +}); +void ai.run('@cf/google/gemma-4-26b-a4b-it', { messages, + skip_special_tokens: true, chat_template_kwargs: { enable_thinking: false }, }); void ai.run('@cf/zai-org/glm-4.7-flash', { messages, chat_template_kwargs: { enable_thinking: false, clear_thinking: false }, }); - -// Values typed with the shared types are accepted by every model. -declare const effort: string; -declare const flag: boolean; -declare const chatInput: ChatCompletionsInput; -declare const responsesInput: ResponsesInput; -void ai.run('@cf/zai-org/glm-5.2', { +void ai.run('@cf/zai-org/glm-5.3', { messages, - reasoning_effort: effort, - chat_template_kwargs: { enable_thinking: flag }, + reasoning_effort: 'low', + chat_template_kwargs: { enable_thinking: true }, }); -void ai.run('@cf/qwen/qwen3.8-27b', chatInput); -void ai.run('@cf/moonshotai/kimi-k2.6', chatInput); -void ai.run('@cf/google/gemma-4-26b-a4b-it', chatInput); -void ai.run('@cf/openai/gpt-oss-120b', chatInput); -void ai.run('@cf/openai/gpt-oss-120b', responsesInput); -const sharedReasoning: Reasoning = { effort: 'high' }; -const sharedOptions: ChatCompletionsCommonOptions = { reasoning_effort: 'max' }; -const sharedKwargs: ChatTemplateKwargs = { enable_thinking: false }; -void [sharedReasoning, sharedOptions, sharedKwargs]; - -// Other model-specific options are unaffected. -void ai.run('@cf/google/gemma-4-26b-a4b-it', { +void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { messages, - skip_special_tokens: true, - service_tier: 'priority', + chat_template_kwargs: { + enable_thinking: true, + low_effort: true, + force_nonempty_content: true, + }, }); +declare const glm53Effort: 'max' | 'high' | 'low'; +void ai.run('@cf/zai-org/glm-5.3', { messages, reasoning_effort: glm53Effort }); + +// Other model options are unaffected. void ai.run('@cf/openai/gpt-oss-20b', { input: 'Hello', service_tier: 'priority', }); +declare const chatInput: ChatCompletionsInput; +void ai.run('@cf/moonshotai/kimi-k2.5', chatInput); +const sharedReasoning: Reasoning = { effort: 'high' }; +const sharedOptions: ChatCompletionsCommonOptions = { reasoning_effort: 'low' }; +const sharedKwargs: ChatTemplateKwargs = { enable_thinking: false }; +void [sharedReasoning, sharedOptions, sharedKwargs]; -// The original Gemma class name remains available for existing code. +// The original Gemma class name remains available. const legacyGemma: Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT['inputs'] = { messages, - reasoning_effort: 'none', }; const gemmaInputs: AiModels['@cf/google/gemma-4-26b-a4b-it']['inputs'] = legacyGemma; void gemmaInputs; -// Types still reject values of the wrong kind. -// @ts-expect-error: efforts are strings -void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: 1 }); -// @ts-expect-error: enable_thinking is a boolean +// Efforts a model does not support are rejected. +// @ts-expect-error: GPT-OSS does not support "max" +void ai.run('@cf/openai/gpt-oss-20b', { messages, reasoning_effort: 'max' }); +// @ts-expect-error: Qwen3.8 does not support "high" +void ai.run('@cf/qwen/qwen3.8-27b', { messages, reasoning_effort: 'high' }); +// @ts-expect-error: GLM-5.3 reasoning cannot be turned off +void ai.run('@cf/zai-org/glm-5.3', { messages, reasoning_effort: 'none' }); +// @ts-expect-error: aliases are accepted by the API, not by the types +void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: 'low' }); +// @ts-expect-error: unknown efforts are rejected +void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: 'turbo' }); +declare const anyEffort: string; +// @ts-expect-error: arbitrary strings are rejected +void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: anyEffort }); +declare const legacyEffort: 'low' | 'medium' | 'high'; +// @ts-expect-error: the shared effort type includes efforts GLM-5.3 lacks +void ai.run('@cf/zai-org/glm-5.3', { + messages, + reasoning_effort: legacyEffort, +}); +// @ts-expect-error: the shared request type allows controls Qwen3.8 lacks +void ai.run('@cf/qwen/qwen3.8-27b', chatInput); +// @ts-expect-error: Responses efforts are exact too +void ai.run('@cf/openai/gpt-oss-20b', { + input: 'Hello', + reasoning: { effort: 'minimal' }, +}); + +// Models without effort levels, or with their own controls, have no effort. +// @ts-expect-error: Gemma 4 has no effort levels +void ai.run('@cf/google/gemma-4-26b-a4b-it', { + messages, + reasoning_effort: 'low', +}); +// @ts-expect-error: Kimi K2.7 Code has no effort levels void ai.run('@cf/moonshotai/kimi-k2.7-code', { messages, - chat_template_kwargs: { enable_thinking: 'no' }, + reasoning_effort: 'high', }); +// @ts-expect-error: Nemotron has no top-level reasoning_effort +void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { + messages, + reasoning_effort: 'low', +}); +// @ts-expect-error: Nemotron's chat_template_kwargs are its own +void ai.run('@cf/nvidia/nemotron-3-120b-a12b', { + messages, + chat_template_kwargs: { clear_thinking: true }, +}); + +// Mandatory reasoning cannot be turned off. +// @ts-expect-error: GPT-OSS reasoning is always on +void ai.run('@cf/openai/gpt-oss-20b', { + messages, + chat_template_kwargs: { enable_thinking: false }, +}); +// @ts-expect-error: Kimi K2.7 Code reasoning is always on +void ai.run('@cf/moonshotai/kimi-k2.7-code', { + messages, + chat_template_kwargs: { enable_thinking: false }, +}); + +// New models are added and models no longer offered are removed. +const speech: keyof AiModels = '@cf/nvidia/nemotron-speech-streaming-en-0.6b'; +// @ts-expect-error: stable-diffusion-v1-5-img2img is no longer offered +const img2img: keyof AiModels = '@cf/runwayml/stable-diffusion-v1-5-img2img'; +void [speech, img2img]; + +// Types still reject values of the wrong kind. +// @ts-expect-error: efforts are strings +void ai.run('@cf/zai-org/glm-5.2', { messages, reasoning_effort: 1 }); // @ts-expect-error: Responses and Chat Completions inputs are mutually exclusive void ai.run('@cf/openai/gpt-oss-20b', { input: 'Hello', messages });