calesthio/OpenMontage · error · ValueError
model_name {model_name!r} is not supported for api_family=ge
Error message
model_name {model_name!r} is not supported for api_family=generation What it means
ValueError raised when building a Kling image-generation request (api_family=generation, the default, targeting /v1/images/generations) with a model_name that is not in the IMAGE_GENERATION_MODELS allowlist. The tool refuses to submit an unknown model rather than letting the API fail opaquely.
Source
Thrown at tools/graphics/kling_official_image.py:259
artifacts=[str(path) for path in paths],
cost_usd=self.estimate_cost(inputs),
duration_seconds=round(time.time() - start, 2),
model=request["model"],
)
def _build_request(self, inputs: dict[str, Any]) -> dict[str, Any]:
api_family = str(inputs.get("api_family", "generation"))
if inputs.get("operation") == "omni":
api_family = "omni"
if api_family == "omni":
return self._build_omni_request(inputs)
return self._build_generation_request(inputs)
def _build_generation_request(self, inputs: dict[str, Any]) -> dict[str, Any]:
prompt = self._prompt(inputs)
model_name = str(inputs.get("model_name") or "kling-v3")
if model_name not in IMAGE_GENERATION_MODELS:
raise ValueError(f"model_name {model_name!r} is not supported for api_family=generation")
payload: dict[str, Any] = {
"model_name": model_name,
"prompt": prompt,
"resolution": inputs.get("resolution", "1k"),
"n": int(inputs.get("n", 1) or 1),
"aspect_ratio": inputs.get("aspect_ratio", "16:9"),
}
if len(prompt) > 2500:
raise ValueError("prompt exceeds Kling image generation limit of 2500 characters")
if inputs.get("negative_prompt"):
payload["negative_prompt"] = inputs["negative_prompt"]
image = normalize_image_input(inputs.get("image_url"), inputs.get("image_path"))
if image:
payload["image"] = image
if inputs.get("image_reference"):
payload["image_reference"] = inputs["image_reference"]
for key in ("image_fidelity", "human_fidelity"):
if inputs.get(key) is not None:View on GitHub (pinned to 95e1c3d0ab)
Solutions
- Use a model from IMAGE_GENERATION_MODELS (e.g. kling-v3) for api_family=generation
- If you want an omni model such as kling-image-o1, set operation='omni' or api_family='omni' instead
- Check for typos/whitespace in the model_name string
- If Kling shipped a genuinely new model, update IMAGE_GENERATION_MODELS in kling_official_image.py after verifying API support
Example fix
// before
inputs = {"api_family": "generation", "model_name": "kling-image-o1"}
// after
inputs = {"api_family": "omni", "model_name": "kling-image-o1"} Defensive patterns
Strategy: validation
Validate before calling
IMAGE_GENERATION_MODELS = {"kling-v3"} # mirror the tool's allowlist
model = inputs.get("model_name") or "kling-v3"
assert model in IMAGE_GENERATION_MODELS, f"unsupported generation model: {model}" Prevention
- Keep a shared model-allowlist constant between caller and tool config
- Never reuse omni model names with the default api_family
- Re-validate allowlists when upgrading the tool
When it happens
Trigger: Explicitly passing model_name of an omni-family model (e.g. kling-image-o1) while api_family stays 'generation'; passing a video model name; typo like 'kling-v4' or 'kling-v3 ' (whitespace); passing an empty-ish value is safe (defaults to kling-v3) — only non-member strings raise.
Common situations: Copy-pasting a model name from a different tool or API family; Kling released a new model not yet in the allowlist; mixing up the generation and omni API families.
Related errors
- model_name {model_name!r} is not supported for api_family=om
- prompt exceeds Kling image generation limit of 2500 characte
- image_list items must be objects
- image_list items must include image, image_url, or image_pat
- element_list must be a list of element ids or objects
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/50682a23218f211e.
Report an issue: GitHub.