{"openapi":"3.1.0","info":{"title":"API Reference","version":"1.0.0"},"paths":{"/v1/text-to-speech":{"post":{"operationId":"Text-to-Speech","summary":"Text to Speech","description":"Generates audio from text using the specified voice. Returns the complete audio file\nin the requested format. This is a non-streaming endpoint that waits for the entire\naudio to be generated before returning.\n\nSet the format with `output_format`: the container (`raw`, `wav` or `mp3`), the encoding (`pcm_f32le`, `pcm_s16le`, `pcm_mulaw` or `pcm_alaw`) and the sample rate. The response carries `X-Audio-Format`, `X-Audio-Sample-Rate` and `X-Audio-Channels`. Without `output_format`, the response is a WAV file at 24 kHz. See [Output Formats](/text-to-speech/output-formats).\n","responses":{"200":{"description":"Audio file generated successfully","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Bad request, for example empty `text`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Voice ID not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation error. Each invalid field has its own entry in `detail`, and `loc` is the path to it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TTSRequest"}}}},"security":[{"ApiKeyAuth":[]}]}},"/v1/text-to-speech/stream":{"post":{"operationId":"textToSpeech_stream","summary":"Text to Speech (stream)","description":"Generates audio from text using Server-Sent Events (SSE) format. Audio chunks are\nstreamed in real-time as base64-encoded audio. This endpoint is optimized\nfor low-latency applications where audio playback should start as soon as possible.\n\nBy default each chunk is PCM F32LE (32-bit float). Send `output_format` to receive `pcm_s16le`, `pcm_mulaw` or `pcm_alaw` instead, at 8000, 16000, 22050 or 24000 Hz. The stream is always raw audio, so `output_format.container` must be `raw`. With `output_format`, the response also carries `X-Audio-Format`, `X-Audio-Sample-Rate` and `X-Audio-Channels`. See [Output Formats](/text-to-speech/output-formats).\n\nThe response is a stream of SSE events:\n- `event: chunk` - Contains base64-encoded audio data\n- `event: done` - Signals completion of audio generation\n\nEach chunk event contains:\n- `type`: \"chunk\"\n- `status_code`: 206 (Partial Content)\n- `done`: false\n- `data`: Base64-encoded audio chunk, in the `output_format` encoding (PCM F32LE by default)\n- `step_time`: Time taken to generate this chunk in seconds\n","tags":["textToSpeech"],"responses":{"200":{"description":"Streaming audio generation started","content":{"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Bad request, for example empty `text`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Voice ID not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation error. Each invalid field has its own entry in `detail`, and `loc` is the path to it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TTSRequest"}}}},"security":[{"ApiKeyAuth":[]}]}},"/v1/voices":{"get":{"operationId":"voices_getVoices","summary":"List voices","description":"Returns a list of all available voices with their IDs, names, supported languages, and model.\nEach voice belongs to a specific model (`standard` or `m1`). Use the `model` field from the response when calling TTS endpoints — a voice ID from one model will not work with the other.\n","tags":["voices"],"responses":{"200":{"description":"Successful response with list of voices","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoicesResponse"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"ApiKeyAuth":[]}]}},"/transcribe":{"post":{"operationId":"speechToText_transcribe","summary":"Speech to Text","description":"Transcribes a WAV audio file using `multipart/form-data`.","tags":["speechToText"],"responses":{"200":{"description":"Transcription successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranscribeResponse"}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Audio file to transcribe (WAV format)."},"language":{"$ref":"#/components/schemas/LanguageCode","description":"Optional language code for transcription."}},"required":["file"]}}}},"security":[{"ApiKeyAuth":[]}]}}},"tags":[{"name":"textToSpeech","description":"Text-to-speech generation endpoints"},{"name":"voices","description":"Voice management endpoints"},{"name":"speechToText","description":"Speech-to-text transcription endpoints"}],"servers":[{"url":"https://hub.getraya.app","description":"Production server"}],"components":{"schemas":{"TtsRequestModel":{"type":"string","enum":["standard","m1"],"default":"standard","description":"The synthesis model to use. Each model has its own set of voices — use `/v1/voices` to find voice IDs for the model you choose.\n\n**Important:** `standard` and `m1` voices are not interchangeable. Passing a `standard` voice ID with `\"model\": \"m1\"` (or vice versa) will fail.\n","title":"TtsRequestModel"},"TtsRequestLanguage":{"type":"string","enum":["hi","mr","te","kn","bn","as","gu","ne","ml","ta","en","en-in","en-us"],"description":"Language code for the text. Currently supported: hi (Hindi), mr (Marathi), te (Telugu), kn (Kannada), bn (Bengali), as (Assamese), gu (Gujarati), ne (Nepali), ml (Malayalam), ta (Tamil), en (English, used by m1 voices), en-in (Indian English), en-us (US English).\n\nHindi must be written in Devanagari script (Romanized Hindi is not supported). For English, Indic named entities are best written in Devanagari for accurate pronunciation.\nMore languages are coming soon.\n","title":"TtsRequestLanguage"},"OutputFormatContainer":{"type":"string","enum":["raw"],"default":"raw","description":"`raw` for headerless audio, `wav` for a WAV file, `mp3` for MP3. `wav` and `mp3` are only available on `/v1/text-to-speech`; the streaming endpoint accepts only `raw`.","title":"OutputFormatContainer"},"OutputFormatEncoding":{"type":"string","enum":["pcm_f32le","pcm_s16le","pcm_mulaw","pcm_alaw"],"description":"Sample encoding. Required for `raw` and `wav`; omit it for `mp3`. Audio is always mono.\n- `pcm_f32le`: 32-bit float, little-endian\n- `pcm_s16le`: 16-bit signed integer, little-endian\n- `pcm_mulaw`: G.711 μ-law (PCMU), 1 byte per sample\n- `pcm_alaw`: G.711 A-law (PCMA), 1 byte per sample","title":"OutputFormatEncoding"},"OutputFormatSampleRate":{"type":"string","enum":["8000","16000","22050","24000"],"description":"Sample rate in Hz.","title":"OutputFormatSampleRate"},"OutputFormat":{"type":"object","properties":{"container":{"$ref":"#/components/schemas/OutputFormatContainer","default":"raw","description":"`raw` for headerless audio, `wav` for a WAV file, `mp3` for MP3. `wav` and `mp3` are only available on `/v1/text-to-speech`; the streaming endpoint accepts only `raw`."},"encoding":{"$ref":"#/components/schemas/OutputFormatEncoding","description":"Sample encoding. Required for `raw` and `wav`; omit it for `mp3`. Audio is always mono.\n- `pcm_f32le`: 32-bit float, little-endian\n- `pcm_s16le`: 16-bit signed integer, little-endian\n- `pcm_mulaw`: G.711 μ-law (PCMU), 1 byte per sample\n- `pcm_alaw`: G.711 A-law (PCMA), 1 byte per sample"},"sample_rate":{"$ref":"#/components/schemas/OutputFormatSampleRate","default":24000,"description":"Sample rate in Hz."}},"description":"Encoding and sample rate of the audio chunks. Only the `raw` container is accepted on the WebSocket.","title":"OutputFormat"},"TTSRequest":{"type":"object","properties":{"text":{"type":"string","description":"The text to convert to speech.\n\n**Script notes:**\n- Hindi (`language`: `hi`) must be in Devanagari script. Romanized Hindi is not supported.\n- For English (`en-in`, `en-us`), Indic named entities (names, places, etc.) are pronounced more accurately in Devanagari — e.g. `राहुल` instead of `Rahul`. If text is LLM-generated, prompt it to output Indic names in Devanagari even when the rest of the content is in English.\n"},"voice_id":{"type":"string","description":"The ID of the voice to use for synthesis. Use `/v1/voices` to get available voice IDs.\nThe `voice_id` must match the `model` you specify — `standard` voices only work with `\"model\": \"standard\"`, and `m1` voices only work with `\"model\": \"m1\"`.\n"},"model":{"$ref":"#/components/schemas/TtsRequestModel","default":"standard","description":"The synthesis model to use. Each model has its own set of voices — use `/v1/voices` to find voice IDs for the model you choose.\n\n**Important:** `standard` and `m1` voices are not interchangeable. Passing a `standard` voice ID with `\"model\": \"m1\"` (or vice versa) will fail.\n"},"language":{"$ref":"#/components/schemas/TtsRequestLanguage","description":"Language code for the text. Currently supported: hi (Hindi), mr (Marathi), te (Telugu), kn (Kannada), bn (Bengali), as (Assamese), gu (Gujarati), ne (Nepali), ml (Malayalam), ta (Tamil), en (English, used by m1 voices), en-in (Indian English), en-us (US English).\n\nHindi must be written in Devanagari script (Romanized Hindi is not supported). For English, Indic named entities are best written in Devanagari for accurate pronunciation.\nMore languages are coming soon.\n"},"speed":{"type":"string","title":"float","description":"Speech speed multiplier (0.5 to 1.5). Changes standard voices only; m1 voices ignore it.","default":1},"output_format":{"$ref":"#/components/schemas/OutputFormat"}},"required":["text","voice_id","language"],"title":"TTSRequest"},"ErrorResponse":{"type":"object","properties":{"detail":{"type":"string","description":"Error message describing what went wrong"}},"title":"ErrorResponse"},"ValidationErrorEntryLocItems":{"oneOf":[{"type":"string"},{"type":"integer"}],"title":"ValidationErrorEntryLocItems"},"ValidationErrorEntryCtx":{"type":"object","properties":{},"description":"Additional context. Present on `value_error` entries.","title":"ValidationErrorEntryCtx"},"ValidationErrorEntry":{"type":"object","properties":{"type":{"type":"string","description":"Machine-readable kind of problem, such as `missing` or `value_error`."},"loc":{"type":"array","items":{"$ref":"#/components/schemas/ValidationErrorEntryLocItems"},"description":"Path to the invalid field, for example `[\"body\", \"output_format\", \"encoding\"]`."},"msg":{"type":"string","description":"Human-readable description of the problem."},"input":{"description":"The rejected value, when it can be echoed back."},"ctx":{"$ref":"#/components/schemas/ValidationErrorEntryCtx","description":"Additional context. Present on `value_error` entries."}},"title":"ValidationErrorEntry"},"ValidationErrorResponse":{"type":"object","properties":{"detail":{"type":"array","items":{"$ref":"#/components/schemas/ValidationErrorEntry"}}},"description":"Returned with 422 when request fields are invalid. Every invalid field has its own entry.","title":"ValidationErrorResponse"},"VoiceLanguage":{"type":"string","enum":["hi","mr","te","kn","bn","as","gu","ne","ml","ta","en","en-in","en-us"],"description":"Language code supported by this voice. Currently supported: hi (Hindi), mr (Marathi), te (Telugu), kn (Kannada), bn (Bengali), as (Assamese), gu (Gujarati), ne (Nepali), ml (Malayalam), ta (Tamil), en-in (Indian English), en-us (US English).\nMore languages are coming soon.\n","title":"VoiceLanguage"},"VoiceModel":{"type":"string","enum":["standard","m1"],"description":"The synthesis model this voice belongs to. Use the same value in the `model` field when calling TTS endpoints.","title":"VoiceModel"},"Voice":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the voice"},"name":{"type":"string","description":"Human-readable name of the voice"},"language":{"$ref":"#/components/schemas/VoiceLanguage","description":"Language code supported by this voice. Currently supported: hi (Hindi), mr (Marathi), te (Telugu), kn (Kannada), bn (Bengali), as (Assamese), gu (Gujarati), ne (Nepali), ml (Malayalam), ta (Tamil), en-in (Indian English), en-us (US English).\nMore languages are coming soon.\n"},"model":{"$ref":"#/components/schemas/VoiceModel","description":"The synthesis model this voice belongs to. Use the same value in the `model` field when calling TTS endpoints."}},"title":"Voice"},"VoicesResponse":{"type":"object","properties":{"voices":{"type":"array","items":{"$ref":"#/components/schemas/Voice"},"description":"List of available voices"},"count":{"type":"integer","description":"Total number of available voices"}},"title":"VoicesResponse"},"LanguageCode":{"type":"string","enum":["as","bn","brx","doi","en","gu","hi","kn","kok","ks","mai","ml","mni","mr","ne","or","pa","sa","sat","sd","ta","te","ur"],"title":"LanguageCode"},"TranscribeResponseStatus":{"type":"string","enum":["success","error"],"description":"Request status.","title":"TranscribeResponseStatus"},"TranscribeResponse":{"type":"object","properties":{"transcript":{"type":"string","description":"Transcribed text."},"status":{"$ref":"#/components/schemas/TranscribeResponseStatus","description":"Request status."}},"required":["transcript","status"],"title":"TranscribeResponse"}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key for authentication. Example: raya_ABCD1234567890abcdef"}}}}