BerriAI/litellm · error · Exception
Model not found in cost map for model=
Error message
Model not found in cost map for model={model} What it means
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.
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.
Example fix
# before: no entry for the video model -> raise on cost calculation
litellm.register_model({"veo-3-fast": {"mode": "video_generation"}})
# after: per-second pricing key present
litellm.register_model({
"gemini/veo-3-fast": {
"output_cost_per_video_per_second": 0.15,
"mode": "video_generation",
}
}) Defensive patterns
Strategy: validation
Validate before calling
import litellm
def ensure_video_pricing(model: str, custom_llm_provider: str | None = None) -> None:
candidates = [model, model.split("/")[-1]]
if custom_llm_provider:
candidates.append(f"{custom_llm_provider}/{model}")
if not any(c in litellm.model_cost for c in candidates):
raise ValueError(
f"No video pricing for {model!r}; register output_cost_per_video_per_second first."
) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Model not found in cost map. Tried checking
- No pricing information found for model
- Could not calculate cost for model
- Cannot delete file . The file is referenced by batch(es) in…
- Discount for must be a number
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/bb2131cc3b4607e2.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/cost_calculator.py:2086
models_to_check: Final[list[str | None]] = [
base_model_name,
model,
model_without_provider,
model_name_without_custom_llm_provider,
]
for _model in models_to_check:
if _model is not None and _model in litellm.model_cost:
cost_info = litellm.model_cost[_model]
break
# If still not found, try with custom_llm_provider prefix
if cost_info is None and custom_llm_provider:
prefixed_model: Final = f"{custom_llm_provider}/{model}"
if prefixed_model in litellm.model_cost:
cost_info = litellm.model_cost[prefixed_model]
if cost_info is None:
raise Exception(f"Model not found in cost map for model={model}")
# Check for video-specific cost per second first
video_cost_per_second: Final = cost_info.get("output_cost_per_video_per_second")
if video_cost_per_second is not None:
return video_cost_per_second * duration_seconds
output_cost_per_second: Final = _video_output_cost_per_second(cost_info, video_resolution)
if output_cost_per_second is not None:
return output_cost_per_second * duration_seconds
# If no cost information found, return 0
verbose_logger.info(
"No cost information found for video model %s. Please add pricing to model_prices_and_context_window.json",
model,
)
return 0.0
View on GitHub (pinned to 77b7c6c40c)