> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sunbird.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Synthesize Speech (Orpheus-3B)

> Calls the Orpheus-3B Modal vLLM inference app, uploads the generated WAV to Google Cloud Storage, and returns a v4 presigned download URL valid for the configured expiry window (default 30 minutes), together with metadata and stage-by-stage latency timings.



## OpenAPI

````yaml api-reference/openapi-legacy.json POST /tasks/modal/orpheus/tts
openapi: 3.1.0
info:
  title: Sunbird AI API (Legacy / Deprecated)
  description: >

    Welcome to the Sunbird AI API documentation. The Sunbird AI API provides
    access to

    Sunbird's language models and AI services for Ugandan languages.


    ## Supported Languages

    **English**, **Acholi**, **Ateso**, **Luganda**, **Lugbara**,
    **Runyankole**, **Swahili**

    and **20+** more Ugandan languages supported via sunflower.


    ## Getting Started

    You can checkout the [usage guide](https://salt.sunbird.ai/API/) for a full
    tutorial.


    For quickstart tutorials, visit our

    [GitHub
    repository](https://github.com/SunbirdAI/sunbird-ai-api/blob/main/docs/tutorial.md)


    ### Authentication


    #### Signing Up

    If you don't already have an account, use the `/auth/register` endpoint to
    create one.


    #### Getting an Access Token

    Authentication is done via a Bearer token. Use the `/auth/token` endpoint to
    get your

    access token. This token lasts for 7 days.


    Use the `Authorize` button below to login and access the protected
    endpoints.


    ## API Endpoints


    ### Translation

    - **`POST /tasks/translate`** - Translate text between 32 Ugandan and East
    African
      languages using the Sunflower model. Languages are accepted as ISO codes (`lug`)
      or full names (`Luganda`); `source_language` is optional (auto-detected when
      omitted). Translation works between any pair of supported languages.

    ### Language Detection

    - **`POST /tasks/language_id`** - Auto-detect the language of text input
      (supports Acholi, Ateso, English, Luganda, Lugbara, Runyankole)

    ### Speech-to-Text (STT)

    - **`POST /tasks/audio/transcriptions`** - Unified STT endpoint
    (OpenAI-style).
      - Accepts an uploaded audio file (`audio`) or a GCS object (`gcs_blob_name`).
      - `platform`: `modal` (default, Whisper large-v3) or `runpod`.
      - RunPod options: `adapter` (language adapter), `whisper`, `recognise_speakers`
        (diarization), and the `org` organization workflow.
      - `language`: 3-letter code (e.g. `eng`, `lug`) or full name; improves accuracy.
        Supports WAV, MP3, OGG, M4A, and more. Auto-detects when omitted.
      - **Deprecated** → use `POST /tasks/audio/transcriptions`:
        - `POST /tasks/stt`, `POST /tasks/stt_from_gcs`, `POST /tasks/org/stt`,
          `POST /tasks/modal/stt`

    ### Text-to-Speech (TTS)

    - **`POST /tasks/audio/speech`** - Unified single-synthesis endpoint.
      - `model`: `orpheus-3b-tts` (default) or `spark-tts`; `platform`: `modal` or `runpod`.
      - `voice`: speaker tag/name. `response_mode`: `url` (default), `stream`, or `both`
        (`stream`/`both` require `spark-tts` on `modal`).
      - Orpheus tuning: `language`, `temperature`, `top_p`, `repetition_penalty`,
        `max_tokens`, `seed`. Returns a signed GCP Storage URL.
    - **`POST /tasks/audio/speech/batch`** - Batch synthesis (orpheus-3b-tts
    only), 1-128 items.

    - **`GET /tasks/voice/speakers`** - List voices for a `model` (optional
    orpheus `language`).
      - **orpheus-3b-tts** covers 20 African languages: Acholi (`ach`), Afrikaans (`afr`),
        English (`eng`), Ewe (`ewe`), Fulah (`ful`), Hausa (`hau`), Igbo (`ibo`), Kikuyu (`kik`),
        Kinyarwanda (`kin`), Lugbara (`lgg`), Lingala (`lin`), Luganda (`lug`), Luo (`luo`),
        Runyankole (`nyn`), Sesotho (`sot`), Swahili (`swa`), Ateso (`teo`), Setswana (`tsn`),
        Xhosa (`xho`), Yoruba (`yor`). A few (`lgg`, `sot`, `tsn`) are in the training mix but
        expose no individual voice IDs yet. Full per-speaker catalog: see the
        [tutorial](https://github.com/SunbirdAI/sunbird-ai-api/blob/main/docs/tutorial.md)
        or call `GET /tasks/voice/speakers`.
    - **`GET /tasks/audio/speech/url`** - Refresh an expired signed URL for a
    stored audio object.
      - **Deprecated** → superseded by the unified endpoints above:
        - `POST /tasks/modal/tts`, `POST /tasks/runpod/tts`,
          `POST /tasks/modal/orpheus/tts` → `POST /tasks/audio/speech`
        - `POST /tasks/modal/tts/stream` → `/tasks/audio/speech` (`response_mode=stream`)
        - `POST /tasks/modal/tts/stream-with-url` → `/tasks/audio/speech` (`response_mode=both`)
        - `POST /tasks/modal/orpheus/tts/batch` → `POST /tasks/audio/speech/batch`
        - `GET /tasks/modal/tts/speakers`, `GET /tasks/modal/orpheus/speakers`,
          `GET /tasks/modal/orpheus/speakers/{language}` → `GET /tasks/voice/speakers`
        - `GET /tasks/modal/tts/refresh-url` → `GET /tasks/audio/speech/url`

    ### Inference (Sunflower Chat)

    - **`POST /tasks/chat/completions`** - OpenAI-compatible chat completions
    (Sunflower model).
      Supports single instructions, multi-turn conversations, and SSE streaming (`stream: true`).
      Use model `Sunbird/Sunflower-14B`.
      - **Deprecated** → superseded by the unified endpoint above:
        - `POST /tasks/sunflower_inference` → `POST /tasks/chat/completions`
        - `POST /tasks/sunflower_simple` → `POST /tasks/chat/completions` (send the instruction as a single user message)

    ### File Upload

    - **`POST /tasks/generate-upload-url`** - Generate signed URLs for direct
    client uploads to GCP Storage
      - Supports audio files, images, and other content types
      - Includes path traversal protection and input validation
      - Returns temporary signed URL valid for 30 minutes

    ### WhatsApp Integration (Webhooks)

    - **`POST /tasks/webhook`** - Handle incoming WhatsApp Business API messages

    - **`GET /tasks/webhook`** - Verify webhook endpoint ownership for WhatsApp


    ### Legacy Endpoints

    - **`POST /tasks/summarise`** - *(Deprecated)* Anonymized text summarization
    (use Sunflower inference instead)


    ## Rate Limiting

    API endpoints are rate-limited to ensure fair usage. Authentication is
    required for most endpoints.
  version: 0.1.0
servers:
  - url: https://api.sunbird.ai
security: []
tags:
  - name: legacy/deprecated
    description: >-
      Deprecated endpoints retained for backward compatibility. Each is
      superseded by a unified endpoint — see its Deprecation/Sunset/Link
      response headers — and will be removed after the sunset date. Do not build
      new integrations against these.
paths:
  /tasks/modal/orpheus/tts:
    post:
      tags:
        - legacy/deprecated
      summary: Synthesize speech for one input via Orpheus-3B
      description: >-
        Calls the Orpheus-3B Modal vLLM inference app, uploads the generated WAV
        to Google Cloud Storage, and returns a v4 presigned download URL valid
        for the configured expiry window (default 30 minutes), together with
        metadata and stage-by-stage latency timings.
      operationId: synthesize_tts_tasks_modal_orpheus_tts_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrpheusTTSRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrpheusTTSResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      deprecated: true
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    OrpheusTTSRequest:
      properties:
        text:
          type: string
          maxLength: 2000
          minLength: 1
          title: Text
          description: Text to synthesize.
        speaker_id:
          type: string
          title: Speaker Id
          description: Speaker tag from the Orpheus finetune set (see GET /speakers).
          default: salt_lug_0001
        language:
          anyOf:
            - type: string
            - type: 'null'
          title: Language
          description: >-
            Optional ISO 639-3 language code (e.g. 'lug', 'eng'). If set,
            speaker_id must belong to it.
        seed:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seed
          description: RNG seed for reproducibility.
        temperature:
          type: number
          maximum: 2
          minimum: 0
          title: Temperature
          default: 0.6
        top_p:
          type: number
          maximum: 1
          exclusiveMinimum: 0
          title: Top P
          default: 0.95
        repetition_penalty:
          type: number
          maximum: 2
          minimum: 1
          title: Repetition Penalty
          default: 1.1
        max_tokens:
          type: integer
          maximum: 4096
          minimum: 64
          title: Max Tokens
          default: 1200
      type: object
      required:
        - text
      title: OrpheusTTSRequest
    OrpheusTTSResponse:
      properties:
        audio_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Audio Url
        audio_url_expires_at:
          type: string
          format: date-time
          title: Audio Url Expires At
        speaker_id:
          type: string
          title: Speaker Id
        language:
          anyOf:
            - type: string
            - type: 'null'
          title: Language
        sample_rate:
          type: integer
          title: Sample Rate
          default: 24000
        duration_seconds:
          type: number
          title: Duration Seconds
        chunks:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunks
        audio_size_bytes:
          type: integer
          title: Audio Size Bytes
        gcs_object:
          type: string
          title: Gcs Object
        request_id:
          type: string
          title: Request Id
        timings_ms:
          $ref: '#/components/schemas/OrpheusTimings'
      type: object
      required:
        - audio_url
        - audio_url_expires_at
        - speaker_id
        - duration_seconds
        - audio_size_bytes
        - gcs_object
        - request_id
        - timings_ms
      title: OrpheusTTSResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OrpheusTimings:
      properties:
        inference_ms:
          type: number
          title: Inference Ms
        upload_ms:
          type: number
          title: Upload Ms
        signed_url_ms:
          type: number
          title: Signed Url Ms
        total_ms:
          type: number
          title: Total Ms
      type: object
      required:
        - inference_ms
        - upload_ms
        - signed_url_ms
        - total_ms
      title: OrpheusTimings
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /auth/token

````