agentleFS
roryeckelroryeckel/wyoming_openai/AGENTS.md

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.

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
  1. Very specific:

    If the virtual environment can't stay activated between commands (common in agent shells), point Pyright at it explicitly: pyright …

    line 41

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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.py

Code 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
pyright

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).

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-tts

Docker 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 --build

Releases

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: Contains OpenAIEventHandler - the main Wyoming protocol event handler that processes ASR and TTS requests
  • compatibility.py: Provides CustomAsyncOpenAI class with backend detection and OpenAI API compatibility layer
  • __main__.py: Entry point with argument parsing and server initialization
  • utilities.py: Helper functions for audio processing and data handling
  • wav.py: WAV header parsing and WavFramer, which turns TTS response bytes into PCM
  • const.py: Version constants and configuration

Key Architecture Patterns

  1. Async Event Handling: Uses Wyoming's AsyncEventHandler to process incoming protocol events
  2. Backend Abstraction: CustomAsyncOpenAI wraps different backends (OpenAI, Speaches, LocalAI, etc.) with a unified interface
  3. Stream Processing: Handles both streaming and non-streaming transcription modes
  4. Audio Buffer Management: Collects audio chunks into complete files for processing

Wyoming Protocol Flow

The handler processes these Wyoming events:

  • AudioStart/AudioChunk/AudioStop → STT transcription
  • Transcribe → Initiate transcription request
  • Synthesize → TTS audio generation

Backend Support

The OpenAIBackend enum defines supported backends:

  • OPENAI: Official OpenAI API
  • SPEACHES: Local Speaches service
  • LOCALAI: LocalAI service
  • KOKORO_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 logic
  • test_compatibility.py: Backend compatibility
  • test_utilities.py: Helper functions
  • test_wav.py: WAV header parsing and framing
  • test_main.py: CLI argument parsing and startup validation
  • test_integration.py: End-to-end scenarios

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.