BerriAI/litellm · error · ValueError
cost for tts call is None. prompt_cost=
Error message
cost for tts call is None. prompt_cost={_prompt_cost}, completion_cost={_completion_cost}, model={model_without_prefix}, custom_llm_provider={custom_llm_provider}, prompt_characters={prompt_characters}, completion_characters={completion_characters} What it means
Error "cost for tts call is None. prompt_cost={_prompt_cost}, completion_cost={_completion_cost}, model={model_without_prefix}, custom_llm_provider={custom_llm_provider}, prompt_characters={prompt_characters}, completion_characters={completion_characters}" thrown in BerriAI/litellm.
Solutions
- Ensure the TTS model exists in the litellm cost map so a per-character price is available.
- Add custom pricing for the model via litellm.model_cost or the proxy config if it is a custom deployment.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/cost_calculator.py:507 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/e535293573ae6d88.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/cost_calculator.py:507
speech_model_info = litellm.get_model_info(model=model_without_prefix, custom_llm_provider=custom_llm_provider)
cost_metric: Final = select_cost_metric_for_model(speech_model_info)
prompt_cost: float = 0.0
completion_cost: float = 0.0
if cost_metric == "cost_per_character":
if prompt_characters is None:
raise ValueError(
f"prompt_characters must be provided for tts calls. prompt_characters={prompt_characters}, model={model}, custom_llm_provider={custom_llm_provider}, call_type={call_type}"
)
_prompt_cost, _completion_cost = _generic_cost_per_character(
model=model_without_prefix,
custom_llm_provider=custom_llm_provider,
prompt_characters=prompt_characters,
completion_characters=0,
custom_prompt_cost=None,
custom_completion_cost=0,
)
if _prompt_cost is None or _completion_cost is None:
raise ValueError(
f"cost for tts call is None. prompt_cost={_prompt_cost}, completion_cost={_completion_cost}, model={model_without_prefix}, custom_llm_provider={custom_llm_provider}, prompt_characters={prompt_characters}, completion_characters={completion_characters}"
)
prompt_cost = _prompt_cost
completion_cost = _completion_cost
elif cost_metric == "cost_per_token":
prompt_cost, completion_cost = generic_cost_per_token(
model=model_without_prefix,
usage=usage_block,
custom_llm_provider=custom_llm_provider,
service_tier=service_tier,
data_residency=data_residency,
)
return prompt_cost, completion_cost
elif call_type == "arerank" or call_type == "rerank":
return rerank_cost(
model=model,
custom_llm_provider=custom_llm_provider,View on GitHub (pinned to 77b7c6c40c)