AI 0.15.0: Estimated costs for text-to-speech requests
AI 0.15.0 puts a cost on text-to-speech requests. Until now a speech request in the usage log had no cost at all, because no speech provider reports one in its answer.
How the cost is worked out
A new PhoenixKitAI.TtsPricing module estimates it from a rate table kept in the module. Mistral and xAI charge per character, and the module knows exactly how many characters it sent, so their costs are exact as long as the rate is current: $16 per million characters for Mistral and $4.20 for xAI. OpenAI charges per token but returns no token counts, so its cost is an estimate: about $0.015 per minute of audio, with the length worked out from the size of the MP3 file. A provider without a rate still gets no cost.
The rates are dated in the module’s documentation and have to be updated by hand when providers change their prices.
Where it shows
The cost is stored on the request like any other, so speech now counts in the AI usage totals.
Upgrading
No migration. Update the dependency. Only requests made after the update get a cost; earlier speech requests keep an empty one.
Full release notes: AI 0.15.0
0.15.0 · 16 July 2026
Added
- Estimated cost for TTS requests.
cost_cents(nanodollars) on attsrequest row was alwaysnil— no TTS provider self-reports cost the way OpenRouter’s chat completions do (nousageobject at all in an/audio/speechor xAI/ttsresponse), so unlike chat/embeddings there was nothing to extract. NewPhoenixKitAI.TtsPricingmodule estimates it from a hand-maintained per-provider rate table instead: Mistral and xAI bill per character ($16/$4.20per 1M chars respectively) andinput_charsis exact, so those are exact given the rate is current; OpenAI bills per token with no token counts to read back, so it uses the commonly-cited blended rate (~$0.015/min of audio) applied to a duration estimated fromaudio_bytesat the assumed 128kbps MP3 bitrate — an estimate, not exact. Rates are dated in the module doc and will need periodic manual updates as providers change pricing; an unpriced provider still returnsnil, same as before.
AI 0.15.0. Install or update: {:phoenix_kit_ai, "~> 0.15"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.