Skip to content

Add (alpha) Openrouter Conversation component - #4334

Open
jjcollinge wants to merge 10 commits into
dapr:mainfrom
jjcollinge:jjcollinge/openrouter-conversation
Open

Add (alpha) Openrouter Conversation component#4334
jjcollinge wants to merge 10 commits into
dapr:mainfrom
jjcollinge:jjcollinge/openrouter-conversation

Conversation

@jjcollinge

@jjcollinge jjcollinge commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

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:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation
    • Created the dapr/docs PR:

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.

Signed-off-by: Joni Collinge <jonathancollinge@live.com>
@jjcollinge
jjcollinge requested review from a team as code owners April 10, 2026 10:02
Comment thread conversation/openrouter/metadata.go Outdated
Signed-off-by: Joni Collinge <jonathancollinge@live.com>
Comment thread conversation/openrouter/metadata.go Outdated
Comment thread conversation/openrouter/metadata.go Outdated
Comment thread conversation/opts.go

Copilot AI 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.

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/openrouter component 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.

Comment thread conversation/opts.go Outdated
Comment thread conversation/openrouter/openrouter.go Outdated
Comment thread conversation/openrouter/metadata.yaml Outdated
Comment thread tests/config/conversation/openrouter/openrouter.yml
jjcollinge and others added 2 commits April 10, 2026 14:50
Co-authored-by: Josh van Leeuwen <me@joshvanl.dev>
Signed-off-by: Joni Collinge <jonathancollinge@live.com>
Signed-off-by: Joni Collinge <jonathancollinge@live.com>
Comment thread conversation/openrouter/metadata.go Outdated
Comment thread conversation/openrouter/metadata.yaml Outdated

@sicoyle sicoyle 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.

few more comments - thank you!

Comment thread conversation/opts.go
Comment thread tests/config/conversation/openrouter/openrouter.yml
jjcollinge and others added 2 commits April 10, 2026 16:16
Co-authored-by: Sam <sam@diagrid.io>
Signed-off-by: Joni Collinge <jonathancollinge@live.com>
Signed-off-by: Joni Collinge <jonathancollinge@live.com>

@sicoyle sicoyle 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.

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

Comment thread conversation/opts.go
@jjcollinge

Copy link
Copy Markdown
Contributor Author

@sicoyle added docs and dapr/dapr. Ok?

@JoshVanL
JoshVanL enabled auto-merge May 14, 2026 11:56
@jjcollinge

jjcollinge commented May 14, 2026

Copy link
Copy Markdown
Contributor Author

This might not be needed - @famarting says the openai component works with openrouter models 👍

@msfussell msfussell changed the title Add alpha openrouter converstaion component Add (alpha) Openrouter Conversation component May 23, 2026
@cicoyle cicoyle added this to the v1.19 milestone Jun 1, 2026
@cicoyle
cicoyle dismissed sicoyle’s stale review June 1, 2026 20:03

2 other approvals, so we are good here

@cicoyle

cicoyle commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Please fix linter when you get a chance 🙏🏻

@dapr-bot

dapr-bot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

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!

@dapr-bot dapr-bot added the stale label Jul 1, 2026
@dapr-bot dapr-bot removed the stale label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants