Harmony is a renderer for the harmony response format designed to work with OpenAI's gpt-oss open-weight models.
The harmony response format defines how gpt-oss models structure their outputs, enabling the model to write to multiple channels for chain-of-thought reasoning, tool calling, and regular responses. It also supports tool namespaces, structured outputs, and instruction hierarchies. The format mimics OpenAI's Responses API, making it familiar to developers who have used that API. Gpt-oss models require the harmony format to function correctly, so this library provides a shared implementation for both rendering and parsing that maintains token-sequence fidelity across both operations.
Developers building custom inference solutions for gpt-oss should use this library to ensure correct formatting. Those using gpt-oss through existing APIs or providers like HuggingFace, Ollama, or vLLM do not need to interact with it directly, as their inference solution handles the formatting. The tool offers consistent formatting through a unified codebase, performance through a Rust implementation, and first-class Python support with typed stubs and feature parity with the Rust version.
The project maintains parallel test suites for Rust and Python to ensure parity between implementations. Development uses Rust for core rendering and parsing logic, exposed to Python through PyO3 bindings, with a build process using maturin that creates native extensions. The repository includes comprehensive documentation for both Rust and Python usage, along with contributing guidelines and a clear repository layout for developers working locally.