BerriAI/litellm · error · Exception

No pricing information found for model {model}. Tried checki

Error message

No pricing information found for model {model}. Tried checking {models_to_check}

What it means

The image model WAS found in the cost map, but its entry has neither input_cost_per_image nor input_cost_per_pixel, so LiteLLM cannot compute an image-generation cost and raises this Exception. It distinguishes 'known model, incomplete pricing' from error 237's 'unknown model'.

Source

Thrown at litellm/cost_calculator.py:2019

        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 to

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Add input_cost_per_image (preferred) or input_cost_per_pixel to the model's entry via litellm.register_model.
  2. Check what entry matched: print litellm.model_cost[model] and inspect its pricing keys.
  3. Register a distinct model id for image generation so it doesn't collide with a text-model entry.
  4. Update LiteLLM in case upstream pricing keys changed naming.

Example fix

# before
litellm.register_model({"my-img": {"input_cost_per_token": 0.00001}})  # no image pricing

# after
litellm.register_model({"my-img": {"input_cost_per_image": 0.02}})
Defensive patterns

Strategy: validation

Validate before calling

info = litellm.model_cost.get(model) or litellm.model_cost.get(model.split("/")[-1])
if info and not (info.get("input_cost_per_image") or info.get("input_cost_per_pixel")):
    litellm.register_model({model: {**info, "input_cost_per_image": fallback}})

Type guard

def has_image_pricing(model: str) -> bool:
    info = litellm.model_cost.get(model) or litellm.model_cost.get(model.split("/")[-1])
    return bool(info and (info.get("input_cost_per_image") is not None or info.get("input_cost_per_pixel") is not None))

Try / catch

try:
    cost = litellm.completion_cost(completion_response=resp, model=model)
except Exception as e:
    if "No pricing information found" in str(e):
        litellm.register_model({model: {"input_cost_per_image": fallback_price}})
        cost = litellm.completion_cost(completion_response=resp, model=model)
    else:
        raise

Prevention

When it happens

Trigger: A model_cost entry for the image model exists but lacks both pricing keys — e.g. registered with only token pricing, or a provider's text-model entry matched the image request's model name.

Common situations: register_model calls that copy LLM token pricing for an image model; model name collisions where a chat model shares the image model's name; partially populated custom cost maps.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/ad13d3f3988f0153. Report an issue: GitHub.