feat(cli): add OpenRouter support for AI and embedding models#1
Open
feat(cli): add OpenRouter support for AI and embedding models#1
Conversation
…vent detail interfaces
…untime simulation
- Updated `hasEmbeddingSupport` to include 'openrouter' as a supported model. - Enhanced `getAvailableEmbeddingModels` to provide options for OpenRouter. - Added configuration options for OpenRouter in the `.env` file setup, including API key and embedding model details. - Implemented setup functions for AI and embedding model configurations to handle OpenRouter in both interactive and non-interactive modes.
- Added 'openrouter' to the list of models with embedding support in the `hasEmbeddingSupport` function. - Adjusted the model selection flow to reflect the correct categorization of models needing separate embedding providers.
…pi-runtime-reference
…son-types-path
docs: fix old links to actual
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.
Relates to
Improves OpenRouter integration in ElizaOS CLI by adding native embedding support, eliminating the need for users to configure a separate embedding provider when using OpenRouter.
Risks
Low Risk - Well-contained changes following existing patterns
isValidOpenRouterKeyfunction to validate API key format (sk-or-prefix)Background
What does this PR do?
This PR adds comprehensive OpenRouter support for embeddings in the ElizaOS CLI:
hasEmbeddingSupportto include'openrouter'as a model with built-in embedding supportgetAvailableEmbeddingModelsas a fallback option when the primary AI model doesn't support embeddings (e.g., Claude)setupAIModelConfigandsetupEmbeddingModelConfigto handle:Technical Details:
OPENROUTER_API_KEY,OPENROUTER_EMBEDDING_MODEL, andOPENROUTER_EMBEDDING_DIMENSIONSpromptAndStoreOpenRouterKeyhelper function fromget-config.tsWhat kind of change is this?
Why are we doing this? Any context or related work?
Problem:
Solution:
Documentation changes needed?
.envtemplate inpackages/cli/src/utils/get-config.tsalready includes OpenRouter environment variables (lines 79-82)Recommended documentation updates:
OPENROUTER_API_KEY=sk-or-v1-...OPENROUTER_EMBEDDING_MODEL=openai/text-embedding-3-smallOPENROUTER_EMBEDDING_DIMENSIONS=1536Testing
Where should a reviewer start?
Review Priority:
Core logic changes -
packages/cli/src/commands/create/utils/selection.tshasEmbeddingSupportnow includes'openrouter'getAvailableEmbeddingModelsConfiguration setup -
packages/cli/src/commands/create/actions/setup.tssetupAIModelConfigOpenRouter casesetupEmbeddingModelConfigOpenRouter caseTest updates -
packages/cli/tests/unit/utils/selection.test.tsDetailed testing steps
1. Unit Tests ✅
Expected: All tests pass
hasEmbeddingSupport('openrouter')returnstrue2. Interactive Mode - OpenRouter as Primary AI
Verify:
.envcontainsOPENROUTER_API_KEY=3. Interactive Mode - OpenRouter as Embedding Fallback
Verify:
.envcontainsANTHROPIC_API_KEY=.envcontainsOPENROUTER_API_KEY=.envcontainsOPENROUTER_EMBEDDING_MODEL=andOPENROUTER_EMBEDDING_DIMENSIONS=4. Non-Interactive Mode
Verify:
.envcreated with placeholder:OPENROUTER_API_KEY=your_openrouter_api_key_here# Get your API key from: https://openrouter.ai/keys5. Regression Testing - Other Providers
Expected: All providers create projects successfully with correct
.envconfigurations6. Optional: E2E Testing with Real API Key
Discord username
neysixx