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

# OpenAI-compatible speech

> OpenAI-compatible alias — point the OpenAI SDK at geko by swapping the base URL and model. Maps OpenAI's request shape onto the Tokay engine. See the [OpenAI compatibility guide](/guides/openai).



## OpenAPI

````yaml /openapi.json post /v1/audio/speech
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/audio/speech:
    post:
      tags:
        - Speech
      summary: OpenAI-compatible speech
      description: >-
        OpenAI-compatible alias — point the OpenAI SDK at geko by swapping the
        base URL and model. Maps OpenAI's request shape onto the Tokay engine.
        See the [OpenAI compatibility guide](/guides/openai).
      operationId: createSpeechOpenAICompatible
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpeechRequest'
      responses:
        '200':
          description: WAV audio (or raw PCM when `response_format` is `pcm`).
          content:
            audio/wav:
              schema:
                type: string
                format: binary
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/OutOfCredits'
      x-codeSamples:
        - lang: Python
          label: openai
          source: |-
            from openai import OpenAI

            client = OpenAI(
                base_url="https://geko--tokay-serve-web.modal.run/v1",
                api_key=os.environ["GEKO_API_KEY"],
            )

            res = client.audio.speech.create(
                model="tts-1",
                voice="Aigerim",
                input="Сәлеметсіз бе!",
                response_format="wav",
            )
            res.write_to_file("hello.wav")
components:
  schemas:
    SpeechRequest:
      type: object
      required:
        - input
      properties:
        input:
          type: string
          description: Text to synthesize.
          example: Сәлеметсіз бе!
        model:
          type: string
          default: tokay-kk-v1
          description: >-
            OpenAI ids (`tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`) are accepted and
            mapped to the default.
        voice:
          type: string
          default: Aigerim
          description: Voice name.
        response_format:
          type: string
          default: wav
          enum:
            - wav
            - pcm
          description: >-
            `wav` or `pcm` (raw 16-bit PCM @ 24 kHz). `mp3`/`opus`/`aac`/`flac`
            return 400 (not transcoded yet).
        speed:
          type: number
          default: 1
          description: Speed multiplier.
    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
    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
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your geko API key (`sk-tokay-…`). Create and manage keys in the
        [console](https://app.geko.sh).

````