{"record":{"id":"e535293573ae6d88","repo":"BerriAI/litellm","slug":"cost-for-tts-call-is-none-prompt-cost-prompt-co","errorCode":null,"errorMessage":"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}","messagePattern":"cost for tts call is None\\. prompt_cost=(.+?), completion_cost=(.+?), model=(.+?), custom_llm_provider=(.+?), prompt_characters=(.+?), completion_characters=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/cost_calculator.py","lineNumber":507,"sourceCode":"        speech_model_info = litellm.get_model_info(model=model_without_prefix, custom_llm_provider=custom_llm_provider)\n        cost_metric: Final = select_cost_metric_for_model(speech_model_info)\n        prompt_cost: float = 0.0\n        completion_cost: float = 0.0\n        if cost_metric == \"cost_per_character\":\n            if prompt_characters is None:\n                raise ValueError(\n                    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}\"\n                )\n            _prompt_cost, _completion_cost = _generic_cost_per_character(\n                model=model_without_prefix,\n                custom_llm_provider=custom_llm_provider,\n                prompt_characters=prompt_characters,\n                completion_characters=0,\n                custom_prompt_cost=None,\n                custom_completion_cost=0,\n            )\n            if _prompt_cost is None or _completion_cost is None:\n                raise ValueError(\n                    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}\"\n                )\n            prompt_cost = _prompt_cost\n            completion_cost = _completion_cost\n        elif cost_metric == \"cost_per_token\":\n            prompt_cost, completion_cost = generic_cost_per_token(\n                model=model_without_prefix,\n                usage=usage_block,\n                custom_llm_provider=custom_llm_provider,\n                service_tier=service_tier,\n                data_residency=data_residency,\n            )\n\n        return prompt_cost, completion_cost\n    elif call_type == \"arerank\" or call_type == \"rerank\":\n        return rerank_cost(\n            model=model,\n            custom_llm_provider=custom_llm_provider,","sourceCodeStart":489,"sourceCodeEnd":525,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/cost_calculator.py#L489-L525","documentation":"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.","triggerScenarios":"Thrown at litellm/cost_calculator.py:507 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"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-23T08:17:48.524Z"}