diff --git a/src/components/models/ModelDetailPage.astro b/src/components/models/ModelDetailPage.astro index 19ace64ca45..6329801b1e0 100644 --- a/src/components/models/ModelDetailPage.astro +++ b/src/components/models/ModelDetailPage.astro @@ -144,6 +144,12 @@ const authorName = model.authorName; const requiresWorkersPaid = model.properties.require_workers_paid === true || model.properties.require_workers_paid === "true"; +const reasoningEffortGuidance = new Map([ + ["@cf/zai-org/glm-5.2", "glm-5.2"], + ["@cf/google/gemma-4-26b-a4b-it", "gemma-4"], + ["@cf/deepseek-ai/deepseek-v4-flash-0731", "deepseek-v4-official"], + ["@cf/deepseek-ai/deepseek-v4-pro-0813", "deepseek-v4-official"], +]).get(model.name); // `hasSchema`: input must have at least one key. const hasSchema = Object.keys(model.schema.input).length > 0; @@ -214,6 +220,11 @@ const pageTitle = `${displayName} (${authorName})`; const headTitle = `${pageTitle} ยท Cloudflare AI docs`; const headings: MarkdownHeading[] = [ + reasoningEffortGuidance && { + depth: 2, + slug: "reasoning-effort", + text: "Reasoning effort", + }, hasPlayground && { depth: 2, slug: "playground", text: "Playground" }, hasCodeExamples && { depth: 2, slug: "usage", text: "Usage" }, hasRemainingExamples && { depth: 2, slug: "examples", text: "Examples" }, @@ -343,6 +354,106 @@ const headings: MarkdownHeading[] = [ + { + reasoningEffortGuidance === "glm-5.2" && ( + + +

+ GLM-5.2 supports high and max reasoning + effort, or you can turn reasoning off. For compatibility with Chat + Completions and other protocols in the ecosystem, other reasoning + efforts will be mapped to these modes: +

+
    +
  • + none and minimal turn reasoning off. +
  • +
  • + low and medium map to high. +
  • +
  • + xhigh maps to max. +
  • +
+

+ This is the same mapping used by Z.ai's API, and{" "} + + in their reasoning_effort documentation + + . +

+
+ ) + } + + { + reasoningEffortGuidance === "deepseek-v4-official" && ( + + +

+ DeepSeek V4 Flash 0731 and Pro 0813 support low,{" "} + high, and max reasoning effort. You can also + turn reasoning off. Reasoning is off by default. +

+

Other reasoning efforts map to these modes:

+
    +
  • + none and minimal turn reasoning off. +
  • +
  • + medium and auto map to high. +
  • +
  • + xhigh maps to max. +
  • +
+

+ A request without reasoning controls remains off. If a prior assistant + message contains non-empty reasoning_content, the model + continues reasoning at high to preserve that context. +

+
+ ) + } + + { + reasoningEffortGuidance === "gemma-4" && ( + + +

+ Gemma 4 supports turning reasoning on or off. It does not support + different reasoning intensity levels. Reasoning is off by default. +

+
    +
  • + none and minimal turn reasoning off. +
  • +
  • + low, medium, high,{" "} + xhigh, max, and auto turn + reasoning on. +
  • +
+

+ These values provide API compatibility. They do not change the amount + of reasoning Gemma 4 performs. +

+
+ ) + } + { /* Defensive dead branch (model not in slice): nova-3 transport pricing. */ model.name === "@cf/deepgram/nova-3" && ( diff --git a/src/components/models/ModelFeatures.astro b/src/components/models/ModelFeatures.astro index 0f2b12cfa02..36bbc6831c5 100644 --- a/src/components/models/ModelFeatures.astro +++ b/src/components/models/ModelFeatures.astro @@ -138,7 +138,7 @@ const price = Array.isArray(properties.price) {properties.reasoning && ( Reasoning - Yes + {properties.reasoning_effort ?? "Yes"} )} {properties.vision && ( diff --git a/src/components/models/SchemaDisplay.astro b/src/components/models/SchemaDisplay.astro index df79324e31e..0e56d2d61bc 100644 --- a/src/components/models/SchemaDisplay.astro +++ b/src/components/models/SchemaDisplay.astro @@ -171,6 +171,7 @@ function collectRows( let isNullable = false; let nullableType: string | undefined; let nullableChildDescription: string | undefined; + let nullableChildEnumValues: unknown[] | undefined; if ((hasOneOf || hasAnyOf) && reg.children?.length === 2) { const childTypes = reg.children.map((c) => String((c as RegularNode).primaryType ?? ""), @@ -183,6 +184,10 @@ function collectRows( nullableType = childTypes[nonNullIndex]; nullableChildDescription = nonNullChild.annotations?.description as string | undefined; + nullableChildEnumValues = + (nonNullChild.validations?.enum as unknown[]) ?? + ((nonNullChild.fragment as Record) + ?.enum as unknown[]); isNullable = true; } } @@ -207,7 +212,8 @@ function collectRows( // Check both validations and fragment for enum (different schema parsers put it in different places) const enumValues = ( (reg.validations?.enum as unknown[]) ?? - ((reg.fragment as Record)?.enum as unknown[]) + ((reg.fragment as Record)?.enum as unknown[]) ?? + nullableChildEnumValues )?.map(String); // Collect all metadata from fragment and validations diff --git a/src/content/workers-ai-models/deepseek-v4-flash-0731.json b/src/content/workers-ai-models/deepseek-v4-flash-0731.json index 68c2849de3d..c93ddb2b1b2 100644 --- a/src/content/workers-ai-models/deepseek-v4-flash-0731.json +++ b/src/content/workers-ai-models/deepseek-v4-flash-0731.json @@ -17,6 +17,10 @@ "property_id": "reasoning", "value": "true" }, + { + "property_id": "reasoning_effort", + "value": "Off, Low, High, Max" + }, { "property_id": "price", "value": [ @@ -295,24 +299,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls reasoning effort. none and minimal turn reasoning off; medium and auto map to high; xhigh maps to max." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -1561,24 +1570,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls reasoning effort. none and minimal turn reasoning off; medium and auto map to high; xhigh maps to max." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -2397,24 +2411,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls reasoning effort. none and minimal turn reasoning off; medium and auto map to high; xhigh maps to max." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -3663,24 +3682,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls reasoning effort. none and minimal turn reasoning off; medium and auto map to high; xhigh maps to max." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -4767,4 +4791,4 @@ } }, "deprecated": false -} \ No newline at end of file +} diff --git a/src/content/workers-ai-models/deepseek-v4-pro-0813.json b/src/content/workers-ai-models/deepseek-v4-pro-0813.json index 762237ce245..b05c015908c 100644 --- a/src/content/workers-ai-models/deepseek-v4-pro-0813.json +++ b/src/content/workers-ai-models/deepseek-v4-pro-0813.json @@ -17,6 +17,10 @@ "property_id": "reasoning", "value": "true" }, + { + "property_id": "reasoning_effort", + "value": "Off, Low, High, Max" + }, { "property_id": "price", "value": [ @@ -295,24 +299,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls reasoning effort. none and minimal turn reasoning off; medium and auto map to high; xhigh maps to max." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -1561,24 +1570,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls reasoning effort. none and minimal turn reasoning off; medium and auto map to high; xhigh maps to max." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -2397,24 +2411,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls reasoning effort. none and minimal turn reasoning off; medium and auto map to high; xhigh maps to max." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -3663,24 +3682,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls reasoning effort. none and minimal turn reasoning off; medium and auto map to high; xhigh maps to max." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -4767,4 +4791,4 @@ } }, "deprecated": false -} \ No newline at end of file +} diff --git a/src/content/workers-ai-models/gemma-4-26b-a4b-it.json b/src/content/workers-ai-models/gemma-4-26b-a4b-it.json index 4f09a88c0cc..f6b757790d4 100644 --- a/src/content/workers-ai-models/gemma-4-26b-a4b-it.json +++ b/src/content/workers-ai-models/gemma-4-26b-a4b-it.json @@ -38,6 +38,10 @@ "property_id": "reasoning", "value": "true" }, + { + "property_id": "reasoning_effort", + "value": "Off, On" + }, { "property_id": "terms", "value": "https://ai.google.dev/gemma/docs/gemma_4_license" @@ -298,24 +302,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls whether reasoning is on. none and minimal turn reasoning off; other listed values turn it on. Gemma 4 does not vary reasoning intensity by effort." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -1559,24 +1568,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls whether reasoning is on. none and minimal turn reasoning off; other listed values turn it on. Gemma 4 does not vary reasoning intensity by effort." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -2403,24 +2417,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls whether reasoning is on. none and minimal turn reasoning off; other listed values turn it on. Gemma 4 does not vary reasoning intensity by effort." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -3666,24 +3685,29 @@ { "type": "string", "enum": [ + "none", + "minimal", "low", "medium", - "high" + "high", + "xhigh", + "max", + "auto" ] }, { "type": "null" } ], - "description": "Constrains effort on reasoning for reasoning models (o1, o3-mini, etc.)." + "description": "Controls whether reasoning is on. none and minimal turn reasoning off; other listed values turn it on. Gemma 4 does not vary reasoning intensity by effort." }, "chat_template_kwargs": { "type": "object", "properties": { "enable_thinking": { "type": "boolean", - "default": true, - "description": "Whether to enable reasoning, enabled by default." + "default": false, + "description": "Whether to turn reasoning on. Reasoning is off by default." }, "clear_thinking": { "type": "boolean", @@ -4769,4 +4793,4 @@ ] } } -} \ No newline at end of file +} diff --git a/src/content/workers-ai-models/glm-5.2.json b/src/content/workers-ai-models/glm-5.2.json index d6505b83232..fa603ba367a 100644 --- a/src/content/workers-ai-models/glm-5.2.json +++ b/src/content/workers-ai-models/glm-5.2.json @@ -36,6 +36,10 @@ { "property_id": "reasoning", "value": "true" + }, + { + "property_id": "reasoning_effort", + "value": "Off, High, Max" } ], "id": "4edc7dfe-de78-4156-890c-85b79227694e", @@ -295,9 +299,9 @@ { "type": "string", "enum": [ - "low", - "medium", - "high" + "none", + "high", + "max" ] }, { @@ -1561,9 +1565,9 @@ { "type": "string", "enum": [ - "low", - "medium", - "high" + "none", + "high", + "max" ] }, { @@ -2397,9 +2401,9 @@ { "type": "string", "enum": [ - "low", - "medium", - "high" + "none", + "high", + "max" ] }, { @@ -3663,9 +3667,9 @@ { "type": "string", "enum": [ - "low", - "medium", - "high" + "none", + "high", + "max" ] }, {