Skip to content

feat(registry): migrate cascadia, vllm and llamacpp to registry rows (#1417) - #1421

Merged
njbrake merged 1 commit into
mozilla-ai:mainfrom
00200200:feat/migrate-registry-local-providers
Sep 22, 2026
Merged

njbrake merged 1 commit into
mozilla-ai:mainfrom
00200200:feat/migrate-registry-local-providers

Conversation

@00200200

@00200200 00200200 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

Migrates three local-runner providers (cascadia, vllm, and llamacpp) to PROVIDER_REGISTRY rows using api_key_optional=True added in #1416, following the plan outlined in #1417.

Changes

  1. cascadia: Migrated to a PROVIDER_REGISTRY row with api_key_optional=True. Replaced src/any_llm/providers/cascadia/cascadia.py with an import shim calling get_registry_provider_class("cascadia").
  2. vllm: Migrated to a PROVIDER_REGISTRY row with api_key_optional=True. Fixed defect where VllmProvider previously declared ENV_API_KEY_NAME = "VLLM_API_KEY" but never read it in _verify_and_set_api_key. It now properly honors VLLM_API_KEY from the environment while still defaulting to "no-key-required" when unset. Replaced src/any_llm/providers/vllm/vllm.py with an import shim.
  3. llamacpp: Migrated to a PROVIDER_REGISTRY row with api_key_optional=True. Fixed ENV_API_KEY_NAME which was previously the string "None", adopting "LLAMACPP_API_KEY" and honoring both explicit keys and environment variables (useful when llama.cpp server runs with --api-key). Replaced src/any_llm/providers/llamacpp/llamacpp.py with an import shim.
  4. OpenAICompatibleProvider: In src/any_llm/providers/openai/custom.py, subclassed _OptionalApiKeyProvider to drop its duplicate _verify_and_set_api_key implementation.
  5. Tests: Added comprehensive test coverage in test_vllm_provider.py and test_llamacpp.py verifying metadata, capability flags, loader/enum resolution, and key resolution precedence (explicit key > env key > "no-key-required"). Added shim resolution tests for cascadia, llamacpp, and vllm in test_registry.py.

PR Type

  • 🆕 New Feature

Relevant issues

Resolves #1417

Checklist

  • I understand the code I am submitting.
  • I have added unit tests that prove my fix/feature works
  • I have run this code locally and verified it fixes the issue.
  • New and existing tests pass locally

Summary by CodeRabbit

  • New Features

    • Added registry-based configuration for Cascadia, Llama.cpp and vLLM providers.
    • Added provider metadata, documentation links and capability information, including image completion, embeddings and moderation support for Llama.cpp.
    • Preserved existing provider import paths for compatibility.
  • Bug Fixes

    • Improved API key handling for custom OpenAI-compatible endpoints and supported providers, including optional keys and explicit key precedence.

…ozilla-ai#1417)

- Register cascadia, llamacpp, and vllm as config-only rows in PROVIDER_REGISTRY with api_key_optional=True
- Replace code folders with import shims keeping deep-import paths backward compatible
- Honor VLLM_API_KEY from environment in VllmProvider
- Adopt LLAMACPP_API_KEY in LlamacppProvider, honoring both explicit keys and env vars
- Subclass _OptionalApiKeyProvider in OpenAICompatibleProvider and remove duplicate key-verification method
- Add comprehensive test coverage for metadata, key resolution precedence, and capabilities
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 573787c5-f9ae-4f41-b4f2-c692e56cc73e

📥 Commits

Reviewing files that changed from the base of the PR and between ebc4e36 and e50b309.

📒 Files selected for processing (8)
  • src/any_llm/providers/cascadia/cascadia.py
  • src/any_llm/providers/llamacpp/llamacpp.py
  • src/any_llm/providers/openai/custom.py
  • src/any_llm/providers/registry.py
  • src/any_llm/providers/vllm/vllm.py
  • tests/unit/providers/test_llamacpp.py
  • tests/unit/providers/test_vllm_provider.py
  • tests/unit/test_registry.py

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

Cascadia, llama.cpp, and vLLM now use provider registry rows. Their historical module paths remain available through import shims. OpenAI-compatible key handling uses the registry’s optional-key provider. Tests cover metadata, capabilities, key resolution, and registration.

Changes

Provider registry migration

Layer / File(s) Summary
Registry provider configurations
src/any_llm/providers/registry.py
Added registry rows for Cascadia, llama.cpp, and vLLM with endpoints, environment variables, capabilities, documentation metadata, and optional API-key support.
Provider shims and key handling
src/any_llm/providers/cascadia/cascadia.py, src/any_llm/providers/llamacpp/llamacpp.py, src/any_llm/providers/vllm/vllm.py, src/any_llm/providers/openai/custom.py
Replaced local provider classes with registry aliases. Changed OpenAICompatibleProvider to use _OptionalApiKeyProvider and removed its local key verification override.
Provider metadata and registration tests
tests/unit/providers/test_llamacpp.py, tests/unit/providers/test_vllm_provider.py, tests/unit/test_registry.py
Added coverage for metadata, API-key precedence, capability flags, enum and loader registration, supported-provider listings, and registry import-shim identity.

Suggested reviewers: njbrake

Priority: ➖ Normal

Change: Feature · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to e50b3

The migration centralizes optional API-key handling while preserving provider imports and registration behavior; the supplied tests cover the key paths and the change is mergeable.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the migration of the Cascadia, vLLM, and llama.cpp providers to registry rows.
Description check ✅ Passed The description covers the migration, provider-specific behaviour, tests, issue reference, PR type, and checklist. The AI Usage Information section and several optional checklist items are not complet…
Linked Issues check ✅ Passed The changes meet the coding requirements in [#1417]. cascadia, vllm, and llamacpp have registry rows with api_key_optional=True. The rows preserve provider metadata and capabilities. The optio…
Out of Scope Changes check ✅ Passed The changed source files and tests support [#1417]. The registry rows, import shims, optional-key reuse, and key-handling tests directly implement the migration and its required behaviour. No unrelate…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@njbrake
njbrake self-requested a review September 22, 2026 13:42
@njbrake njbrake self-assigned this Sep 22, 2026
@00200200
00200200 deployed to integration-tests September 22, 2026 13:46 — with GitHub Actions Active
@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/any_llm/providers/cascadia/cascadia.py 100.00% <100.00%> (ø)
src/any_llm/providers/llamacpp/llamacpp.py 100.00% <100.00%> (ø)
src/any_llm/providers/openai/custom.py 100.00% <100.00%> (ø)
src/any_llm/providers/registry.py 100.00% <ø> (ø)
src/any_llm/providers/vllm/vllm.py 100.00% <100.00%> (ø)

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@njbrake njbrake left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both key-handling defects from #1417 are fixed. Against a llama.cpp server started with --api-key: llamacpp with an explicit key or LLAMACPP_API_KEY, and vllm with VLLM_API_KEY, all returned 401 before this change and complete now. Cascadia is the no-op the issue predicted.

Provider metadata across every provider is unchanged except llamacpp's env_key, "None" to LLAMACPP_API_KEY. Capability flags, tiers and class names hold, so the migration is behavior-preserving outside the two intended fixes.

llamacpp integration: 14 passed, 17 skipped, all skips capability-gated. The vllm and cascadia rows serve completion, streaming and list_models on their row defaults; both sit in CI_EXCLUDED_PROVIDERS, so CI does not cover them.

Non-blocking follow-ups: llamafile still discards caller-supplied keys and publishes None as its key env var; llamacpp's supports_moderation=True is wrong, the endpoint 404s.

Note: this review was drafted by Claude Opus 5 via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's.

@njbrake
njbrake merged commit 57186d5 into mozilla-ai:main Sep 22, 2026
18 checks passed
@github-actions github-actions Bot added the 1.29.0 Included in release 1.29.0 label Sep 24, 2026

This branch was successfully deployed

1 active deployment
integration-tests — e50b309f Deployed Sep 22, 2026 by 00200200 via run-docs-tests #3083
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.29.0 Included in release 1.29.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate cascadia, vllm and llamacpp to registry rows

2 participants