BerriAI/litellm · error · Exception
No pricing information found for model
Error message
No pricing information found for model {model}. Tried checking {models_to_check} What it means
Raised in the same default_image_cost_calculator after a model entry WAS found in litellm.model_cost, but the entry contains neither input_cost_per_image (priority 1) nor input_cost_per_pixel (priority 2). litellm's image calculator only understands per-image or per-pixel pricing; an entry with only token-based fields (input_cost_per_token) cannot be used, so it raises. The generated image itself was returned successfully; only the cost calculation fails.
Solutions
- Extend the model's cost entry with input_cost_per_image (preferred): litellm.register_model({"<model>": {"input_cost_per_image": 0.02, "mode": "image_generation"}}).
- If you must use legacy per-pixel pricing, set input_cost_per_pixel instead — the calculator multiplies it by height*width*n.
- Verify the matched entry is not a same-named text model; rename the image model or fix the entry so token-only pricing is not silently reused.
- Upgrade litellm — a newer pricing file may add per-image pricing for the model.
Example fix
# before: entry exists but only has token pricing -> "No pricing information found"
litellm.register_model({"my-image-model": {"input_cost_per_token": 0.00001}})
# after: image-model pricing keys the calculator understands
litellm.register_model({
"my-image-model": {
"input_cost_per_image": 0.02,
"mode": "image_generation",
}
}) Defensive patterns
Strategy: validation
Validate before calling
import litellm
def ensure_image_cost_fields(model: str) -> None:
"""Raise before the call unless the model's entry has per-image or per-pixel pricing."""
entry = litellm.model_cost.get(model) or litellm.model_cost.get(model.split("/")[-1])
if entry is None or (entry.get("input_cost_per_image") is None and entry.get("input_cost_per_pixel") is None):
raise ValueError(
f"{model!r} lacks input_cost_per_image/input_cost_per_pixel; "
"litellm.register_model with input_cost_per_image before calling."
) Prevention
- When registering image models, always include input_cost_per_image (or input_cost_per_pixel) — token keys alone are ignored.
- Never reuse a text-model pricing template verbatim for image models.
- Log the matched litellm.model_cost entry in dev builds to confirm which key was found.
When it happens
Trigger: A litellm.register_model / proxy model_info entry for an image model that defines only token pricing (input_cost_per_token) or no pricing fields at all; a model name that collides with a text-model entry in the pricing map (found, but the entry has no image keys); hand-edited model_prices_and_context_window.json files missing the image cost fields.
Common situations: Teams copy-pasting a text-model pricing template into register_model for an image model; proxy deployments that set cost per token for image endpoints; partial custom pricing JSON files that list the model but omit the image-specific keys.
Related errors
- Model not found in cost map. Tried checking
- Model not found in cost map for model=
- Could not calculate cost for model
- api_base not set for LiteLLM Proxy route. Set in env via…
- BFL_API_KEY is not set. Please set it via environment…
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/ad13d3f3988f0153.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/cost_calculator.py:2023
model_without_provider,
model,
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 cost_info is None:
raise Exception(f"Model not found in cost map. Tried checking {models_to_check}")
# Priority 1: Use per-image pricing if available (for gpt-image-1 and similar models)
if "input_cost_per_image" in cost_info and cost_info["input_cost_per_image"] is not None:
return cost_info["input_cost_per_image"] * n
# Priority 2: Fall back to per-pixel pricing for backward compatibility
elif "input_cost_per_pixel" in cost_info and cost_info["input_cost_per_pixel"] is not None:
return cost_info["input_cost_per_pixel"] * height * width * n
else:
raise Exception(f"No pricing information found for model {model}. Tried checking {models_to_check}")
def default_video_cost_calculator(
model: str,
duration_seconds: float,
custom_llm_provider: str | None = None,
model_info: ModelInfo | None = None,
video_resolution: str | None = None,
) -> float:
"""
Default video cost calculator for video generation
Args:
model (str): Model name
duration_seconds (float): Duration of the generated video in seconds
custom_llm_provider (Optional[str]): Custom LLM provider
model_info (Optional[ModelInfo]): Deployment-level model info containing
custom video pricing. When provided, used before falling back toView on GitHub (pinned to 77b7c6c40c)