feat(providers): implement OpenRouter provider support in ProviderRegistry #10676

Merged
HAL9000 merged 4 commits from feat/v360/openrouter-provider into master 2026-06-06 08:56:58 +00:00

4 Commits

Author SHA1 Message Date
HAL9000 9dca20dc6d fix(providers): remove duplicate OPENROUTER block and add _create_provider_llm
CI / lint (pull_request) Successful in 38s
CI / helm (pull_request) Successful in 34s
CI / build (pull_request) Successful in 42s
CI / push-validation (pull_request) Successful in 44s
CI / quality (pull_request) Successful in 1m6s
CI / security (pull_request) Successful in 1m23s
CI / typecheck (pull_request) Successful in 2m17s
CI / unit_tests (pull_request) Successful in 6m10s
CI / docker (pull_request) Successful in 2m49s
CI / integration_tests (pull_request) Successful in 9m42s
CI / coverage (pull_request) Successful in 12m20s
CI / status-check (pull_request) Successful in 3s
The _create_provider_instance method had two ProviderType.OPENROUTER
branches. The first (lines 574-598) ran first, returning without
sanitizing numeric header keys. The second (correct) branch at lines
627-652 — which coerces all header keys/values to str — was dead code
and never reached.

Fix: remove the first (broken) branch so the sanitizing branch executes.

Also add _create_provider_llm as a thin wrapper around
_create_provider_instance. Three scenarios in
openrouter_provider_registry.feature called this method and received
AttributeError because it did not exist.

Fixes: features/openrouter_provider_registry.feature:19,27,35 (errored)
       features/provider_registry_coverage_boost.feature:48 (failed)
2026-06-06 04:37:11 -04:00
HAL9000 58c607fd79 fix(providers): restore parse step matcher after openrouter regex steps
The openrouter_provider_registry_steps.py file called use_step_matcher("re")
at module level without restoring the default "parse" matcher at the end.
This caused all step files loaded alphabetically after it (provider_registry_*,
resource_*, session_*, etc.) to use the regex matcher instead of the parse
matcher, breaking their {value}-style step patterns and causing unit_tests CI
failures.

Add use_step_matcher("parse") at the end of the file to restore the default
matcher after the openrouter step definitions are registered.
2026-06-06 04:37:11 -04:00
HAL9000 7d4e86d49c style(providers): fix ruff formatting in openrouter registry and steps 2026-06-06 04:37:11 -04:00
HAL9000 8be7f59931 feat(providers): implement OpenRouter provider support in ProviderRegistry
Added handling for ProviderType.OPENROUTER in _create_provider_llm in src/cleveragents/providers/registry.py to resolve ValueError: Unsupported provider type when using OpenRouter via create_llm.

Created features/openrouter_provider_registry.feature with 11 scenarios validating OpenRouter provider behavior in ProviderRegistry.

Created features/steps/openrouter_provider_registry_steps.py with step definitions for the new feature file.

Created docs/reference/providers.md with comprehensive documentation including the OpenRouter configuration guide.

ISSUES CLOSED: #8907
2026-06-06 04:37:11 -04:00