Caption translation
LiveSend your timed captions and a language. Get the same lines back translated, in the same order and with the same timings, ready to put on the video.
Caption translation
Input
segmentsThe timed caption lines, each with start, end (seconds) and text.target_languageThe language to translate into.source_languageThe captions' language; leave it out to detect it.$0.00591 per started 1,000 characters.
120 billed characters120 billed characters
1 00:00:00,200 --> 00:00:02,240 สวัสดีและยินดีต้อนรับสู่ร้านกาแฟของเรา 2 00:00:03,040 --> 00:00:05,160 วันนี้เรามีเค้กช็อกโกแลตสดใหม่ 3 00:00:05,880 --> 00:00:06,500 อยากลองชิมไหมครับ?
Language: th
How it works
- 01Send the captionsLines with start and end seconds, and a language such as th or ja.
- 02We translate themLine by line, short enough to read.
- 03Get the captionsBilled per 1,000 characters, known up front.
Call Caption translation from your code
One endpoint and one key, on the same balance as the playground. The request below is the example's own.
https:/ / api.opennan.com/ v1/ captions/ translationsGet 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/captions/translations \ -H "Authorization: Bearer $OPENNAN_KEY" \ -H "Content-Type: application/json" \ -d '{"segments":[{"start":0.2,"end":2.24,"text":"Hello and welcome to our coffee shop."},{"start":3.04,"end":5.16,"text":"Today we have fresh chocolate cakes."},{"start":5.88,"end":6.5,"text":"Want to try them?"}],"target_language":"th","source_language":"en"}' # Then poll until "status" is "succeeded" or "failed": curl https://api.opennan.com/v1/tasks/<task id> -H "Authorization: Bearer $OPENNAN_KEY"Poll the task
The call answers right away with a task id. Ask for the task until it finishes:
GEThttps:// api.opennan.com/ v1/ tasks/ {id} - queued
- Waiting for a worker
- running
- Being made
- succeeded
- Done: outputs[].url holds the files
- failed
- Failed: you are not charged
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
- translate_captions
- Example arguments
{ "segments": [ { "start": 0.2, "end": 2.24, "text": "Hello and welcome to our coffee shop." }, { "start": 3.04, "end": 5.16, "text": "Today we have fresh chocolate cakes." }, { "start": 5.88, "end": 6.5, "text": "Want to try them?" } ], "target_language": "th", "source_language": "en" }
Caption translation: questions
How much does Caption translation cost?
$0.00591 per 1,000 characters. The Run button shows the exact price for your input before you start.
How do I call it from my code?
Send POST https://api.opennan.com/v1/captions/translations with your API key. It answers with a task id: ask https://api.opennan.com/v1/tasks/{id} until the task succeeds or fails.
Can my AI agent use it?
Yes. Add the MCP server https://api.opennan.com/v1/mcp and call the translate_captions 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.