Skip to content

Commit a97b5fe

Browse files
committed
release: v1.0.0 — production-ready OpenRouter Pipe
BREAKING CHANGES: - MODEL_PROVIDERS default changed from None to 'ALL' - pipe() is now async with __user__ parameter (Open WebUI v0.4+) Features: - Pre-flight API key validation via /auth/key - Provider routing (sort, prefer, exclude, require_parameters, data_collection) - Model fallbacks with automatic failover - Middle-out compression for long prompts - Anthropic-style cache_control injection - Configurable reasoning effort (low/medium/high) with <think> tags - 22 provider icons for visual model identification - Citation injection with markdown links - Auto-retry on timeout/connection errors (configurable MAX_RETRIES) - FREE_ONLY now detects free models by pricing (not just :free suffix) Bug fixes: - Stream exception handlers now close </think> tag if open - HTTPError in stream: body cached before response.close() - Empty choices array no longer causes IndexError - response=None in _format_http_error handled gracefully - Open WebUI internal keys stripped from payload - Dict user field no longer forwarded to OpenRouter Infrastructure: - GitHub Actions CI (Python 3.10-3.13) - 170 unit tests + 47 integration tests - Issue templates, security policy, sponsor config - Pre-release testing checklist (TESTING.md) - Pydantic v2 compatibility (removed from __future__ import annotations)
1 parent e41ec8f commit a97b5fe

13 files changed

Lines changed: 1227 additions & 38 deletions

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: sena-labs
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Bug Report
2+
description: Report a bug in OpenRouter Pipe
3+
title: "[Bug]: "
4+
labels: ["bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for reporting a bug! Please fill in the details below.
10+
11+
- type: input
12+
id: owui-version
13+
attributes:
14+
label: Open WebUI Version
15+
placeholder: "e.g. 0.4.5"
16+
validations:
17+
required: true
18+
19+
- type: input
20+
id: python-version
21+
attributes:
22+
label: Python Version
23+
placeholder: "e.g. 3.11.5"
24+
validations:
25+
required: true
26+
27+
- type: input
28+
id: pipe-version
29+
attributes:
30+
label: Pipe Version
31+
placeholder: "e.g. 1.0.0"
32+
validations:
33+
required: true
34+
35+
- type: textarea
36+
id: description
37+
attributes:
38+
label: Bug Description
39+
description: What happened? What did you expect?
40+
validations:
41+
required: true
42+
43+
- type: textarea
44+
id: steps
45+
attributes:
46+
label: Steps to Reproduce
47+
description: How can we reproduce this?
48+
value: |
49+
1.
50+
2.
51+
3.
52+
validations:
53+
required: true
54+
55+
- type: textarea
56+
id: logs
57+
attributes:
58+
label: Error Logs
59+
description: "Check server logs for `[OpenRouter Pipe]` messages"
60+
render: shell
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Feature Request
2+
description: Suggest a new feature
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: textarea
7+
id: description
8+
attributes:
9+
label: Feature Description
10+
description: What feature would you like?
11+
validations:
12+
required: true
13+
14+
- type: textarea
15+
id: use-case
16+
attributes:
17+
label: Use Case
18+
description: Why is this feature useful?
19+
validations:
20+
required: true
21+
22+
- type: checkboxes
23+
id: checklist
24+
attributes:
25+
label: Pre-submission Checklist
26+
options:
27+
- label: I checked [OpenRouter API docs](https://openrouter.ai/docs) to confirm this feature exists upstream
28+
- label: I checked [Open WebUI Pipe docs](https://docs.openwebui.com/features/plugin/functions/pipe) for compatibility

.github/workflows/tests.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ["3.10", "3.11", "3.12", "3.13"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install requests pydantic
31+
32+
- name: Run tests
33+
run: python test_pipe.py

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [0.2.0] - 2026-02-13
8+
## [1.0.0] - 2026-02-14
99

1010
### Added
1111
- Provider routing: sort by `price`/`throughput`/`latency`, preferred and ignored providers, `require_parameters`, data collection policy
@@ -18,7 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- Auto-retry on timeout and connection errors (configurable `MAX_RETRIES`)
1919
- 22 provider icons (OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, xAI, etc.)
2020
- Citation injection — `[n]` references replaced with markdown links
21-
- Comprehensive test suite covering all functions and error paths
21+
- Pre-flight API key validation via `/auth/key` — invalid keys are caught at model listing, not at chat time
22+
- Comprehensive test suite: 170 unit tests + 47 integration tests
23+
- GitHub Actions CI pipeline (Python 3.10–3.13)
24+
- Issue templates, security policy, and sponsor configuration
2225

2326
### Changed
2427
- `pipe()` is now `async` with `__user__` parameter (Open WebUI v0.4+)

CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ python test_pipe.py
2323
### Running Tests
2424

2525
```bash
26-
python test_pipe.py
26+
python test_pipe.py # Unit tests (170 tests)
27+
python integration_test.py # Live API tests (requires OPENROUTER_API_KEY)
2728
```
2829

29-
All tests should pass. If adding new functionality, add corresponding tests.
30+
All unit tests must pass. If adding new functionality, add corresponding tests.
3031

3132
### Code Style
3233

@@ -61,7 +62,7 @@ We use [Conventional Commits](https://www.conventionalcommits.org/):
6162

6263
### PR Checklist
6364

64-
- [ ] Tests pass (`python test_pipe.py` → 0 failures)
65+
- [ ] Tests pass (`python test_pipe.py` and `python integration_test.py` → 0 failures)
6566
- [ ] New features have corresponding tests
6667
- [ ] `CHANGELOG.md` updated
6768
- [ ] Code follows existing style conventions

README.md

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:0d1117,50:1a1b2e,100:2d1b69&height=180&section=header&text=OpenRouter%20Pipe&fontColor=a78bfa&fontSize=42&animation=fadeIn&fontAlignY=36&desc=Open%20WebUI%20%E2%86%94%20OpenRouter%20Integration&descAlignY=56&descColor=8b5cf6" width="100%"/>
44

5-
<a href="https://github.com/sena-labs/OpenRouter-Pipe"><img src="https://img.shields.io/badge/version-0.2.0-0d1117?style=for-the-badge&labelColor=7c3aed&color=0d1117" alt="version"></a>&nbsp;
5+
<a href="https://github.com/sena-labs/OpenRouter-Pipe"><img src="https://img.shields.io/badge/version-1.0.0-0d1117?style=for-the-badge&labelColor=7c3aed&color=0d1117" alt="version"></a>&nbsp;
66
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-≥3.10-0d1117?style=for-the-badge&logo=python&logoColor=white&labelColor=3776AB" alt="python"></a>&nbsp;
77
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-0d1117?style=for-the-badge&labelColor=blue" alt="license"></a>&nbsp;
88
<a href="https://docs.openwebui.com"><img src="https://img.shields.io/badge/Open%20WebUI-compatible-0d1117?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0id2hpdGUiPjxwYXRoIGQ9Ik0xMiAyQzYuNDggMiAyIDYuNDggMiAxMnM0LjQ4IDEwIDEwIDEwIDEwLTQuNDggMTAtMTBTMTcuNTIgMiAxMiAyem0wIDE4Yy00LjQyIDAtOC0zLjU4LTgtOHMzLjU4LTggOC04IDggMy41OCA4IDgtMy41OCA0LTggOHoiLz48L3N2Zz4=&logoColor=white&labelColor=1a1a2e" alt="openwebui"></a>
99

10+
<a href="https://github.com/sena-labs/OpenRouter-Pipe/actions/workflows/tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/sena-labs/OpenRouter-Pipe/tests.yml?branch=main&style=for-the-badge&label=tests&labelColor=0d1117&color=238636" alt="tests"></a>&nbsp;
11+
<a href="https://github.com/sena-labs/OpenRouter-Pipe/stargazers"><img src="https://img.shields.io/github/stars/sena-labs/OpenRouter-Pipe?style=for-the-badge&labelColor=0d1117&color=e3b341" alt="stars"></a>&nbsp;
12+
<a href="https://github.com/sena-labs/OpenRouter-Pipe/issues"><img src="https://img.shields.io/github/issues/sena-labs/OpenRouter-Pipe?style=for-the-badge&labelColor=0d1117&color=3fb950" alt="issues"></a>
13+
1014
</div>
1115

1216
# OpenRouter Pipe
@@ -17,6 +21,19 @@ Provider routing · Reasoning tokens · Streaming · Fallbacks · Cache control
1721

1822
---
1923

24+
## Why OpenRouter Pipe?
25+
26+
OpenRouter Pipe is the most feature-complete integration between [Open WebUI](https://docs.openwebui.com) and [OpenRouter](https://openrouter.ai). It gives you access to **300+ AI models** — including GPT-5, Claude 4, Gemini 2.5, Llama 4, DeepSeek R1, and more — directly in your Open WebUI interface, with zero configuration beyond an API key.
27+
28+
**Key differentiators:**
29+
- **Pre-flight API key validation** — invalid keys are caught before you see any models, not after you send a message
30+
- **Full provider routing** — sort, prefer, exclude, and require parameters across providers
31+
- **Native reasoning tokens**`<think>` blocks with configurable effort levels
32+
- **Production-grade reliability** — retry logic, fallback models, mid-stream error recovery
33+
- **22 provider icons** — visual model identification in the selector
34+
35+
---
36+
2037
## Quick Start
2138

2239
### Prerequisites
@@ -81,9 +98,9 @@ All settings are configurable via **Valves** in the Open WebUI admin panel. Ever
8198
| Valve | Env Var | Default | Description |
8299
|-------|---------|---------|-------------|
83100
| `MODEL_PREFIX` || `None` | Custom prefix for model names (e.g. `🔥 `) |
84-
| `MODEL_PROVIDERS` | `OPENROUTER_MODEL_PROVIDERS` | `None` | Comma-separated provider filter (e.g. `openai,anthropic`) |
101+
| `MODEL_PROVIDERS` | `OPENROUTER_MODEL_PROVIDERS` | `ALL` | Provider filter (e.g. `openai,anthropic`). Use `ALL` for all models |
85102
| `INVERT_PROVIDER_LIST` | `OPENROUTER_INVERT_PROVIDER_LIST` | `false` | Invert filter → exclusion list |
86-
| `FREE_ONLY` | `OPENROUTER_FREE_ONLY` | `false` | Show only `:free` models |
103+
| `FREE_ONLY` | `OPENROUTER_FREE_ONLY` | `false` | Show only free-tier models (by suffix or pricing) |
87104

88105
### Provider Routing
89106

@@ -147,18 +164,39 @@ It also removes `user` when sent as a dict (OWUI format) since OpenRouter expect
147164

148165
---
149166

167+
## Compatibility
168+
169+
| Component | Version |
170+
|-----------|----------|
171+
| Open WebUI | v0.4.0+ |
172+
| Python | 3.10, 3.11, 3.12, 3.13 |
173+
| Pydantic | v1.x and v2.x |
174+
| OpenRouter API | v1 |
175+
176+
---
177+
150178
## Project Structure
151179

152180
```
153181
OpenRouter-Pipe/
154182
├── openrouter_pipe.py # Main pipe source (install this in Open WebUI)
155183
├── function.json # Open WebUI community manifest (metadata, tags, categories)
156-
├── test_pipe.py # Test suite
184+
├── test_pipe.py # Unit test suite (170 tests)
185+
├── integration_test.py # Live API integration tests (47 tests)
186+
├── TESTING.md # Pre-release testing checklist
187+
├── SECURITY.md # Security policy and vulnerability reporting
157188
├── README.md # This file
158189
├── CHANGELOG.md # Version history
159190
├── CONTRIBUTING.md # Contribution guidelines
160191
├── LICENSE # MIT License
161-
└── .gitignore # Git ignore rules
192+
├── .gitignore # Git ignore rules
193+
└── .github/
194+
├── FUNDING.yml # GitHub Sponsors configuration
195+
├── workflows/
196+
│ └── tests.yml # CI pipeline (Python 3.10–3.13)
197+
└── ISSUE_TEMPLATE/
198+
├── bug_report.yml # Bug report template
199+
└── feature_request.yml # Feature request template
162200
```
163201

164202
---

SECURITY.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
|---------|-----------|
7+
| 1.0.x | Yes |
8+
| < 1.0 | No |
9+
10+
## Reporting a Vulnerability
11+
12+
If you discover a security vulnerability, please report it responsibly:
13+
14+
1. **Do NOT** open a public issue
15+
2. Use [GitHub's private vulnerability reporting](https://github.com/sena-labs/OpenRouter-Pipe/security/advisories/new)
16+
3. Include: description, steps to reproduce, and potential impact
17+
4. You will receive a response within 48 hours
18+
19+
## Security Design
20+
21+
- API keys are never logged or included in error messages
22+
- Pre-flight API key validation prevents requests with invalid credentials
23+
- All HTTP requests use TLS (HTTPS)
24+
- Open WebUI internal keys are stripped before forwarding to OpenRouter
25+
- No user data is stored by the pipe

0 commit comments

Comments
 (0)