calesthio/OpenMontage · error · ValueError

model_variant must be 2.5, standard, fast, or mini

Error message

model_variant must be 2.5, standard, fast, or mini

What it means

Raised by _resolve_model when the normalized model_variant is not a key of MODEL_IDS ({'2.5', 'standard', 'fast', 'mini'}). The variant selects the default Ark model ID and the reference/duration limits, so an unknown value cannot be mapped. Comparison is case-insensitive after str().lower().

Source

Thrown at tools/video/seedance_ark.py:912

            "callback_url",
            "execution_expires_after",
            "priority",
            "safety_identifier",
        )
        for key in optional:
            if inputs.get(key) is not None:
                payload[key] = inputs[key]
        if inputs.get("web_search"):
            payload["tools"] = [{"type": "web_search"}]

        self._validate_optional_parameters(payload)
        self._validate_request_size(payload)
        return payload

    def _resolve_model(self, inputs: dict[str, Any]) -> tuple[str, str | None]:
        variant = str(inputs.get("model_variant", "standard")).lower()
        if variant not in self.MODEL_IDS:
            raise ValueError("model_variant must be 2.5, standard, fast, or mini")
        model = str(
            inputs.get("model")
            or os.environ.get("ARK_SEEDANCE_MODEL")
            or self.MODEL_IDS[variant]
        )
        if not model or any(char.isspace() for char in model):
            raise ValueError("model must be a non-empty Ark Model/Endpoint ID")
        for known_variant, known_model in self.MODEL_IDS.items():
            if model == known_model:
                return model, known_variant
        # Endpoint IDs and future model IDs can have account-specific pricing.
        # Keep the caller's requested model, but never pretend its price is the
        # public price of model_variant.
        return model, None

    @staticmethod
    def _normalize_duration(value: Any, max_seconds: int = 15) -> int:
        if value == "auto":

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Set model_variant to one of '2.5', 'standard', 'fast', 'mini' (case-insensitive)
  2. Omit model_variant to default to 'standard'
  3. Set an explicit model ID (or ARK_SEEDANCE_MODEL) if you need a custom endpoint, while keeping a valid variant

Example fix

# before
inputs = {"model_variant": "pro"}

# after
inputs = {"model_variant": "standard"}
Defensive patterns

Strategy: validation

Validate before calling

VARIANTS = {"2.5", "standard", "fast", "mini"}
variant = str(inputs.get("model_variant", "standard")).lower()
if variant not in VARIANTS:
    inputs["model_variant"] = "standard"  # or raise early with context

Type guard

def is_valid_variant(variant: str) -> bool:
    return str(variant).lower() in {"2.5", "standard", "fast", "mini"}

Prevention

When it happens

Trigger: model_variant of 'pro', '2.0', 'lite', '', or any string outside the four accepted keys (case is ignored, so 'FAST' is fine).

Common situations: Carrying a variant name from another provider's SDK; passing an empty variant that skips the default; version drift after a new variant was added upstream but not in this code.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/75ea85d4d42be3fb. Report an issue: GitHub.