-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fetch model and provider list from specified OpenRouter base URL #4931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: cobra91 <[email protected]>
| memoryCache.set(cacheKey, models) | ||
|
|
||
| try { | ||
| models = await readModels(provider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cache file seems to be ineffective, because it is only read after we just wrote it, so I decided to remove it.
| const { provider } = options | ||
| let models = memoryCache.get<ModelRecord>(provider) | ||
|
|
||
| const cacheKey = JSON.stringify(options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options is a small object, see the type definition of GetModelsOptions
|
Hey @cte since you were the one who implemented the cache file for the models, do you think this is a good idea? |
Kilo maintainer here. We received an issue that OpenRouter base url support is not fully implemented and @cobra91 graciously made a pull request. Be sure to credit him if this PR is accepted!
Summary of changes:
While I do think these changes are an improvement, there is still room for improvement, e.g.:
Important
Enhance model and provider fetching by supporting custom OpenRouter base URLs, updating caching, API handling, and UI components.
getOpenRouterModels()andgetOpenRouterProvidersForModel().modelCache.ts.webviewMessageHandler.tsto handle custom base URL and API key for OpenRouter.openRouterBaseUrlandopenRouterApiKeytouseRouterModels()anduseSelectedModel()hooks.ApiOptions.tsxandOpenRouter.tsxto include fields for custom base URL and API key.modelCache.ts.ClineProvider.tsto allow fetching from any URL.ClineProvider.spec.tsandwebviewMessageHandler.spec.tsto cover new functionality.This description was created by
for bc18fb6. You can customize this summary. It will automatically update as commits are pushed.