You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds OpenRouter as a supported provider. OpenRouter aggregates hundreds of models
(OpenAI, Anthropic, Meta, Mistral, DeepSeek, etc.) behind a single OpenAI-compatible
API and one API key — the strategy reuses the LangChain4J OpenAI model classes
pointed at the OpenRouter base URL.
Add OpenRouterModelProviderStrategy registered in LangChain4jModelFactory.STRATEGIES
No new dependency — reuses langchain4j-open-ai with base URL https://openrouter.ai/api/v1
endpoint config field overrides the base URL (proxies/gateways)
Chat and streaming chat supported; embeddings and image throw UnsupportedOperationException (OpenRouter has no such endpoints)
The PR adds a single new Java strategy class (OpenRouterModelProviderStrategy) and registers it in LangChain4jModelFactory.STRATEGIES, plus Javadoc and unit tests. Checked against every category in the reference:
Category
Check
Verdict
C-1 Structural Data Model Change
No DB tables touched
✅ Safe
C-2 Elasticsearch Mapping Change
No ES mapping code
✅ Safe
C-3 Content JSON Model Version Bump
No CURRENT_MODEL_VERSION change
✅ Safe
C-4 DROP TABLE / DROP COLUMN
No DDL statements
✅ Safe
H-1 One-Way Data Migration
No runonce task, no data transform
✅ Safe
H-2 RENAME TABLE / COLUMN
None
✅ Safe
H-3 PK Restructuring
None
✅ Safe
H-4 New ContentType Field Type
Not a dotCMS field type
✅ Safe
H-5 Storage Provider Change
No FileStorageAPI change
✅ Safe
H-6 DROP PROCEDURE / FUNCTION
None
✅ Safe
H-7 NOT NULL column without default
No schema change
✅ Safe
H-8 VTL Viewtool Contract Change
No viewtool touched
✅ Safe
M-1 Column Type Change
None
✅ Safe
M-2 Push Publishing Bundle Format
None
✅ Safe
M-3 REST/GraphQL API Contract Change
No endpoint signatures changed
✅ Safe
M-4 OSGi Plugin API Breakage
No OSGi interface changed
✅ Safe
Rolling back after deploying this PR simply means the openrouter provider entry disappears from STRATEGIES. Any running instance configured with "provider": "openrouter" would fail to resolve the strategy on N-1 (falling through to "unknown provider"), but no data loss, no schema change, and no index corruption would occur. The application starts cleanly on N-1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds OpenRouter as a supported provider. OpenRouter aggregates hundreds of models
(OpenAI, Anthropic, Meta, Mistral, DeepSeek, etc.) behind a single OpenAI-compatible
API and one API key — the strategy reuses the LangChain4J OpenAI model classes
pointed at the OpenRouter base URL.
OpenRouterModelProviderStrategyregistered inLangChain4jModelFactory.STRATEGIESlangchain4j-open-aiwith base URLhttps://openrouter.ai/api/v1endpointconfig field overrides the base URL (proxies/gateways)UnsupportedOperationException(OpenRouter has no such endpoints)LangChain4jModelFactoryTestConfiguration
{ "chat": { "provider": "openrouter", "model": "openai/gpt-4o", "apiKey": "sk-or-...", "maxTokens": 4096, "temperature": 0.7 } }Notes
openai/gpt-4o,anthropic/claude-sonnet-4,deepseek/deepseek-r1.maxRetriesis not supported by the streaming chat model and is ignored with a warning (same behavior as the OpenAI provider).Related Issue
This PR fixes #36133
EPIC: dotAI Multi-Provider Support #33970