Text to speech API
LiveNatural voiceovers in many voices and languages.
Compare Text to speech API models
Every model behind this endpoint, with live prices. Try one in the playground or open its page.
Call Text to speech API from your code
One endpoint for every model above. Change the model field to switch.
https:/ / api.opennan.com/ v1/ audio/ speech- GET
/Every model of this endpoint, with pricesv1/ models? category= voice
Get an API key
Create a key in the console. It uses the same balance as the playground.
Create a keySend your first request
The same request the playground sends. Set OPENNAN_KEY to your key.
curl https://api.opennan.com/v1/audio/speech \ -H "Authorization: Bearer $OPENNAN_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"kokoro","input":"Hello! This voice was made with one API call.","voice":"heart","response_format":"mp3"}' \ --output speech.mp3Read the result
The result comes back in the same response. The X-Usage-Cost-Usd header says what the call cost.
Parameters
Built from the live catalog: every value listed here is one the API accepts.
Errors and how to fix them
401Missing or wrong key
Send the header Authorization: Bearer with a key from the console.
402Balance too low
Add credit in Billing, then send the same call again.
400A value is not accepted
Read error.message: it names the field. Use a value from the parameter table.
429Too many requests
Wait a few seconds and try again, waiting longer after each 429.
Add Opennan to your AI app
One install gives your AI every Opennan tool: video, images, chat, voice, music, sound effects, 3D, captions and dubbing. Pick your app and follow the steps.
https:/ / api.opennan.com/ v1/ mcpWorks in the Codex CLI, the Codex app and the Codex IDE extension: they share ~/.codex/config.toml. If the app or IDE does not see OPENNAN_KEY, use the config.toml option with your key in it. Codex asks before each tool call: approve it to go on.
Get an API key
Create a key in the console. It starts with sk- and uses the same balance as the website.
Create a keySave your key as OPENNAN_KEY
# macOS / Linux (zsh shown; bash: ~/.bashrc) echo 'export OPENNAN_KEY="sk-..."' >> ~/.zshrc source ~/.zshrc # Windows (PowerShell), then open a new terminal setx OPENNAN_KEY "sk-..."Install the Opennan plugin: the server plus a skill that teaches your AI to pick models, confirm prices and wait for results
codex plugin marketplace add Opennan/opennan-ai-plugin codex plugin add opennan@opennanOr add only the server
codex mcp add opennan --url https://api.opennan.com/v1/mcp --bearer-token-env-var OPENNAN_KEYOr add this to ~/.codex/config.toml
[mcp_servers.opennan] url = "https://api.opennan.com/v1/mcp" http_headers = { Authorization = "Bearer sk-..." }Check that opennan is listed
codex mcp listRestart Codex, then ask for anything
“Make a 5 second video of rain on a neon street, a song to go with it and a poster image.”
Replace sk-... with your own key and keep it private: anyone who has it can spend your balance. Your app can list the tools before you add a key; making anything needs one.
This tool from your AI
Once Opennan is added, your AI calls this tool with arguments like these.
- Tool
- generate_speech
- Example arguments
{ "model": "kokoro", "input": "Hello! This voice was made with one API call.", "voice": "heart" }
Text to speech API: questions
How much does Text to speech API cost?
From $1.287 per 1M characters with Kokoro, the cheapest of 4 models here. You see the price before you run.
How do I call it from my code?
Send POST https://api.opennan.com/v1/audio/speech with your API key. The result comes back in the same response.
Can I switch models without changing my code?
Yes. Change the model field and keep the rest of the request, the same key and the same balance.
Can my AI agent use it?
Yes. Add the MCP server https://api.opennan.com/v1/mcp and call the generate_speech tool, or point your agent at https://api.opennan.com/llms.txt.
What happens if a run fails?
A failed run is not charged. You pay only for results.