{
  "openapi": "3.1.0",
  "info": {
    "title": "Moses TTS and STT API",
    "version": "1.0.0",
    "description": "Text to speech and speech to text, hosted in Germany; no audio or transcripts are stored. The HTTP endpoints follow OpenAI's audio API (POST /audio/speech, POST /audio/transcriptions), so OpenAI SDKs work with base URL https://moses-ai.com/tts/v1 or https://moses-ai.com/stt/v1. Realtime WebSockets (wss://moses-ai.com/tts/realtime, wss://moses-ai.com/stt/realtime) are described in the docs, not here. Every error answer carries a code; limits that pass carry Retry-After.",
    "contact": {
      "url": "https://moses-ai.com/tts_stt/openai_compatibility.html"
    },
    "termsOfService": "https://moses-ai.com/legal.html"
  },
  "externalDocs": {
    "description": "OpenAI compatibility, limits and error codes",
    "url": "https://moses-ai.com/tts_stt/openai_compatibility.html"
  },
  "servers": [
    {
      "url": "https://moses-ai.com"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/tts/v1/audio/speech": {
      "post": {
        "operationId": "createSpeech",
        "summary": "Text to speech (audio streams back while it is generated)",
        "tags": [
          "TTS"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpeechRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The audio, streamed. X-Sample-Rate: 24000.",
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/L16;rate=24000;channels=1": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/ogg; codecs=opus": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/flac": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/tts/v1/voices": {
      "get": {
        "operationId": "listVoices",
        "summary": "Built-in voices and your own cloned voices",
        "tags": [
          "TTS"
        ],
        "responses": {
          "200": {
            "description": "Voices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "default": {
                      "type": "string"
                    },
                    "voices": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Voice"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/tts/v1/languages": {
      "get": {
        "operationId": "listTtsLanguages",
        "summary": "Languages with their default voice and voice ids",
        "tags": [
          "TTS"
        ],
        "responses": {
          "200": {
            "description": "Languages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/tts/v1/stats": {
      "get": {
        "operationId": "ttsStats",
        "summary": "Your limits, what is open now and your credit",
        "tags": [
          "TTS"
        ],
        "responses": {
          "200": {
            "description": "Stats",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/stt/v1/audio/transcriptions": {
      "post": {
        "operationId": "createTranscription",
        "summary": "Transcribe a file (OpenAI-compatible)",
        "tags": [
          "STT"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TranscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The transcript in the requested format",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "504": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/stt/v1/languages": {
      "get": {
        "operationId": "listSttLanguages",
        "summary": "Languages the STT workers recognise",
        "tags": [
          "STT"
        ],
        "responses": {
          "200": {
            "description": "Languages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/stt/v1/stats": {
      "get": {
        "operationId": "sttStats",
        "summary": "Your STT limits and what is open now",
        "tags": [
          "STT"
        ],
        "responses": {
          "200": {
            "description": "Stats",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key (mk_...) from https://moses-ai.com/console"
      }
    },
    "responses": {
      "Error": {
        "description": "An error, with a machine-readable code; Retry-After (header and retry_after) when waiting helps",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds until a retry can succeed"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "SpeechRequest": {
        "type": "object",
        "required": [
          "input"
        ],
        "properties": {
          "input": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000,
            "description": "The text"
          },
          "voice": {
            "type": "string",
            "description": "A voice id (alba, german/..., clone:my-voice). OpenAI's names (alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse, marin, cedar) map to similar built-in voices; with a non-English language, to that language's default voice."
          },
          "language": {
            "type": "string",
            "description": "en, de, fr, it, pt, es, nl (or english, german, ...)"
          },
          "model": {
            "type": "string",
            "description": "Accepted for OpenAI-style clients and ignored"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "wav",
              "pcm",
              "mp3",
              "opus",
              "flac"
            ],
            "default": "wav",
            "description": "pcm: raw 16-bit mono 24 kHz; mp3: 64 kbit/s constant; opus: in Ogg"
          },
          "speed": {
            "type": "number",
            "minimum": 0.25,
            "maximum": 4.0,
            "default": 1.0,
            "description": "Applied within 0.5 to 2.0"
          },
          "stream_format": {
            "type": "string",
            "enum": [
              "audio",
              "sse"
            ],
            "description": "Accepted; the audio always comes as audio (not as events)"
          },
          "normalize": {
            "type": "boolean",
            "description": "Numbers, dates and currencies as words"
          },
          "markup": {
            "type": "boolean",
            "description": "SSML subset: break, lang, voice, prosody, emphasis, say-as, sub"
          },
          "quantize": {
            "type": "boolean"
          }
        }
      },
      "TranscriptionRequest": {
        "type": "object",
        "required": [
          "file"
        ],
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "Audio file, up to 25 MB"
          },
          "model": {
            "type": "string",
            "description": "Accepted for OpenAI-style clients and ignored"
          },
          "language": {
            "type": "string",
            "description": "Two-letter code, or auto (default)"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "json",
              "text",
              "verbose_json",
              "srt",
              "vtt"
            ],
            "default": "json"
          },
          "timestamp_granularities[]": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "segment",
                "word"
              ]
            }
          }
        }
      },
      "Transcription": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "duration": {
            "type": "number"
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "words": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "Voice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "gender": {
            "type": "string"
          },
          "lang": {
            "type": "string"
          },
          "own": {
            "type": "boolean"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "detail",
          "code"
        ],
        "properties": {
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "examples": [
              "bad_request",
              "bad_format",
              "unauthorized",
              "wrong_scope",
              "referer",
              "ticket_origin",
              "blocked",
              "no_credit",
              "forbidden",
              "too_large",
              "account_limit",
              "key_limit",
              "ip_limit",
              "daily_limit",
              "daily_spend",
              "too_many_at_once",
              "busy",
              "unavailable",
              "worker_error",
              "timeout"
            ]
          },
          "retry_after": {
            "type": "integer"
          },
          "error": {
            "type": "object",
            "description": "The same in OpenAI's shape",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "code": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
