feat: add OpenRouter as LLM and embedding provider#56
Open
oglenyaboss wants to merge 1 commit intorepowise-dev:mainfrom
Open
feat: add OpenRouter as LLM and embedding provider#56oglenyaboss wants to merge 1 commit intorepowise-dev:mainfrom
oglenyaboss wants to merge 1 commit intorepowise-dev:mainfrom
Conversation
Add OpenRouter as a first-class provider, enabling access to 200+ models (Claude, GPT, Gemini, Llama, Qwen, etc.) through a single API key. LLM provider: - New OpenRouterProvider using OpenAI-compatible endpoint - Supports generate() and stream_chat() (ChatProvider protocol) - Sets recommended HTTP-Referer and X-Title headers - Default model: anthropic/claude-sonnet-4.6 - Rate limits: 60 RPM / 200K TPM - Cost tracking intentionally disabled (OpenRouter proxies models with varying prices — users should check the OpenRouter dashboard) Embedding provider: - New OpenRouterEmbedder for vector search and chat - Default model: google/gemini-embedding-001 (768 dims) - One OPENROUTER_API_KEY covers both LLM and embeddings Integration: - Registered in LLM and embedding registries (lazy import) - CLI auto-detection from OPENROUTER_API_KEY env var - Interactive provider selection in `repowise init` - Embedder selection in `repowise serve` - Server provider catalog for web UI - No new pip dependency (uses existing openai package) Tests: - 13 unit tests (construction, generation, error mapping, headers) - Registry test updated (builtin count 6 → 7) - Integration test (skipped without OPENROUTER_API_KEY)
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
OPENROUTER_API_KEYrepowise init(doc generation) andrepowise serve(chat/search) work with OpenRouter out of the boxopenaipackage (OpenAI-compatible API)LLM Provider
OpenRouterProviderwithgenerate()+stream_chat()supportanthropic/claude-sonnet-4.6HTTP-RefererandX-Titleheaders for OpenRouter dashboard trackingEmbedding Provider
OpenRouterEmbedderfor semantic search and chat RAGgoogle/gemini-embedding-001(768 dims)Integration Points
OPENROUTER_API_KEYenv varrepowise initandrepowise serveKnown Limitations
/api/v1/modelsendpoint.qwen/qwen3.6-plusvia OpenRouter. Chat and embedding functionality was not integration-tested but follows the same OpenAI-compatible patterns as the existing OpenAI provider.Test plan
OPENROUTER_API_KEY)repowise initwith OpenRouter on a real project (328 wiki pages generated successfully)