feat: Make the models.dev domain configurable for offline environments (#9258)

This commit is contained in:
Bart Broere 2026-01-21 18:23:07 +01:00 committed by GitHub
commit 8df09abb1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 18 additions and 6 deletions

View file

@ -85,7 +85,8 @@ export namespace ModelsDev {
const json = await data()
return JSON.parse(json) as Record<string, Provider>
}
const json = await fetch("https://models.dev/api.json").then((x) => x.text())
const url = Global.Path.modelsDevUrl
const json = await fetch(`${url}/api.json`).then((x) => x.text())
return JSON.parse(json) as Record<string, Provider>
}
@ -95,7 +96,8 @@ export namespace ModelsDev {
log.info("refreshing", {
file,
})
const result = await fetch("https://models.dev/api.json", {
const url = Global.Path.modelsDevUrl
const result = await fetch(`${url}/api.json`, {
headers: {
"User-Agent": Installation.USER_AGENT,
},