novard / docs /API.md
Novard-ai's picture
Upload folder using huggingface_hub
ce63e5e verified
|
Raw History Blame Contribute Delete
3.55 kB

SwitchLingo API and MCP

Translate the speech in any video from your own app, script, or AI assistant.

  • REST API: https://switchlingo.ai/v1/... (interactive schema at https://switchlingo.ai/docs)
  • MCP server: https://switchlingo.ai/mcp for Claude, ChatGPT, Cursor and other MCP clients

API keys

Every request needs a key. The owner creates and turns off keys at https://switchlingo.ai/keys.html (password: the Space secret OXT_ADMIN_TOKEN). A key is shown once; only its SHA-256 hash is stored.

Send it as Authorization: Bearer sl_... or X-API-Key: sl_....

Limits per key: 50 videos a day by default (set per key), 3 in progress at once, 10 minutes / 300 MB per video. Results are deleted 24 hours after they finish. A key only sees the translations it started.

REST

Start a translation

curl -X POST https://switchlingo.ai/v1/translations \
  -H "Authorization: Bearer $SWITCHLINGO_KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://www.youtube.com/watch?v=...", "target": "English"}'

Or upload a file: -F file=@clip.mp4 -F target=es (multipart).

Field Required Notes
url or file yes Video link (YouTube, Facebook, Instagram, TikTok, X, 1,000+ sites, direct links) or an upload
target no Language code or name, default en. See GET /v1/languages
source no Spoken language if auto-detect gets it wrong
outputs no text (default), add subs for a subtitled video, dub for an AI voice-over
quality no fast (default) or accurate (better for rare languages, slower)

Returns 202 with {"id": "...", "status": "queued", "status_url": "..."}.

Check it / get the result

curl https://switchlingo.ai/v1/translations/$ID -H "Authorization: Bearer $SWITCHLINGO_KEY"

When status is done you get text (the translation as readable paragraphs), original_text, the languages, duration, and files (download links: transcript, subtitles, and video/voice-over if asked). Add ?segments=true for timestamped lines. status can also be queued, running or error (see error).

Other endpoints:

  • GET /v1/translations/{id}/text - just the translated text (?which=original for the original)
  • GET /v1/translations/{id}/files/{name} - download a file with your key
  • GET /v1/languages - all languages (code + name)

Errors: 401 bad key, 400 bad input, 404 not found or expired, 409 not ready, 413 file too big, 429 daily or in-progress limit, 503 busy.

MCP (AI assistants)

Claude (Settings → Connectors → Add custom connector), ChatGPT (connectors / developer mode) or Cursor: paste https://switchlingo.ai/mcp?key=sl_... (the key page shows this link when you create a key). Clients that can send headers can use https://switchlingo.ai/mcp with Authorization: Bearer sl_....

Tools:

  • translate_video(url, target_language="English", source_language?, wait_seconds=120) - starts the translation and waits up to 4 minutes; returns the text, or a job id if it's still running
  • get_translation(job_id, wait_seconds=0) - check a translation started earlier
  • list_languages() - all languages

Rules

API translations run as adult (18+) jobs with no voice cloning. By using a key you accept the Terms: only translate videos you have the right to use, keep the "AI translated" label when you share results, and don't rely on machine translation for medical, legal or immigration decisions.