add user agent for models.dev request

This commit is contained in:
Dax Raad
2025-07-31 22:00:45 -04:00
parent 3aa6eeb426
commit 851e900982

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)
}
}