// Model-lineage compat for "deepseek"; regenerated from the frozen census using class taxonomy selectors.

class "deepseek" {
	on "aiand" "aimlapi" "alibaba-token-plan" "baseten" "coreweave" "deepseek" "fireworks" \
		"huggingface" "kilo" "nanogpt" "novita" "nvidia" "opencode-go" "opencode-zen" "together" \
		"venice" "wafer-serverless" "zenmux" {
		family "pro" {
			thinking-efforts "low" "high" "max"
		}
	}
	on "aiand" "aimlapi" "coreweave" "deepseek" "fireworks" "gmi-cloud" "huggingface" "kilo" \
		"nanogpt" "novita" "nvidia" "ollama-cloud" "opencode-go" "opencode-zen" "openrouter" \
		"together" "venice" "wafer-serverless" "zenmux" {
		family "flash" {
			thinking-efforts "low" "high" "max"
		}
	}
	// DeepSeek V4 ladders are model properties: the wire-exact low/high/max
	// scale holds on every host (medium/xhigh fold into high). OpenRouter's
	// non-Flash V4 route exposes only high, except the dated -0813 SKU.
	family "pro" {
		thinking-efforts "low" "high" "max"
	}
	family "flash" {
		thinking-efforts "low" "high" "max"
	}
	family "v4" {
		thinking-efforts "low" "high" "max"
	}
	family "r1" {
		thinking-efforts "high" "max"
	}
	family "v3" {
		thinking-efforts "high" "max"
	}
	family "reasoner" {
		thinking-efforts "high" "max"
	}
	on "openrouter" {
		family "pro" {
			thinking-efforts "high"
			models "*deepseek-v4-pro-0813*" {
				thinking-efforts "low" "high" "max"
			}
		}
		family "v4" {
			thinking-efforts "high"
		}
		family "r1" {
			thinking-efforts "high"
		}
		family "v3" {
			thinking-efforts "high"
		}
		family "reasoner" {
			thinking-efforts "high"
		}
	}
	on "alibaba-token-plan" "deepseek" {
		supports-developer-role #false
	}
	// Replaces the provider-keyed leaked chat-template special-token strip.
	on "nvidia" "deepseek" {
		strip-deepseek-special-tokens #true
	}
	on "deepseek" "opencode-go" {
		family "pro" {
			max-tokens-field "max_tokens"
			reasoning-content-field "reasoning_content"
			requires-reasoning-content-for-tool-calls #true
		}
	}
	strip-image-input #true
	models token="ocr" {
		strip-image-input #false
	}
	models token="vision" {
		strip-image-input #false
	}
	// DeepSeek V4.1 Flash is natively multimodal (image-text-to-text), but its
	// id carries no `vision` token, so the class-wide strip above dropped
	// attachments the model reads on every deployment without its own carve-out.
	// Keyed on the classified family/revision, not the id spelling, so dotted
	// (`v4.1-flash`) and hyphenated (`v4-1-flash`) release ids both match.
	// The selector also spans `-vision`/`-ocr` ids, which already set the same
	// value above, so the explicit priority resolves that equal-rank tie instead
	// of throwing AmbiguousOverlapError. Only the strip is disabled; the declared
	// modality stays host-derived, so endpoints whose OpenAI-compatible surface
	// rejects `image_url` keep their text-only contract.
	family "flash" {
		revision ">=4.1 <4.2" priority=10 {
			strip-image-input #false
		}
	}
	// V4.1 Flash is natively multimodal (vision encoder + projector, image-text
	// pre-training) but its release id carries no `vision` token to key on.
	// The leading glob also covers publisher-namespaced ids (`ds/deepseek-flash`).
	// Same priority as the V4.1 Flash carve-out: the OpenCode Go provider rule
	// declares the same value for its `deepseek-flash` lane and would otherwise
	// tie at equal rank.
	models "*deepseek-flash" priority=10 {
		strip-image-input #false
	}
	// DSML is the model's own tool-call grammar, not a host quirk: any server
	// running DeepSeek's chat template without (or with a broken) tool parser
	// leaks it into content — hosted gateways, local backends, and custom
	// providers alike. On hosts that parse it the healer sees no markup.
	stream-markup-healing-pattern "dsml"
	thinking-loop-guard "semantic"
	// V4 reasoning reaches omp as its plaintext trace on every host, and the
	// revision pins the weights (flash 4.0 / 4.1, pro 4.0). Earlier lineages
	// classify too coarsely to carry: `r1` also matches the R1 distills.
	revision ">=4" {
		portable-reasoning #true
	}
	// V4.1 Flash's vision config (patch 14, 3x3 merge, 1024-token cap, 544²
	// floor). verified: OpenRouter billing matched it exactly on Fireworks and
	// DeepInfra and within one token on Together, 256px to 4000px.
	// Later Flash releases stay on their wire fallback until measured.
	family "flash" {
		revision ">=4.1 <4.2" {
			image-tokenization {
				regime "deepseek-patch"
				verified #true
				patch-size 14
				downsample 3
				max-tokens 1024
				min-pixels 295936
			}
		}
	}
	// DeepSeek's API retired the V4.0 vision preview and serves its legacy id
	// with the current Flash (api-docs.deepseek.com/guides/vision); hosts that
	// still run the preview keep their fallback.
	on "deepseek" {
		models "deepseek-v4-flash-vision-exp" {
			image-tokenization {
				regime "deepseek-patch"
				verified #true
				patch-size 14
				downsample 3
				max-tokens 1024
				min-pixels 295936
			}
		}
	}
}
