Add OpenRouter Support to Express Sample Server#439
Open
wongchichong wants to merge 17 commits intoOvidijusParsiunas:mainfrom
Open
Add OpenRouter Support to Express Sample Server#439wongchichong wants to merge 17 commits intoOvidijusParsiunas:mainfrom
wongchichong wants to merge 17 commits intoOvidijusParsiunas:mainfrom
Conversation
…cations to serviceIOFactory.ts
Owner
|
Hi @wongchichong. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This PR adds comprehensive OpenRouter support to the Express sample server, enabling users to easily integrate with OpenRouter's AI services through the deep-chat component.
Changes
Added OpenRouter service endpoints in the Express server:
/openrouter-chat- Standard chat completion endpoint/openrouter-chat-stream- Streaming chat completion endpoint/openrouter-list-models- Model listing endpointImplemented OpenRouter service class with:
Updated serviceIOFactory.ts to properly route OpenRouter requests:
Service URL Pattern
The endpoint follows the pattern:
http://host:port/openrouter-chatExample configuration in deep-chat:
Environment Variables
To use the OpenRouter service, set the following environment variables in your
.envfile:OPENROUTER_API_KEY- Your OpenRouter API keyOPENROUTER_DEFAULT_MODEL- Default model to use (optional, defaults to 'moonshotai/kimi-k2:free')OPENROUTER_IMAGE_MODEL- Default image model to use (optional, defaults to 'qwen/qwen2.5-vl-72b-instruct:free')OPENROUTER_HTTP_REFERER- HTTP referer header (optional)OPENROUTER_X_TITLE- X-Title header (optional)Features
Testing
The implementation has been tested with:
This integration allows developers to quickly set up an OpenRouter-powered chat interface using the deep-chat component with minimal configuration.
Important Note
Before starting work on a new feature or making changes to our API, please open a new issue first.
This helps us to:
Creating an issue first allows for better collaboration and helps avoid duplicated or misaligned efforts. Thank you!