Commit ca0ef07
authored
feat: add Cascadia provider for distributed on-prem Intel AI PC inference (#1147)
## Description
Adds `cascadia` as a provider (closes #1146). Cascadia
(https://cascadia.to) is a
distributed inference runtime that shards open-weights models (INT4
OpenVINO) across
fleets of Intel AI PCs behind an OpenAI-compatible coordinator, keeping
inference
on-premises.
**How**
- `BaseOpenAIProvider` subclass following the vLLM keyless pattern,
extended to honor
`CASCADIA_API_KEY` from the environment when a fleet is keyed (an
explicit `api_key`
wins; otherwise it falls back to `no-key-required` so trusted-LAN
coordinators work
keyless). Env-configurable base via `CASCADIA_API_BASE` (default
`http://localhost:9090/v1`); no new dependencies (`cascadia = []` extra,
spliced
into `all`).
- Capability flags scoped to v1: completion, streaming, reasoning, and
list-models
on; responses, embeddings, moderation, image, PDF, and batch off.
- Registered in `LLMProvider` (`src/any_llm/constants.py`), the
`tests/conftest.py`
fixture maps, and `LOCAL_PROVIDERS` + `CI_EXCLUDED_PROVIDERS` in
`tests/constants.py` (self-hosted backend; CI cannot reach a fleet,
mirroring vllm).
Files: `src/any_llm/providers/cascadia/{cascadia,__init__}.py`,
`src/any_llm/constants.py`, `pyproject.toml`, `tests/constants.py`,
`tests/conftest.py`, and
`tests/unit/providers/test_cascadia_provider.py`.
**Testing**
- `tests/unit/providers/test_cascadia_provider.py`: provider metadata,
keyless auth,
explicit-key passthrough, `CASCADIA_API_KEY` env resolution, env/default
base
resolution, capability flags, and enum/loader registration. 8 passed,
100%
line+branch coverage of `cascadia.py`.
- Full local unit suite green (1419 passed, 64 skipped), no regressions.
Developed
against current `main` (latest release `any-llm-sdk` 1.18.0); rebased on
the default
branch, where no `cascadia` provider previously existed.
- `pre-commit run` on the change set: ruff, ruff-format, mypy (strict),
and codespell
all pass.
- Manual smoke via `acompletion("cascadia:<model>", ...)` against a
Cascadia
coordinator implementing the OpenAI-compatible contract: non-streaming
and streaming
both return content and a populated `usage` object. Production Cascadia
runs the same
contract across a physical Intel AI PC fleet.
<details><summary>Smoke transcript (real coordinator)</summary>
```
$ export CASCADIA_API_BASE=https://<coordinator>/api/v1
$ export CASCADIA_API_KEY=<bearer token> # keyed fleet; trusted-LAN fleets run keyless
$ python smoke_cascadia.py
models: ['llama-8b-2stage', 'qwen3-8b']
using: cascadia:qwen3-8b
# non-streaming: content + usage object returned
non-stream: '<think> [reasoning trimmed] </think>\n\nCASCADIA-OK'
usage: CompletionUsage(completion_tokens=1, prompt_tokens=0, total_tokens=1)
# streaming: reassembled deltas
stream: '<think> [reasoning trimmed] </think>\n\nOne, two, three, four, five.'
```
qwen3-8b is a reasoning model, so it emits a `<think>` block before the
answer; that
text is trimmed here for readability. Token counts on this hosted demo
coordinator are
approximate; the provider faithfully surfaces whatever the coordinator
reports in
`usage`.
</details>
## PR Type
- 🆕 New Feature
## Relevant issues
Closes #1146
## 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
- [x] **AI Usage:**
- [ ] No AI was used.
- [x] AI was used for drafting/refactoring.
- [ ] This is fully AI-generated.
## AI Usage Information
- AI Model used: Claude Opus 4.8
- AI Developer Tool used: Claude Code
- Any other info you'd like to share: The provider, tests, and docs were
drafted with
AI assistance under my direction and review. I verified the change
locally (full unit
suite, ruff/mypy-strict/codespell, and a live smoke against a real
Cascadia
coordinator) and will respond to review comments myself.
- [ ] I am an AI Agent filling out this form (check box if true)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added Cascadia as a new supported language model provider with an
OpenAI-compatible coordinator endpoint.
* Enabled completion with streaming and reasoning-style capabilities,
plus model listing.
* Added flexible API key handling using `CASCADIA_API_KEY` (with safe
non-failing fallback when unset).
* **Optional Dependencies**
* Introduced a new `cascadia` extras option (and included it in `all`).
* **Tests**
* Added unit test coverage for Cascadia provider registration,
configuration, capability flags, and API-base/API-key precedence.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Tate Berenbaum <t8@users.noreply.github.com>1 parent f25c461 commit ca0ef07
7 files changed
Lines changed: 128 additions & 1 deletion
File tree
- src/any_llm
- providers/cascadia
- 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 | | |
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
| 185 | + | |
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
| 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 | + | |
0 commit comments