{"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":2086,"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":2068,"sourceCodeEnd":2104,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/cost_calculator.py#L2068-L2104","documentation":"default_video_cost_calculator (litellm/cost_calculator.py:2026) prices video generation by looking up the model (with and without its provider prefix) in litellm.model_cost, or by using the deployment-level model_info when supplied. If no cost entry is found under any probed key it raises this Exception. Note the asymmetry: if an entry IS found but lacks per-second pricing, the function logs and returns 0.0 — only a completely missing entry raises.","triggerScenarios":"Calling a video-generation endpoint (e.g. litellm proxy /v1/videos or a vertex/gemini veo model) whose model string has no key in litellm.model_cost and whose deployment carries no model_info pricing: new veo/sora-style models on an older litellm, custom video model names, or a provider-prefixed string that matches neither \"<provider>/<model>\" nor the bare model.","commonSituations":"New video models shipping faster than the pinned litellm pricing file; proxy deployments that forgot to set custom pricing on the video deployment; model strings passed with unusual casing or aliasing so none of base_model_name / model / model_without_provider / prefixed_model match a key.","solutions":["Register video pricing before the call: litellm.register_model({\"<model>\": {\"output_cost_per_video_per_second\": 0.4, \"mode\": \"video_generation\"}}).","On LiteLLM proxy, set custom pricing on the deployment's model_info (output_cost_per_video_per_second, or tiered output_cost_per_second_per_resolution) — default_video_cost_calculator consumes model_info first.","Upgrade litellm so the bundled model_prices_and_context_window.json covers the new video model.","Check the exact model string: the lookup tries model, model.split(\"/\")[-1], and \"<custom_llm_provider>/<model>\" — make your registered key match one of them."],"exampleFix":"# before: no entry for the video model -> raise on cost calculation\nlitellm.register_model({\"veo-3-fast\": {\"mode\": \"video_generation\"}})\n\n# after: per-second pricing key present\nlitellm.register_model({\n    \"gemini/veo-3-fast\": {\n        \"output_cost_per_video_per_second\": 0.15,\n        \"mode\": \"video_generation\",\n    }\n})","handlingStrategy":"validation","validationCode":"import litellm\n\ndef ensure_video_pricing(model: str, custom_llm_provider: str | None = None) -> None:\n    candidates = [model, model.split(\"/\")[-1]]\n    if custom_llm_provider:\n        candidates.append(f\"{custom_llm_provider}/{model}\")\n    if not any(c in litellm.model_cost for c in candidates):\n        raise ValueError(\n            f\"No video pricing for {model!r}; register output_cost_per_video_per_second first.\"\n        )","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register output_cost_per_video_per_second for every video model at startup (or set custom pricing on the proxy deployment's model_info).","Keep model strings stable — the lookup relies on exact key matches with/without provider prefix.","Upgrade litellm when adding newly released video models to your stack."],"tags":["video-generation","cost-tracking","pricing","model-registry"],"backgroundTag":"model-pricing-not-found","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}