{"record":{"id":"bb2131cc3b4607e2","repo":"BerriAI/litellm","slug":"model-not-found-in-cost-map-for-model-model","errorCode":null,"errorMessage":"Model not found in cost map for model={model}","messagePattern":"Model not found in cost map for model=(.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/cost_calculator.py","lineNumber":2082,"sourceCode":"        models_to_check: Final[list[str | None]] = [\n            base_model_name,\n            model,\n            model_without_provider,\n            model_name_without_custom_llm_provider,\n        ]\n        for _model in models_to_check:\n            if _model is not None and _model in litellm.model_cost:\n                cost_info = litellm.model_cost[_model]\n                break\n\n        # If still not found, try with custom_llm_provider prefix\n        if cost_info is None and custom_llm_provider:\n            prefixed_model: Final = f\"{custom_llm_provider}/{model}\"\n            if prefixed_model in litellm.model_cost:\n                cost_info = litellm.model_cost[prefixed_model]\n\n    if cost_info is None:\n        raise Exception(f\"Model not found in cost map for model={model}\")\n\n    # Check for video-specific cost per second first\n    video_cost_per_second: Final = cost_info.get(\"output_cost_per_video_per_second\")\n    if video_cost_per_second is not None:\n        return video_cost_per_second * duration_seconds\n\n    output_cost_per_second: Final = _video_output_cost_per_second(cost_info, video_resolution)\n    if output_cost_per_second is not None:\n        return output_cost_per_second * duration_seconds\n\n    # If no cost information found, return 0\n    verbose_logger.info(\n        \"No cost information found for video model %s. Please add pricing to model_prices_and_context_window.json\",\n        model,\n    )\n    return 0.0\n\n","sourceCodeStart":2064,"sourceCodeEnd":2100,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/cost_calculator.py#L2064-L2100","documentation":"The default video-cost calculator tries several candidate model names (with quality/resolution variants and provider prefixes) against litellm.model_cost; if none matches, it raises this generic Exception — the video model has no entry in LiteLLM's pricing data, so per-second video cost cannot be resolved.","triggerScenarios":"Computing video-generation cost for a model absent from model_prices_and_context_window.json and not registered with litellm.register_model; niche or new video models (e.g. regional variants) with unmapped names.","commonSituations":"Recently released video models on an older LiteLLM install; custom model ids from router deployments; user-supplied model strings flowing into cost logging.","solutions":["Update LiteLLM to get current video pricing data.","Register the model: litellm.register_model({'model-id': {'output_cost_per_video_per_second': ...}}).","Alias your deployment's model name to a known base model in the router's model_info.","Catch and log-zero for unmapped video models if billing is handled externally."],"exampleFix":"# before\ncost = litellm.cost_calculator.default_video_cost_calculator(\"acme-video-v2\", 12.0)\n\n# after\nlitellm.register_model({\"acme-video-v2\": {\"output_cost_per_video_per_second\": 0.10}})\ncost = litellm.cost_calculator.default_video_cost_calculator(\"acme-video-v2\", 12.0)","handlingStrategy":"validation","validationCode":"import litellm\n\nif model not in litellm.model_cost and model.split(\"/\")[-1] not in litellm.model_cost:\n    litellm.register_model({model: {\"output_cost_per_video_per_second\": fallback}})","typeGuard":"def video_model_priced(model: str, provider: str | None = None) -> bool:\n    candidates = [model, f\"{provider}/{model}\" if provider else None, model.split(\"/\")[-1]]\n    return any(c and c in litellm.model_cost for c in candidates)","tryCatchPattern":"try:\n    cost = default_video_cost_calculator(model, duration_seconds, custom_llm_provider=provider)\nexcept Exception as e:\n    if \"not found in cost map\" in str(e):\n        litellm.register_model({model: {\"output_cost_per_video_per_second\": fallback}})\n        cost = default_video_cost_calculator(model, duration_seconds, custom_llm_provider=provider)\n    else:\n        raise","preventionTips":["Register per-second video pricing for any custom video model at startup.","Keep LiteLLM updated when new video models launch.","Alert on video cost failures so unmapped models are caught on first use."],"tags":["litellm","cost-calculation","video-generation","pricing-data"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}