Commit f25c461
authored
feat: add Requesty provider (#1145)
## Summary
Adds **Requesty** as a new named LLM provider, mirroring the existing
OpenRouter provider exactly. Requesty is an OpenAI-compatible LLM router
(base URL `https://router.requesty.ai/v1`) that uses the same
`provider/model` naming scheme as OpenRouter (e.g.
`openai/gpt-4o-mini`).
Because Requesty is OpenAI-compatible and behaves like OpenRouter
(including the same optional reasoning directive shape), the
implementation is a structural 1:1 mirror of
`src/any_llm/providers/openrouter/`, changing only the provider id,
class name, base URL, env var, and documentation URL.
## What changed
- **`src/any_llm/providers/requesty/`** (new package): `requesty.py`,
`__init__.py`, `utils.py` mirroring the OpenRouter provider.
- `API_BASE = "https://router.requesty.ai/v1"`
- `ENV_API_KEY_NAME` = `REQUESTY_API_KEY`, `ENV_API_BASE_NAME =
"REQUESTY_API_BASE"`
- `PROVIDER_NAME = "requesty"`, docs at `https://docs.requesty.ai`
- Subclasses `BaseOpenAIProvider`, same reasoning-directive handling and
`_convert_models_list` model-normalization as OpenRouter.
- **`src/any_llm/constants.py`**: added `REQUESTY = "requesty"` to the
`LLMProvider` enum.
- **`pyproject.toml`**: added the `requesty = []` optional-dependency
group and included `requesty` in the `all` extra (the OpenAI-compatible
base requires no extra SDK, same as OpenRouter).
- **`tests/unit/providers/test_requesty_provider.py`** (new): full
mirror of `test_openrouter_provider.py` (reasoning directive, streaming,
max_tokens remap, model-list normalization, round-trip serialization).
The factory (`AnyLLM._create_provider`) discovers providers dynamically
from the enum value, so no factory/mapping edit is needed; the enum +
matching package name + pyproject group is the full registration
surface, which the repo's exhaustiveness tests enforce.
## Note on the README
The README does not contain a committed supported-provider list/table
(the provider list is generated to GitBook via
`scripts/convert_to_gitbook.py` and published to `docs.mozilla.ai`, not
committed). The only OpenRouter mention in the README is the "Proxy Only
Solutions" comparison paragraph, where adding Requesty would be
inappropriate. Happy to add a docs/provider entry wherever the
maintainers prefer.
## Usage
```python
from any_llm import AnyLLM
provider = AnyLLM.create("requesty", api_key="<REQUESTY_API_KEY>")
completion = provider.completion(
model="openai/gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
```
Set `REQUESTY_API_KEY` in your environment, or pass `api_key=` directly.
## Testing & linting
- `uv run pytest tests/unit/providers/test_requesty_provider.py
tests/unit/providers/test_openrouter_provider.py
tests/unit/test_provider.py
tests/unit/test_provider_pyproject_options.py -q` -> **127 passed, 9
skipped** (includes the enum/pyproject/load exhaustiveness tests that
load every provider).
- `ruff@0.15.12 check` and `ruff@0.15.12 format --check` (the pinned
pre-commit version) -> clean on the new files.
- `uv run mypy src/any_llm/providers/requesty/` (strict) -> `Success: no
issues found`.
## Disclosure
I work at Requesty. Happy to adjust scope/naming or close if out of
scope.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added support for the Requesty provider, including completion
streaming.
* Enabled reasoning support for Requesty-based completions, with correct
request shaping.
* **Tests**
* Added comprehensive unit tests for Requesty completion parameters,
reasoning injection, and model-list conversion.
* **Chores**
* Updated optional dependencies to include the Requesty provider extra
(as a newly available provider option).
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## PR Type
- 🆕 New Feature
## Relevant issues
N/A
## Checklist
- [x] I understand the code I am submitting.
- [x] I have added unit tests that prove my fix/feature works
- [x] I have run this code locally and verified it fixes the issue.
- [x] New and existing tests pass locally
- [x] Documentation was updated where necessary
- [x] I have read and followed the [contribution
guidelines](https://github.com/mozilla-ai/any-llm/blob/main/CONTRIBUTING.md)
- [x] **AI Usage:**
- [x] AI was used for drafting/refactoring.
## AI Usage Information
- AI Model used: Claude Opus
- AI Developer Tool used: CLI agent
- Any other info you'd like to share: The provider is a structural 1:1
mirror of the existing OpenRouter provider; I reviewed every line, ran
the unit tests (new + openrouter) and the enum/pyproject exhaustiveness
tests locally, and confirmed ruff + mypy pass before submitting.
- [ ] I am an AI Agent filling out this form (check box if true)1 parent 50c5d4e commit f25c461
6 files changed
Lines changed: 527 additions & 1 deletion
File tree
- src/any_llm
- providers/requesty
- tests/unit/providers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
0 commit comments