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

# Synthesize speech

> Synthesize text into speech. Returns raw **WAV** bytes (`audio/wav`, 24 kHz, 16-bit PCM, mono). The `X-Tokay-Chars` response header reports the billed character count.



## OpenAPI

````yaml /openapi.json post /v1/tts
openapi: 3.0.3
info:
  title: geko API
  version: 1.0.0
  description: >-
    Text-to-speech for Kazakh and beyond. Send text and a voice name; get back
    WAV audio (24 kHz, 16-bit PCM, mono). A thin, familiar HTTP API — call it
    from any language, or use the typed SDK and CLI.


    The catalog endpoints (`/v1/models`, `/v1/voices`, `/health`) are open.
    Synthesis endpoints require a bearer key — create one in the
    [console](https://app.geko.sh).
servers:
  - url: https://geko--tokay-serve-web.modal.run
security:
  - bearerAuth: []
paths:
  /v1/tts:
    post:
      tags:
        - Speech
      summary: Synthesize speech
      description: >-
        Synthesize text into speech. Returns raw **WAV** bytes (`audio/wav`, 24
        kHz, 16-bit PCM, mono). The `X-Tokay-Chars` response header reports the
        billed character count.
      operationId: createSpeech
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TtsRequest'
      responses:
        '200':
          description: WAV audio.
          headers:
            X-Tokay-Chars:
              description: Billed character count for this request.
              schema:
                type: integer
          content:
            audio/wav:
              schema:
                type: string
                format: binary
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/OutOfCredits'
        '503':
          $ref: '#/components/responses/Unavailable'
      x-codeSamples:
        - lang: TypeScript
          label: SDK
          source: |-
            import { Geko } from "@gekoai/sdk";
            import { writeFile } from "node:fs/promises";

            const geko = new Geko({ apiKey: process.env.GEKO_API_KEY });

            const audio = await geko.tts.create({
              text: "Сәлеметсіз бе! Тапсырыс нөмірі 152.",
              voice: "Aigerim",
            });

            await writeFile("hello.wav", Buffer.from(audio));
        - lang: Python
          label: requests
          source: |-
            import os, requests

            res = requests.post(
                "https://geko--tokay-serve-web.modal.run/v1/tts",
                headers={"Authorization": f"Bearer {os.environ['GEKO_API_KEY']}"},
                json={"text": "Сәлеметсіз бе! Тапсырыс нөмірі 152.", "voice": "Aigerim"},
            )
            res.raise_for_status()
            with open("hello.wav", "wb") as f:
                f.write(res.content)
components:
  schemas:
    TtsRequest:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          description: Text to synthesize (up to ~5000 characters).
          example: Сәлеметсіз бе! Тапсырыс нөмірі 152, сомасы 5500 ₸.
        model:
          type: string
          default: tokay-kk-v1
          description: Model id.
        voice:
          type: string
          default: Aigerim
          description: >-
            Voice name from `GET /v1/voices`. Defaults to the model's default
            voice.
        speed:
          type: number
          default: 1
          minimum: 0.5
          maximum: 2
          description: Speed multiplier.
        nfe:
          type: integer
          default: 32
          description: 'Diffusion steps: 16 fast, 32 quality.'
        normalize:
          type: boolean
          default: true
          description: Expand numbers, currency, and dates into spoken Kazakh.
    Error:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message.
  responses:
    BadRequest:
      description: Bad request — missing `text`, malformed body, or an invalid value.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: text is required
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: invalid API key
    NotFound:
      description: Unknown model or voice.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: unknown voice
    OutOfCredits:
      description: Out of credits — top up in the console. Not retried by the SDK.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: out of credits — top up in the geko console
    Unavailable:
      description: Auth backend temporarily unavailable (transient — retry).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: service temporarily unavailable
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your geko API key (`sk-tokay-…`). Create and manage keys in the
        [console](https://app.geko.sh).

````