{"record":{"id":"eff853fbd23801b4","repo":"BerriAI/litellm","slug":"unable-to-calculat-cost-for-received-potential-mod","errorCode":null,"errorMessage":"Unable to calculat cost for received potential model names - {potential_model_names}","messagePattern":"Unable to calculat cost for received potential model names - (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/cost_calculator.py","lineNumber":1693,"sourceCode":"                        discount_amount=discount_amount,\n                        margin_percent=margin_percent,\n                        margin_fixed_amount=margin_fixed_amount,\n                        margin_total_amount=margin_total_amount,\n                        cache_read_cost=_cache_read_cost,\n                        cache_creation_cost=_cache_creation_cost,\n                        reasoning_cost=_reasoning_cost,\n                        service_tier=service_tier,\n                        data_residency=data_residency,\n                    )\n\n                return _final_cost\n            except Exception as e:\n                verbose_logger.debug(\n                    \"litellm.cost_calculator.py::completion_cost() - Error calculating cost for model=%s - %s\", model, e\n                )\n                if idx == len(potential_model_names) - 1:\n                    raise e\n        raise Exception(f\"Unable to calculat cost for received potential model names - {potential_model_names}\")\n    except Exception as e:\n        raise e\n\n\ndef get_response_cost_from_hidden_params(\n    hidden_params: dict | BaseModel,\n) -> float | None:\n    if isinstance(hidden_params, BaseModel):\n        _hidden_params_dict = cast(BaseModel, hidden_params).model_dump()\n    else:\n        _hidden_params_dict = hidden_params\n\n    additional_headers: Final = _hidden_params_dict.get(\"additional_headers\", {})\n    if additional_headers and \"llm_provider-x-litellm-response-cost\" in additional_headers:\n        response_cost: Final = additional_headers[\"llm_provider-x-litellm-response-cost\"]\n        if response_cost is None:\n            return None\n        return float(additional_headers[\"llm_provider-x-litellm-response-cost\"])","sourceCodeStart":1675,"sourceCodeEnd":1711,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/cost_calculator.py#L1675-L1711","documentation":"After trying every candidate model name (stripped prefixes, mapped variants) against the known pricing tables, no cost row matched; the list of attempted names is included so the unrecognized model can be identified — typically an unmapped or misspelled model.","triggerScenarios":"Thrown at litellm/cost_calculator.py:1693 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the model name (or its aliases) exists in the litellm cost map; none of the tried names had pricing.","Register custom pricing for the model, or correct the model name spelling."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}