[PR #1176] [MERGED] 1173 dynamic cache openrouter #3612

Closed
opened 2026-02-22 18:34:08 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/1176
Author: @timothycarambat
Created: 4/23/2024
Status: Merged
Merged: 4/23/2024
Merged by: @timothycarambat

Base: masterHead: 1173-dynamic-cache-openrouter


📝 Commits (3)

  • eb060ea patch agent invocation rule
  • 0efa050 Add dynamic model cache from OpenRouter API for context length and available models
  • 6a28162 Merge branch 'master' of github.com:Mintplex-Labs/anything-llm into 1173-dynamic-cache-openrouter

📊 Changes

7 files changed (+95 additions, -831 deletions)

View changed files

📝 frontend/src/hooks/useGetProvidersModels.js (+1 -1)
📝 server/storage/models/.gitignore (+2 -1)
📝 server/utils/AiProviders/openRouter/index.js (+89 -11)
server/utils/AiProviders/openRouter/models.js (+0 -778)
server/utils/AiProviders/openRouter/scripts/.gitignore (+0 -1)
server/utils/AiProviders/openRouter/scripts/parse.mjs (+0 -37)
📝 server/utils/helpers/customModels.js (+3 -2)

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #1173

What is in this change?

Caches OpenRouter /models API into storage so that we can get the proper context window lengths on initialization of the LLM
Marks API response as stale after 1 week via .cached_at file in storage.

Additional Information

Anyone currently using OpenRouter will cache this info on request of models or first chat.

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/1176 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 4/23/2024 **Status:** ✅ Merged **Merged:** 4/23/2024 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `1173-dynamic-cache-openrouter` --- ### 📝 Commits (3) - [`eb060ea`](https://github.com/Mintplex-Labs/anything-llm/commit/eb060eae87f74285ec08c6ff2037d4ed8765c0e2) patch agent invocation rule - [`0efa050`](https://github.com/Mintplex-Labs/anything-llm/commit/0efa05033e8acaa3059f72c0b0751caea0d5e048) Add dynamic model cache from OpenRouter API for context length and available models - [`6a28162`](https://github.com/Mintplex-Labs/anything-llm/commit/6a281629678abf24cfb59c05e76b97cbae81da2d) Merge branch 'master' of github.com:Mintplex-Labs/anything-llm into 1173-dynamic-cache-openrouter ### 📊 Changes **7 files changed** (+95 additions, -831 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/hooks/useGetProvidersModels.js` (+1 -1) 📝 `server/storage/models/.gitignore` (+2 -1) 📝 `server/utils/AiProviders/openRouter/index.js` (+89 -11) ➖ `server/utils/AiProviders/openRouter/models.js` (+0 -778) ➖ `server/utils/AiProviders/openRouter/scripts/.gitignore` (+0 -1) ➖ `server/utils/AiProviders/openRouter/scripts/parse.mjs` (+0 -37) 📝 `server/utils/helpers/customModels.js` (+3 -2) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [x] ✨ feat - [x] 🐛 fix - [ ] ♻️ refactor - [ ] 💄 style - [x] 🔨 chore - [ ] 📝 docs ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #1173 ### What is in this change? <!-- Describe the changes in this PR that are impactful to the repo. --> Caches OpenRouter /models API into storage so that we can get the proper context window lengths on initialization of the LLM Marks API response as stale after 1 week via `.cached_at` file in storage. ### Additional Information <!-- Add any other context about the Pull Request here that was not captured above. --> Anyone currently using OpenRouter will cache this info on request of models or first chat. ### Developer Validations <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated - [x] I have tested my code functionality - [x] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:34:08 -05:00
yindo closed this issue 2026-02-22 18:34:08 -05:00
yindo changed title from [PR #1176] 1173 dynamic cache openrouter to [PR #1176] [MERGED] 1173 dynamic cache openrouter 2026-06-05 15:14:19 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#3612