{
 "openapi": "3.0.3",
 "info": {
  "title": "oyu API",
  "version": "1.0",
  "description": "One host for every oyu model: **Anir** (Mongolian speech-to-text), **tsuurAI** (Mongolian text-to-speech),\n**oyu** (Mongolian LLM — today served by Gemma/Qwen/Llama behind the gateway) and **Orchu** (Mongolian ↔ English translation).\nChat, embeddings and models are OpenAI-compatible — point any OpenAI SDK at `https://api.oyu.so/v1`.\nAuthentication: `Authorization: Bearer <key>` (keys are issued per organization — ask your oyu contact until the Console ships).\n"
 },
 "servers": [
  {
   "url": "https://api.oyu.so"
  }
 ],
 "security": [
  {
   "bearer": []
  }
 ],
 "tags": [
  {
   "name": "LLM",
   "description": "oyu / Gemma / Qwen / Llama — OpenAI-compatible"
  },
  {
   "name": "Speech",
   "description": "Anir (STT) and tsuurAI (TTS)"
  },
  {
   "name": "Translation",
   "description": "Orchu (Mongolian ↔ English)"
  },
  {
   "name": "Health"
  }
 ],
 "paths": {
  "/v1/models": {
   "get": {
    "tags": [
     "LLM"
    ],
    "summary": "List available models",
    "responses": {
     "200": {
      "description": "OpenAI-style model list"
     }
    }
   }
  },
  "/v1/chat/completions": {
   "post": {
    "tags": [
     "LLM"
    ],
    "summary": "Chat completion (OpenAI-compatible, streaming supported)",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "model",
         "messages"
        ],
        "properties": {
         "model": {
          "type": "string",
          "example": "gemma3:27b",
          "description": "gemma3:27b · qwen3:32b · llama3.3:70b · tse-translate-mn-en"
         },
         "messages": {
          "type": "array",
          "items": {
           "type": "object",
           "properties": {
            "role": {
             "type": "string"
            },
            "content": {
             "type": "string"
            }
           }
          }
         },
         "stream": {
          "type": "boolean",
          "default": false
         },
         "max_tokens": {
          "type": "integer"
         },
         "temperature": {
          "type": "number"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OpenAI chat completion object"
     }
    }
   }
  },
  "/v1/embeddings": {
   "post": {
    "tags": [
     "LLM"
    ],
    "summary": "Embeddings (OpenAI-compatible)",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "model": {
          "type": "string"
         },
         "input": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Embedding vectors"
     }
    }
   }
  },
  "/v1/audio/transcriptions": {
   "post": {
    "tags": [
     "Speech"
    ],
    "summary": "Anir — transcribe a Mongolian audio file",
    "description": "Multipart upload; WAV/MP3/OGG. Returns text. Long files should use the streaming endpoint.",
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         },
         "model": {
          "type": "string",
          "example": "v4"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "{\"text\": \"...\"}"
     }
    }
   }
  },
  "/v1/audio/stream": {
   "get": {
    "tags": [
     "Speech"
    ],
    "summary": "Anir — real-time transcription over WebSocket",
    "description": "Upgrade to WebSocket; send 16 kHz PCM frames, receive partial and final transcripts as JSON.",
    "responses": {
     "101": {
      "description": "Switching protocols"
     }
    }
   }
  },
  "/v1/audio/speech": {
   "post": {
    "tags": [
     "Speech"
    ],
    "summary": "tsuurAI — synthesize Mongolian speech",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "text"
        ],
        "properties": {
         "text": {
          "type": "string",
          "maxLength": 800
         },
         "voice": {
          "type": "string",
          "example": "mbspeech",
          "description": "mbspeech (Khalkha) · baseline · mn1h"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "audio/wav"
     }
    }
   }
  },
  "/v1/audio/diarize": {
   "post": {
    "tags": [
     "Speech"
    ],
    "summary": "Speaker diarization for a call recording",
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Segments with speaker labels"
     }
    }
   }
  },
  "/v1/translations": {
   "post": {
    "tags": [
     "Translation"
    ],
    "summary": "Orchu — translate Mongolian ↔ English",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "text"
        ],
        "properties": {
         "text": {
          "type": "string"
         },
         "source": {
          "type": "string",
          "example": "mn"
         },
         "target": {
          "type": "string",
          "example": "en"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "{\"translation\": \"...\"}"
     }
    }
   }
  },
  "/healthz": {
   "get": {
    "tags": [
     "Health"
    ],
    "summary": "Gateway health",
    "security": [],
    "responses": {
     "200": {
      "description": "ok"
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  }
 }
}