# Orange Voice

> Speech API for every Indian language and Indian English: text to speech, speech to text, voice cloning, voice design, voice changer, dubbing and long-form stories. REST + OpenAI-compatible routes + an MCP server. By ImuTechz, India.

- API base: https://orange-api.imutechz.in
- OpenAPI 3.1: https://orange-api.imutechz.in/v1/openapi.json
- MCP server (streamable HTTP, POST only): https://orange-api.imutechz.in/mcp (card: https://orange-api.imutechz.in/.well-known/mcp.json)
- Full reference for agents: https://orange-api.imutechz.in/llms-full.txt
- Human docs: https://theorange.imutechz.in/voice/docs/ . Support: support@imutechz.in

## Authentication

Send `Authorization: Bearer ov_pat_...` on every call. The user creates this personal access token, with scopes and an optional expiry, at https://theorange.imutechz.in/voice/api-keys/ and gives it to you. Tokens cannot be made through the API: if you have none, or get 401 INVALID_API_KEY, ask the user for one. 403 INSUFFICIENT_SCOPE means the token lacks a scope (`details.required`). Scopes: speech, transcribe, voices:read, voices:write, convert, dub, stories, account:read.

## The five common tasks

1. Pick a voice and language (no token needed):
   curl "https://orange-api.imutechz.in/v1/voices?lang=hi"
   curl https://orange-api.imutechz.in/v1/languages
2. Text to speech, get a link (JSON) - default:
   curl -X POST https://orange-api.imutechz.in/v1/tts -H "Authorization: Bearer $ORANGE_TOKEN" -H "Content-Type: application/json" -d '{"text": "[happy] Namaskar! Aap kaise hain?", "voice_id": "orange", "lang": "hinglish", "format": "mp3"}'
   -> {"audioUrl": "...", "durationMs": 2310, "characters": 24, "usage": {"used", "limit", "left"}}. Download audioUrl at once: it lasts about 5 minutes.
   Or get the bytes directly: add -H "Accept: audio/mpeg" -o out.mp3
3. Speech to text:
   curl -X POST https://orange-api.imutechz.in/v1/stt -H "Authorization: Bearer $ORANGE_TOKEN" -F audio=@clip.mp3 -F lang=auto -F diarize=false
   -> {"text", "lang", "duration", "segments": [{"start", "end", "text", "speaker"}]}. `-F format=srt` (or vtt, txt) returns subtitles as text.
4. Dub a video or audio file (asynchronous job):
   curl -X POST https://orange-api.imutechz.in/v1/dub -H "Authorization: Bearer $ORANGE_TOKEN" -F media=@talk.mp4 -F target_lang=bn
   -> 202 {"jobId": "..."}. Then poll every 2-5 s: curl https://orange-api.imutechz.in/v1/jobs/JOB_ID -H "Authorization: Bearer $ORANGE_TOKEN"
   until "status" is "done" (result.url is the file) or "failed" (error.code; nothing counted).
5. Check what is left this month:
   curl https://orange-api.imutechz.in/v1/usage -H "Authorization: Bearer $ORANGE_TOKEN"
   -> {"characters": {"used", "limit"}, "seconds": {"used", "limit"}, "periodEnd"}

## Rules worth knowing

- Text to speech: up to 5,000 spoken characters a request (split long text at sentence ends, or use stories). Inline tags change delivery and are not counted: [happy], [sad], [calm], [whisper], [pause], [long pause], <laugh>, <sigh> (full list in llms-full.txt). speed 0.5-2.0, pitch -12..12 semitones, format mp3|wav|opus.
- A voice only speaks its `languages`; otherwise 422 LANGUAGE_NOT_VOICED. Language codes: en-IN, hi, bn, mr, hinglish, banglish, te, ta, gu, kn, ml, or, pa, as, ur, mai, kok, ne, sd, doi, ks, mni, brx, sat, sa.
- Streaming: for live playback use the WebSocket wss://orange-api.imutechz.in/v1/tts/stream (token in the first message, audio arrives in binary frames). For files use POST /v1/tts (JSON link or bytes).
- Jobs (dub, story render, voice design) answer 202 at once; poll GET /v1/jobs/{id}.
- Uploads: multipart, up to 100 MB; STT up to 60 minutes, voice changer 120 s, dub 10 minutes.
- `Idempotency-Key` header (optional): single use; a repeat is 409 DUPLICATE_REQUEST and is never done or counted twice.
- Work done with an API key is not listed in the studio history (historyId is null): keep your own record.
- Rate limit: about 30 requests a minute per account (more on Blood Orange).

## Errors: what to do

Every error is {"error": {"code", "message", "details?"}}. A failed request is never counted.
- 400 VALIDATION: fix the field named in the message; do not retry unchanged.
- 401 INVALID_API_KEY: ask the user for a valid token from https://theorange.imutechz.in/voice/api-keys/.
- 402 SUBSCRIPTION_REQUIRED / SUBSCRIPTION_INACTIVE: stop and tell the user to subscribe or renew at https://theorange.imutechz.in/voice/pricing/ .
- 403 INSUFFICIENT_SCOPE: ask for a token with details.required. 403 CLONE_LIMIT: the plan's cloned-voice count is full.
- 409 DUPLICATE_REQUEST: that key was used; use the first answer.
- 429 RATE_LIMITED: wait the Retry-After header's seconds, then retry. 429 MONTHLY_LIMIT_REACHED: do not retry; details.resetsAt says when it resets.
- 500 INTERNAL: retry once after a few seconds.

## Plans

- Free (`free`), free: 2,000 characters and 1 minutes of audio a period; speech and transcription only.
- Zest (`zest`), Rs 29 for 7 days, once: 15,000 characters and 30 minutes of audio a period; clone, design, story, dub, app.
- Tangerine (`tangerine`), Rs 199 a month: 200,000 characters and 300 minutes of audio a period; clone, design, story, dub, app.
- Blood Orange (`blood_orange`), Rs 599 a month: 1,000,000 characters and 1,200 minutes of audio a period; clone, design, story, dub, app.

## OpenAI-compatible

Use an OpenAI SDK with base_url `https://orange-api.imutechz.in/v1` and the token as api_key: `audio.speech.create(model="tts-1", voice="alloy", input="...")` (OpenAI voice names use the Orange voice; pass any Orange voice id for others) and `audio.transcriptions.create(model="whisper-1", file=...)`.

## MCP

Add the server `https://orange-api.imutechz.in/mcp` with header `Authorization: Bearer ov_pat_...`. Tools: list_voices, list_languages, speak (returns an audio link), transcribe, convert_voice, clone_voice, create_story, render_story, start_dub, get_job, get_usage, list_plans.
