add user agent for models.dev request

pull/1488/head v0.3.109
Dax Raad 2025-07-31 22:00:45 -04:00
parent 3aa6eeb426
commit 851e900982
1 changed files with 5 additions and 1 deletions

View File

@ -64,7 +64,11 @@ export namespace ModelsDev {
async function refresh() {
const file = Bun.file(filepath)
log.info("refreshing")
const result = await fetch("https://models.dev/api.json").catch(() => {})
const result = await fetch("https://models.dev/api.json", {
headers: {
"User-Agent": "opencode",
},
}).catch(() => {})
if (result && result.ok) await Bun.write(file, result)
}
}