lemonai
lemonai copied to clipboard
[Feature] [OpenRouter] Implement Full Open Router API Support (UI + Backend)
Parent Epic: #56 Depends on: #61 (This issue introduces the "Provider Type" UI)
🎯 Goal
Implement end-to-end support for the Open Router API, allowing users to add it as a custom model provider.
💻 UI Requirements (Frontend)
- Add "Open Router" as an option to the "Provider Type" dropdown menu (introduced in #61).
- When a user selects "Open Router", the form must show the following fields:
API Key(Required)API Address(Optional: Allow users to specify a custom/proxy endpoint instead of the defaulthttps://openrouter.ai/api/v1)HTTP-Referer(Optional: Allow users to specify a customHTTP-Refererheader, as required by some Open Router configurations)
⚙️ Backend Requirements
- Modify the "save model" API to store the
provider_type: 'OpenRouter'and its associated fields. - The backend logic must check the
provider_typefor the model. - If the
provider_typeis "Open Router", the system must route the API call to anllm.openrouter.jsclient (this client may need to be created or updated). - The
llm.openrouter.jsclient must correctly:- Use the
API Keyin theAuthorization: Bearer [API Key]header. - Target the
API Address(or the default Open Router endpoint if not provided). - Include the
HTTP-Refererheader in the request if one was provided by the user.
- Use the
✅ Acceptance Criteria
- A user can successfully add and save an Open Router API configuration via the UI.
- The system can use this configuration to successfully make calls to the Open Router API.