Thanks for wanting to contribute! This document is intentionally opinionated: it codifies the deliverable-PR playbook the maintainers use day-to-day so new contributors can ship changes with the same cadence and quality.
- Code of Conduct
- Getting started
- Development setup
- Deliverable-PR playbook
- Commit messages
- Coding standards
- Testing
- Reporting bugs
- Suggesting features
This project follows the Contributor Covenant Code of Conduct. By participating, you agree to uphold this code.
-
Fork the repository on GitHub.
-
Clone your fork locally:
git clone https://github.com/<your-username>/OpenRouter-Pipe.git cd OpenRouter-Pipe
-
Install dependencies:
pip install -r requirements.txt
-
Verify the baseline is green before changing anything:
python test_pipe.py
- Python ≥ 3.10 (matches the CI matrix).
requests≥ 2.20.pydantic≥ 2.0.
| Command | Description |
|---|---|
python test_pipe.py |
Run the full unit test suite (252 tests) |
python integration_test.py |
Run live API tests (requires OPENROUTER_API_KEY) |
Every change is shipped as a single-deliverable pull request. One PR = one reviewable unit of value. The playbook:
-
Sync
mainand create a branch with a descriptive slug:git checkout main && git pull git checkout -b feat/<slug>
-
Implement the smallest complete slice of the change. Prefer surgical edits over incidental refactors.
-
Add or update tests. A change without test coverage needs a written justification in the PR body. The unit test suite must remain at 252/252.
-
Validate locally using the same commands CI runs:
python test_pipe.py python integration_test.py # optional, requires a valid API key -
Update
CHANGELOG.md. Prepend a bullet under## [Unreleased]describing the user-visible impact. -
Commit with Conventional Commits (see Commit messages) and push:
git push -u origin feat/<slug>
-
Open the pull request using the PR template and fill every section.
-
Verify CI goes green. A failing test leg blocks the merge — fix forward rather than disabling the check.
Keep the branch focused: if the diff grows beyond ~300 lines of non-generated code, split it.
We follow Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types: feat, fix, docs, refactor, test, chore, ci.
Examples:
feat(routing): add PROVIDER_IGNORE valve
fix(stream): close think tag on mid-stream error
docs: update README installation steps
test: add retry exhaustion coverage
- PEP 8 — enforced by convention; keep line length ≤ 100 chars.
- Type hints on every function signature.
- One responsibility per method — keep functions under ~50 lines; extract helpers when they grow.
- Docstrings on every public method using the one-line summary style.
- Logging via
print(f"[OpenRouter Pipe] …")— never log API keys or user content. - No
any-equivalent type erasure; use properdict[str, Any]annotations.
- Framework: Python
unittest(stdlib). - Mock strategy:
unittest.mock.patchfor HTTP calls and Open WebUI internals. - Conventions:
- Test path mirrors source:
openrouter_pipe.py↔test_pipe.py. - Each test class covers one unit (
TestPreparePayload,TestStreamResponse, etc.). - Use descriptive method names:
test_fallback_deduplication_removes_duplicates.
- Test path mirrors source:
- Run the suite the same way CI does:
python test_pipe.py. Integration tests require a live API key and are optional for most contributions.
When reporting a bug, open a GitHub issue using the Bug report template and include:
- Open WebUI version (
Admin Panel → About). - Python version (
python --version). - Steps to reproduce the issue.
- Expected vs. actual behavior.
- Error logs — check the Open WebUI server logs and filter for
[OpenRouter Pipe]messages.
Do not include your API key in the issue. Redact it before pasting logs.
Before opening a feature request:
- Check the OpenRouter API docs to confirm the feature exists upstream.
- Check the Open WebUI Pipe docs for compatibility constraints.
- Open an issue using the Feature request template and describe the use case and expected behavior.
Thanks for helping improve OpenRouter Pipe! 🚀