A production-ready multilingual Speech-to-Text gateway that intelligently routes requests to language-specific backend services. Built with FastAPI and deployed on Modal, this gateway provides unified API access to Hausa, Yoruba, and Igbo transcription services
# STT Gateway - Multilingual Speech-to-Text Service
A production-ready multilingual Speech-to-Text gateway that intelligently routes requests to language-specific backend services. Built with FastAPI and deployed on Modal, this gateway provides unified API access to Hausa, Yoruba, and Igbo transcription services.
## Features
- **🌍 Multilingual Support**: Hausa, Yoruba, and Igbo languages with easy extensibility
- **🔄 Intelligent Routing**: Automatic request routing to language-specific backend services
- **🛡️ Production-Ready Resilience**: Circuit breaker pattern, retry logic with exponential backoff, and rate limiting
- **📊 Comprehensive Observability**: Real-time metrics, latency percentiles, and structured logging
- **⚡ High Performance**: Keep-warm instances for fast response times
- **🔒 Robust Validation**: File size limits, format checking, and parameter validation
## Quick Start
### Prerequisites
- Python 3.11+
- Modal account (sign up here)
- Modal CLI installed: `pip install modal`
### Installation
1. Clone the repository:
```bash
git clone
github.com
cd stt-gateway
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Authenticate with Modal:
```bash
modal token new
```
### Deployment
Deploy the gateway with a single command:
```bash
modal deploy gateway_stt_modal.py
```
After deployment, Modal will provide a public HTTPS endpoint URL.
## API Reference
### Base URL
```
your-gateway-url
```
### Endpoints
#### POST `/transcribe`
Transcribe audio files to text.
**Request:**
```bash
curl -X POST "
your-gateway-url" \
-F "file=@audio.wav" \
-F "language=hausa"
```
**Parameters:**
- `file` (required): Audio file (WAV, MP3, M4A, OGG, FLAC, WebM)
- `language` (required): Target language (`hausa`, `yoruba`, or `igbo`)
**Response:**
```json
{
"request_id": "req_1234567890",
"language": "hausa",
"routed_to": "
user--hausa-stt-endpoint-ap… …