> ## Documentation Index
> Fetch the complete documentation index at: https://developers.namuai-lab.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create speech

> Turns text into spoken audio in Hausa, Zarma or French. Counts the length of the audio returned against your monthly allowance. Needs the `speech` scope.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/speech
openapi: 3.1.0
info:
  title: Namu API
  version: 1.0.0
  description: >-
    Speech recognition, speech synthesis, translation and a voice agent for
    Hausa, Zarma and French. Describes the API as it behaves on 8 November 2026.
  contact:
    name: Namu AI Lab
    email: contact@namuai.org
    url: https://www.namuai-lab.com
servers:
  - url: https://api.namuai-lab.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Speech
    description: Text to speech.
  - name: Transcription
    description: Speech to text.
  - name: Translation
    description: Hausa and French, from text or speech.
  - name: Voice agent
    description: A spoken conversation in Hausa. Research preview.
  - name: Models and voices
    description: What the API serves. No key needed.
  - name: Account
    description: Your usage this month.
paths:
  /v1/speech:
    post:
      tags:
        - Speech
      summary: Create speech
      description: >-
        Turns text into spoken audio in Hausa, Zarma or French. Counts the
        length of the audio returned against your monthly allowance. Needs the
        `speech` scope.
      operationId: createSpeech
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpeechRequest'
            examples:
              hausa:
                summary: Hausa, Nadia
                value:
                  text: Sannu da zuwa! Muna farin cikin jin muryarku.
                  voice: nadia
              zarma:
                summary: Zarma, Mouhamad, small Opus file
                value:
                  text: Fofo! Mate ni go?
                  voice: mouhamad
                  language: dje
                  format: opus
      responses:
        '200':
          description: >-
            The audio, or JSON when `format` is `json`. Binary responses carry
            `X-Audio-Seconds`.
          headers:
            X-Audio-Seconds:
              description: Length of the returned audio, in seconds.
              schema:
                type: number
                example: 2.4
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            audio/wav:
              schema:
                type: string
                format: binary
                description: 24 kHz, 16-bit PCM, mono.
            audio/mpeg:
              schema:
                type: string
                format: binary
                description: 64 kbit/s, mono.
            audio/ogg:
              schema:
                type: string
                format: binary
                description: Ogg Opus, 48 kHz, 32 kbit/s, mono.
            application/json:
              schema:
                $ref: '#/components/schemas/SpeechJson'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '413':
          $ref: '#/components/responses/TooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '502':
          $ref: '#/components/responses/Upstream'
components:
  schemas:
    SpeechRequest:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          maxLength: 2000
          description: What to say. Up to 2,000 characters.
        voice:
          type: string
          enum:
            - nadia
            - warm
            - mouhamad
            - fr
          default: nadia
          description: Who says it. See GET /v1/voices.
        language:
          type: string
          enum:
            - ha
            - dje
            - fr
          description: >-
            The language of the text. Defaults to the voice's first language,
            and must be one it speaks.
        format:
          type: string
          enum:
            - wav
            - mp3
            - opus
            - json
          default: wav
          description: >-
            `opus` is the smallest file, for phones and weak connections. `json`
            returns base64 WAV.
    SpeechJson:
      type: object
      properties:
        model:
          type: string
          example: speech-synthesis
        voice:
          type: string
          example: nadia
        language:
          type: string
          example: ha
        audio_seconds:
          type: number
          example: 2.4
        audio:
          type: string
          description: Base64 WAV.
        sample_rate:
          type: integer
          example: 24000
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              description: A stable code, such as `invalid_api_key`.
            message:
              type: string
              description: What happened, in plain words.
            request_id:
              type: string
  headers:
    RequestId:
      description: A unique id for this request. Include it when you write to us.
      schema:
        type: string
        example: 3f2a9c1e5b7d4e8fa0c2b6d9e1f3a5c7
  responses:
    BadRequest:
      description: >-
        The request was not usable: `invalid_request`, `invalid_json`,
        `missing_text`, `missing_file`, `empty_audio`, `unknown_voice`,
        `unsupported_language`, `unsupported_pair`, `unknown_persona`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: unknown_voice
              message: 'Unknown voice. Try one of: nadia, warm, fr, mouhamad.'
              request_id: 3f2a9c1e5b7d4e8fa0c2b6d9e1f3a5c7
    Unauthorized:
      description: >-
        No key, not a Namu key, or a revoked key: `missing_api_key`,
        `invalid_api_key`, `key_revoked`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: missing_api_key
              message: 'Send your key as ''Authorization: Bearer namu_sk_...''.'
              request_id: 3f2a9c1e5b7d4e8fa0c2b6d9e1f3a5c7
    Forbidden:
      description: >-
        `insufficient_scope` (the key may not call this endpoint) or
        `account_paused`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooLarge:
      description: >-
        `payload_too_large` (over 25 MB), `audio_too_long` (over 300 s) or
        `text_too_long` (over 2,000 characters).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: >-
        `rate_limited` (too many requests this minute; see `Retry-After`) or
        `quota_exceeded` (this month's allowance is used).
      headers:
        Retry-After:
          description: Seconds to wait. Sent with `rate_limited` only.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Upstream:
      description: >-
        `upstream_error`: the model did not answer. Try again; a request that
        fails counts nothing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your secret key: `Authorization: Bearer namu_sk_...`. Create one at
        https://www.namuai-lab.com/account/keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.