Developers

Translate subtitles from your own code

The same endpoint the SubLingo page uses is open to scripts, bots and apps. Calls from outside the browser page use credits: 10,000 subtitle lines for $5, about 30 episodes of a 24-minute anime. No account, no subscription, credits never expire. Translating by hand on sublingo.cc stays free.

Get a key

  1. Buy a credit pack on the credits page. The license key arrives by email.
  2. Redeem the key once on the same page. That activates its lines.
  3. Send it in the x-sublingo-key header with every request.

Request

POST https://sublingo.cc/api/translate with a JSON body: texts (array of subtitle lines, text only), from and to (language names, below; from may be "Auto"). The response has the translations in the same order and count. Timing is yours to keep: send only the text of each cue and put the translations back on your own timestamps.

curl -X POST https://sublingo.cc/api/translate \
  -H "Content-Type: application/json" \
  -H "x-sublingo-key: YOUR_LICENSE_KEY" \
  -d '{"texts":["Where are you going?","Wait for me!"],"from":"English","to":"Indonesian"}'
{"translated":["Kamu mau ke mana?","Tunggu aku!"]}

Python example

import requests

API = "https://sublingo.cc/api/translate"
KEY = "YOUR_LICENSE_KEY"

def translate(lines, src="English", dst="Indonesian"):
    out = []
    for i in range(0, len(lines), 30):          # 30 lines per request
        r = requests.post(API, json={"texts": lines[i:i+30], "from": src, "to": dst},
                          headers={"x-sublingo-key": KEY}, timeout=90)
        r.raise_for_status()
        out += r.json()["translated"]
    return out

Limits and billing

Errors

HTTPcodeMeaning
401API_KEY_REQUIREDRequest didn't come from the sublingo.cc page and has no x-sublingo-key header.
429CREDITS_EMPTYThe key has no lines left (or was never redeemed). Buy and redeem another pack, then switch to the new key.
413PAYLOAD_LIMITOver 2,000 lines or 200,000 characters in one request. Split it; 30 lines per request is the sweet spot.
503DAILY_CAPTranslation is paused for everyone for the rest of the UTC day (service-wide cost limit). Retry tomorrow.
500—Upstream model error. Lines are refunded automatically; retry the same request.

Languages

Use the names exactly as written:

English · Spanish · Portuguese · French · German · Italian · Japanese · Korean · Chinese (Simplified) · Chinese (Traditional) · Arabic · Hindi · Russian · Vietnamese · Indonesian · Thai · Turkish · Dutch · Polish · Swedish · Greek · Czech · Romanian · Hungarian · Hebrew · Persian · Ukrainian · Tamil · Filipino · Malay

Each key keeps its own balance, so for a bigger job buy several packs and move to the next key when one runs out. Creem, the checkout provider, emails a receipt for every purchase.