Skip to main content

Wyoming-OpenAI-Gateway

A gateway that exposes local Wyoming protocol services via OpenAI-compatible API endpoints. This allows any OpenAI-compatible client to use local Wyoming speech services (TTS and STT) without modification.

Features

  • OpenAI-Compatible API — Drop-in replacement for OpenAI's /v1/audio/speech, /v1/audio/transcriptions, /v1/audio/translations, and /v1/voices endpoints
  • Wyoming Protocol — Connects to any Wyoming-compatible TTS service (Piper, Sherpa-ONNX, etc.) and any Wyoming-compatible STT service (faster-whisper, Sherpa-ONNX, etc.)
  • Streaming Support — Real-time audio streaming for both TTS and STT protocols
  • Zero System Dependencies — Audio transcoding via miniaudio (bundled wheels, ~30x faster than subprocess-based ffmpeg)
  • Health Checks — Kubernetes/Docker-ready /healthz and /readyz endpoints

Quick Start

Docker

docker run -d \
  --name wyoming-openai-gateway \
  -p 8555:8555 \
  -e TTS_HOST=your-tts-server \
  -e TTS_PORT=10200 \
  -e STT_HOST=your-stt-server \
  -e STT_PORT=10300 \
  ghcr.io/archmonger/wyoming-openai-gateway:latest

Using pip

pip install wyoming-openai-gateway

TTS_HOST=127.0.0.1 TTS_PORT=10200 \
STT_HOST=127.0.0.1 STT_PORT=10300 \
wyoming-openai-gateway

Using Docker Compose

wget https://raw.githubusercontent.com/archmonger/Wyoming-OpenAI-Gateway/main/compose.yml
TTS_HOST=127.0.0.1 TTS_PORT=10200 \
STT_HOST=127.0.0.1 STT_PORT=10300 \
docker compose up -d

API Reference

GET /v1/voices

Lists available TTS voices from the Wyoming server.

Response:

{
  "voices": [
    {
      "id": "en_US-lessac-medium",
      "name": "Lessac (Medium)",
      "languages": ["en_US"]
    }
  ]
}

POST /v1/audio/speech

Generates speech audio from text.

Request Body:

{
  "input": "Hello, world!",
  "model": "wyoming",
  "voice": "en_US-lessac-medium",
  "response_format": "wav",
  "speed": 1.0,
  "stream": false
}
Parameter Type Default Description
input string (required) The text to synthesize
model string "wyoming" Model identifier (can be any value)
voice string (required) Voice ID from /v1/voices
response_format string "wav" Output format (only wav supported)
speed float 1.0 Speech rate multiplier
stream bool false Enable streaming response

Response: WAV audio data (Content-Type: audio/wav)

POST /v1/audio/transcriptions

Transcribes audio to text using a Wyoming STT server.

Request: multipart/form-data

Parameter Type Default Description
file file (required) Audio file (WAV, MP3, FLAC, etc.)
model string "whisper-1" Model identifier (passed to Wyoming STT)
language string optional Language code (e.g. "en")
response_format string "json" Response format (json or text)
temperature float 0.0 Sampling temperature

Response:

{
  "text": "Your hands lay open in the long fresh grass."
}

POST /v1/audio/translations

Same as transcriptions, but translates the audio to English text.

Configuration

All configuration is done via environment variables:

Variable Default Description
TTS_HOST (none) Wyoming TTS server hostname (omit to disable TTS)
TTS_PORT (none) Wyoming TTS server port (required if TTS_HOST is set)
STT_HOST (none) Wyoming STT server hostname (omit to disable STT)
STT_PORT (none) Wyoming STT server port (required if STT_HOST is set)
HOST 0.0.0.0 Gateway HTTP listen address
PORT 8555 Gateway HTTP listen port
PREFIX /v1 API route prefix
DEBUG false Enable debug logging
LOG_LEVEL INFO Logging level

Validation: At least one of TTS_HOST or STT_HOST must be defined. It is an error to set only a host without its corresponding port, or vice versa. If neither host is defined, the application will exit with an error.

Architecture

┌─────────────────────┐       ┌──────────────────────┐       ┌──────────────────────┐
│                     │       │                      │       │                      │
│  OpenAI-compatible  │ HTTP  │  Wyoming-OpenAI-     │ TCP   │  Wyoming Protocol    │
│  Client             │──────>│  Gateway             │──────>│  Server (TTS/STT)    │
│  (curl, ST, Home    │       │                      │       │                      │
│  Assistant, etc.)   │       │  FastAPI → Wyoming   │       │  Piper / Whisper     │
│                     │<──────│  Protocol Translator │<──────│                      │
└─────────────────────┘       └──────────────────────┘       └──────────────────────┘

The gateway acts as a protocol translator between OpenAI's HTTP API and the Wyoming TCP protocol. It maps REST endpoints to Wyoming events (Describe, Synthesize, Transcribe, etc.) and translates audio data formats transparently using miniaudio.

Development

git clone https://github.com/archmonger/Wyoming-OpenAI-Gateway.git
cd Wyoming-OpenAI-Gateway

# Install with dev dependencies
pip install -e ".[test]"

# Run tests
pytest --cov=wyoming_openai_gateway

# Run linting
ruff check src/ tests/

# Start the gateway
TTS_HOST=127.0.0.1 TTS_PORT=10200 \
STT_HOST=127.0.0.1 STT_PORT=10300 \
python -m wyoming_openai_gateway

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wyoming_openai_gateway-0.2.1.tar.gz (62.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wyoming_openai_gateway-0.2.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file wyoming_openai_gateway-0.2.1.tar.gz.

File metadata

  • Download URL: wyoming_openai_gateway-0.2.1.tar.gz
  • Upload date:
  • Size: 62.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wyoming_openai_gateway-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a23acb19ca958d56f601e22b0ea9f843f851c57a4e34832be2c813f047e72c2b
MD5 acf29316a165ac89eff31183eff0764a
BLAKE2b-256 d0e71bce9da4fb83580eafc2c409fc60d4e865c558f10dba3b1f562a7e894122

See more details on using hashes here.

Provenance

The following attestation bundles were made for wyoming_openai_gateway-0.2.1.tar.gz:

Publisher: publish-release-wheel.yml on Archmonger/Wyoming-OpenAI-Gateway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wyoming_openai_gateway-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for wyoming_openai_gateway-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7dfd69d230b04477a2d4727d39b9a7afdec441d99621d0870a4994a3eae31a24
MD5 3f4b6222638399450738ebc2c3e2d174
BLAKE2b-256 ad53e98446b0333a1d731f3660e70741a76c5d0e3fd840e88581679ae78dd4bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for wyoming_openai_gateway-0.2.1-py3-none-any.whl:

Publisher: publish-release-wheel.yml on Archmonger/Wyoming-OpenAI-Gateway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page