wyoming_openai
AGENTS.md226 starsChanged 29 days agoApache-2.0View on GitHub
It is symlinked as CLAUDE.md for Claude Code compatibility. Wyoming OpenAI is a proxy middleware that bridges the Wyoming protocol with OpenAI-compatible endpoints for ASR (Automatic Speech Recognition) and TTS (Text-to-Speech) services. It enables Wyoming clients like Home Assistant to use various OpenAI-compatible STT/TTS services. If the virtual environment can't stay activated between commands (common in agent shells), point Pyright at it explicitly: pyright --pythonpath <venv>/Scripts/python.exe (<venv>/bin/python on Linux/macOS). Releases off main go through the Bump Version GitHub Action (.github/workflows/bump-version.yml);…
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 32,671 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository3 other files it gives its agents.
- bump-versionSkill
- community-triageSkill
- lintSkill
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 41
If the virtual environment can't stay activated between commands (common in agent shells), point Pyright at it explicitly: pyright …
≈ “Common” is an estimate: at least 1 in 5 of the 41,581 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to AI coding agents working with code in this repository. It is symlinked as CLAUDE.md for Claude Code compatibility.
Project Overview
Wyoming OpenAI is a proxy middleware that bridges the Wyoming protocol with OpenAI-compatible endpoints for ASR (Automatic Speech Recognition) and TTS (Text-to-Speech) services. It enables Wyoming clients like Home Assistant to use various OpenAI-compatible STT/TTS services.
Development Commands
Testing
# Create and activate a repository virtual environment first
# Install development dependencies
pip install -e ".[dev]"
# Run all tests
pytest
# Run tests with coverage
pytest --cov=wyoming_openai
# Run specific test file
pytest tests/test_handler.pyCode Quality
# Run these commands with the repository virtual environment activated
# Run linting with Ruff
ruff check .
# Auto-fix linting issues
ruff check . --fix
# Run type checking with Pyright
pyrightIf the virtual environment can't stay activated between commands (common in agent shells), point Pyright at it explicitly: pyright --pythonpath <venv>/Scripts/python.exe (<venv>/bin/python on Linux/macOS).
Local Development Setup
# Install in editable mode
pip install -e .
# Run the server locally
python -m wyoming_openai --uri tcp://0.0.0.0:10300 --stt-models gpt-transcribe --tts-models gpt-4o-mini-ttsDocker Development
# Build and run development container
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build
# With local services (e.g., Speaches)
docker compose -f docker-compose.speaches.yml -f docker-compose.dev.yml up -d --buildReleases
Releases off main go through the Bump Version GitHub Action
(.github/workflows/bump-version.yml); don't hand-edit the version strings or
create the tag. Dispatch it with gh workflow run bump-version.yml -f
bump_type=<patch|minor|major>: it runs the Home Assistant E2E gate, opens a
release-bump PR, and, once merged, the gated Draft Release workflow
creates the draft release. Publishing that draft fires PyPI and Docker
latest. See .agents/skills/bump-version/SKILL.md for the full flow.
Architecture
Core Components
handler.py: ContainsOpenAIEventHandler- the main Wyoming protocol event handler that processes ASR and TTS requestscompatibility.py: ProvidesCustomAsyncOpenAIclass with backend detection and OpenAI API compatibility layer__main__.py: Entry point with argument parsing and server initializationutilities.py: Helper functions for audio processing and data handlingwav.py: WAV header parsing andWavFramer, which turns TTS response bytes into PCMconst.py: Version constants and configuration
Key Architecture Patterns
- Async Event Handling: Uses Wyoming's
AsyncEventHandlerto process incoming protocol events - Backend Abstraction:
CustomAsyncOpenAIwraps different backends (OpenAI, Speaches, LocalAI, etc.) with a unified interface - Stream Processing: Handles both streaming and non-streaming transcription modes
- Audio Buffer Management: Collects audio chunks into complete files for processing
Wyoming Protocol Flow
The handler processes these Wyoming events:
AudioStart/AudioChunk/AudioStop→ STT transcriptionTranscribe→ Initiate transcription requestSynthesize→ TTS audio generation
Backend Support
The OpenAIBackend enum defines supported backends:
OPENAI: Official OpenAI APISPEACHES: Local Speaches serviceLOCALAI: LocalAI serviceKOKORO_FASTAPI: Kokoro TTS service
Configuration
The server accepts both command-line arguments and environment variables. Key configuration includes:
- STT/TTS API keys and URLs
- Model lists for STT and TTS
- Voice configurations
- Backend-specific settings (temperature, speed, etc.)
- STT/TTS extra request body fields (
--stt-extra-body/--stt-realtime-extra-body/--tts-extra-body/--tts-realtime-extra-body) - Realtime transports for OpenAI models (
--stt-realtime-models/--tts-realtime-models)
Testing Strategy
Tests are organized by module:
test_handler.py: Event handler logictest_compatibility.py: Backend compatibilitytest_utilities.py: Helper functionstest_wav.py: WAV header parsing and framingtest_main.py: CLI argument parsing and startup validationtest_integration.py: End-to-end scenarios
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

