Add (alpha) Openrouter Conversation component - #4334
Conversation
Signed-off-by: Joni Collinge <jonathancollinge@live.com>
There was a problem hiding this comment.
Pull request overview
Adds a new alpha conversation.openrouter component (OpenAI-compatible API via OpenRouter) and wires it into the conversation conformance test matrix.
Changes:
- Introduces the
conversation/openroutercomponent with metadata schema, init logic, and unit tests. - Adds OpenRouter to conformance test execution/config (including env-var based skipping and a test component manifest).
- Extends shared conversation helpers with an HTTP client wrapper that injects optional headers, and adds OpenRouter model env-var/default support.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/conformance/conversation_test.go | Adds OpenRouter component loading and env-var skip logic for conformance runs. |
| tests/config/conversation/tests.yml | Includes OpenRouter in the conversation conformance suite list. |
| tests/config/conversation/openrouter/metadata.yml | Adds conformance component manifest for conversation.openrouter. |
| conversation/opts.go | Adds BuildHTTPClientWithHeaders and a header-injecting RoundTripper wrapper. |
| conversation/openrouter/openrouter.go | New OpenRouter conversation component implementation (OpenAI-compatible client + optional attribution headers + caching). |
| conversation/openrouter/openrouter_test.go | Unit tests covering init paths and metadata reflection. |
| conversation/openrouter/metadata.yaml | Component metadata definition (alpha status, required key, optional model/endpoint/cacheTTL/site attribution fields). |
| conversation/openrouter/metadata.go | Metadata struct embedding shared Langchain metadata and OpenRouter-specific fields. |
| conversation/models.go | Adds OpenRouter default model + env var + getter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Josh van Leeuwen <me@joshvanl.dev> Signed-off-by: Joni Collinge <jonathancollinge@live.com>
sicoyle
left a comment
There was a problem hiding this comment.
few more comments - thank you!
Co-authored-by: Sam <sam@diagrid.io> Signed-off-by: Joni Collinge <jonathancollinge@live.com>
sicoyle
left a comment
There was a problem hiding this comment.
LGTM will approve when there is a docs PR links please - thank you!! 🙌 will you pls also add the dapr/dapr PR to register this new conversation component? It should sit alongside this as an example dapr/cmd/daprd/components/conversation_openai.go
|
@sicoyle added docs and dapr/dapr. Ok? |
|
This might not be needed - @famarting says the openai component works with openrouter models 👍 |
|
Please fix linter when you get a chance 🙏🏻 |
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Signed-off-by: Joni Collinge jonathancollinge@live.com
Description
Adds a new alpha conversation component for openrouter. This abstraction, similar to ollama allows you to select from a portfolio of models that are hosted on the openrouter platform.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list:
Note: We expect contributors to open a corresponding documentation PR in the dapr/docs repository. As the implementer, you are the best person to document your work! Implementation PRs will not be merged until the documentation PR is opened and ready for review.