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.0.tar.gz (62.7 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.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wyoming_openai_gateway-0.2.0.tar.gz
  • Upload date:
  • Size: 62.7 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.0.tar.gz
Algorithm Hash digest
SHA256 727e3259cce9d39159b8265dc29876c8b3d3855fbcd60dc4bbfb037d63da3c00
MD5 e0a7b62a11bc36c593049c96673cc84f
BLAKE2b-256 4ca16632e26aec41efd2011d0db85d3e17bff709ad36b732b211087f645499ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for wyoming_openai_gateway-0.2.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wyoming_openai_gateway-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5663ba8e8943f8d1db4dca19ecde02bcf469541db92aff47ab214bc29cdec864
MD5 b61dbdb5f7d3999bdcdc4403bd06e925
BLAKE2b-256 f0124c0d3c125b650b02dbf85e8c65afb7db24bbdc307a158b60f58563722f3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for wyoming_openai_gateway-0.2.0-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