feat: add Cascadia provider for distributed on-prem Intel AI PC inference#1147
Conversation
…ence Cascadia (https://cascadia.to) shards open-weights models into INT4 OpenVINO shards across fleets of Intel AI PCs behind an OpenAI-compatible coordinator. Add a thin BaseOpenAIProvider subclass (the vLLM pattern): optional API key for keyless trusted-LAN fleets, CASCADIA_API_BASE / CASCADIA_API_KEY env config, no new dependencies (cascadia = [] extra). Capability flags scoped to v1: completions, streaming, reasoning, and list-models on; responses, embeddings, moderation, image, PDF, and batch off. Register in LLMProvider, the conftest fixture maps, and LOCAL_PROVIDERS plus CI_EXCLUDED_PROVIDERS (self-hosted backend, CI cannot reach a fleet, mirroring vllm). Unit tests cover metadata, keyless auth, env resolution, capability flags, and loader registration at 100% coverage of the provider module.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughAdds ChangesCascadia Provider Integration
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/any_llm/providers/cascadia/cascadia.py`:
- Around line 37-42: The return type annotation for the _verify_and_set_api_key
method in the Cascadia provider is incorrect. The method always returns a string
value through the chain of `api_key or os.getenv(self.ENV_API_KEY_NAME) or
"no-key-required"`, which guarantees a string is always returned and never None.
Update the return type annotation from `str | None` to `str` to accurately
reflect the method's behavior.
In `@tests/conftest.py`:
- Line 185: The test fixture configuration for LLMProvider.CASCADIA uses the IP
address 127.0.0.1 for the api_base URL, while the provider's API_BASE constant
uses localhost. For consistency and maintainability, replace 127.0.0.1 with
localhost in the api_base value for the LLMProvider.CASCADIA configuration in
the test fixture. Both resolve to the same address, but using the same hostname
across the codebase improves clarity.
In `@tests/unit/providers/test_cascadia_provider.py`:
- Around line 8-68: Add a new test function to verify API key precedence
behavior. Create a test that sets the CASCADIA_API_KEY environment variable to
one value using monkeypatch, then instantiates CascadiaProvider with a different
explicit api_key parameter, and asserts that the _verify_and_set_api_key method
returns the explicit key value, confirming that the explicit key takes
precedence over the environment variable as intended by the api_key or
os.getenv(...) logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 54b1b496-37ff-4886-a3fb-19cd25c91c03
📒 Files selected for processing (7)
pyproject.tomlsrc/any_llm/constants.pysrc/any_llm/providers/cascadia/__init__.pysrc/any_llm/providers/cascadia/cascadia.pytests/conftest.pytests/constants.pytests/unit/providers/test_cascadia_provider.py
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 38 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
@t8 nice one, thanks for the contribution. I just approved the workflows to run. Coderabbit left some tiny comments. I'll let you fix them. |
- Narrow _verify_and_set_api_key return type to str; the override always returns a string (explicit key, CASCADIA_API_KEY env, or the no-key-required sentinel), never None. - Add a test that an explicit api_key takes precedence over CASCADIA_API_KEY in the environment. - Use localhost (matching the provider's API_BASE) in the conftest client config for cascadia.
|
Thanks @tbille! Just addressed. Appreciate the quick reply and support. |
Description
Adds
cascadiaas a provider (closes #1146). Cascadia (https://cascadia.to) is adistributed 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
BaseOpenAIProvidersubclass following the vLLM keyless pattern, extended to honorCASCADIA_API_KEYfrom the environment when a fleet is keyed (an explicitapi_keywins; otherwise it falls back to
no-key-requiredso trusted-LAN coordinators workkeyless). Env-configurable base via
CASCADIA_API_BASE(defaulthttp://localhost:9090/v1); no new dependencies (cascadia = []extra, splicedinto
all).on; responses, embeddings, moderation, image, PDF, and batch off.
LLMProvider(src/any_llm/constants.py), thetests/conftest.pyfixture maps, and
LOCAL_PROVIDERS+CI_EXCLUDED_PROVIDERSintests/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, andtests/unit/providers/test_cascadia_provider.py.Testing
tests/unit/providers/test_cascadia_provider.py: provider metadata, keyless auth,explicit-key passthrough,
CASCADIA_API_KEYenv resolution, env/default baseresolution, capability flags, and enum/loader registration. 8 passed, 100%
line+branch coverage of
cascadia.py.against current
main(latest releaseany-llm-sdk1.18.0); rebased on the defaultbranch, where no
cascadiaprovider previously existed.pre-commit runon the change set: ruff, ruff-format, mypy (strict), and codespellall pass.
acompletion("cascadia:<model>", ...)against a Cascadiacoordinator implementing the OpenAI-compatible contract: non-streaming and streaming
both return content and a populated
usageobject. Production Cascadia runs the samecontract across a physical Intel AI PC fleet.
Smoke transcript (real coordinator)
qwen3-8b is a reasoning model, so it emits a
<think>block before the answer; thattext is trimmed here for readability. Token counts on this hosted demo coordinator are
approximate; the provider faithfully surfaces whatever the coordinator reports in
usage.PR Type
Relevant issues
Closes #1146
Checklist
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)
Summary by CodeRabbit
CASCADIA_API_KEY(with safe non-failing fallback when unset).cascadiaextras option (and included it inall).