feat: dynamic model list via browser-captured ListModels RPC - #250
feat: dynamic model list via browser-captured ListModels RPC#250CharoenwitKunna wants to merge 1 commit into
Conversation
- BrowserManager: capture app's own ListModels response via page.on('response')
- BrowserManager: auto-detect API base URL from CoJqbf page config
- BrowserManager: compute SAPISIDHASH in Node to avoid Xray TypedArray issues
- ConfigLoader: add DYNAMIC_MODELS (default true) and DYNAMIC_MODELS_TTL env vars
- ProxyServerSystem: make /v1/models and /v1beta/models async with live fetch
- ProxyServerSystem: add POST /api/models/refresh endpoint
- .env.example: document new dynamic model configuration
|
Thanks for the contribution! I tested this PR and found an important compatibility issue with the dynamically discovered model list. For example, A model being returned by I plan to update the model discovery and request-routing logic together when I have more time. For now, I’ll keep this PR open and continue using the manually maintained model list until the necessary API support can be implemented and tested. Thanks again for the contribution and investigation! |
Closes #249
Changes
page.on('response')beforepage.goto, auto-detect API base URL fromCoJqbfpage config, computeSAPISIDHASHin Node to avoid Xray TypedArray issuesDYNAMIC_MODELS(defaulttrue) andDYNAMIC_MODELS_TTL(default3600000ms) env varsGET /v1/modelsandGET /v1beta/modelsasync with live model fetch (fallback to config), addPOST /api/models/refreshendpointHow it works
page.goto, the app's ownPOST .../ListModelsRPC response is captured (URL, headers, parsed models)fetchLiveModels()returns captured models (TTL-aware), falling back to manual RPC using captured URL/API keyCoJqbf) and API key from page scriptsTesting
DYNAMIC_MODELS=trueand emptyconfigs/models.json: server fetches 36 live modelsGET /v1beta/modelsreturns all 36 models (vs 30 static)