> ## 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 translation

> Translates between Hausa and French, in both directions. Send JSON to translate text, or audio (multipart `file`, or the raw body) to translate speech. Add `include_audio` to also get the translation spoken. Text counts its characters divided by 15 as seconds; speech counts the audio sent. Needs the `translate` scope.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/translate
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/translate:
    post:
      tags:
        - Translation
      summary: Create translation
      description: >-
        Translates between Hausa and French, in both directions. Send JSON to
        translate text, or audio (multipart `file`, or the raw body) to
        translate speech. Add `include_audio` to also get the translation
        spoken. Text counts its characters divided by 15 as seconds; speech
        counts the audio sent. Needs the `translate` scope.
      operationId: createTranslation
      parameters:
        - name: include_audio
          in: query
          required: false
          description: >-
            `1`, `true` or `yes` to add the spoken translation (base64 WAV) to
            the answer.
          schema:
            type: string
            enum:
              - '1'
              - 'true'
              - 'yes'
        - name: source
          in: query
          required: false
          description: Only when the audio is the raw body.
          schema:
            $ref: '#/components/schemas/TranslateLanguage'
        - name: target
          in: query
          required: false
          description: Only when the audio is the raw body.
          schema:
            $ref: '#/components/schemas/TranslateLanguage'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TranslateTextRequest'
            example:
              text: Ina kwana? Yau za a yi zafi sosai.
              source: ha
              target: fr
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: The recording.
                source:
                  $ref: '#/components/schemas/TranslateLanguage'
                target:
                  $ref: '#/components/schemas/TranslateLanguage'
                include_audio:
                  type: string
                  enum:
                    - '1'
                    - 'true'
                    - 'yes'
      responses:
        '200':
          description: The translation. `characters` for text, `audio_seconds` for speech.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Translation'
              example:
                model: translation
                source: ha
                target: fr
                source_text: Ina kwana? Yau za a yi zafi sosai.
                text: Bonjour ! Il va faire très chaud aujourd'hui.
                characters: 34
                audio: null
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '413':
          $ref: '#/components/responses/TooLarge'
        '415':
          $ref: '#/components/responses/UnsupportedAudio'
        '422':
          $ref: '#/components/responses/NothingHeard'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '502':
          $ref: '#/components/responses/Upstream'
components:
  schemas:
    TranslateLanguage:
      type: string
      enum:
        - ha
        - fr
      description: >-
        `ha` Hausa or `fr` French. The source defaults to the other language
        from the target.
    TranslateTextRequest:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          maxLength: 2000
          description: The text to translate. Up to 2,000 characters.
        source:
          $ref: '#/components/schemas/TranslateLanguage'
        target:
          type: string
          enum:
            - ha
            - fr
          default: fr
          description: The language to translate into.
        include_audio:
          type: boolean
          description: Also return the translation spoken (base64 WAV).
    Translation:
      type: object
      properties:
        model:
          type: string
          example: translation
        source:
          type: string
          example: ha
        target:
          type: string
          example: fr
        source_text:
          type: string
          description: The text sent, or what was heard in the audio.
        text:
          type: string
          description: The translation.
        characters:
          type: integer
          description: 'Text requests: characters translated.'
        audio_seconds:
          type: number
          description: 'Audio requests: length of the audio sent.'
        audio:
          type:
            - string
            - 'null'
          description: The translation spoken, base64 WAV, when asked for.
    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'
    UnsupportedAudio:
      description: >-
        `unsupported_audio`: the file could not be read. Send WAV, MP3, M4A,
        AAC, OGG, WebM or FLAC.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NothingHeard:
      description: '`nothing_heard`: no speech was found in the audio.'
      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.