Skip to content

Commit 71cd84d

Browse files
committed
force models.dev refresh on auth login
1 parent e1b7e25 commit 71cd84d

File tree

5 files changed

+16
-33
lines changed

5 files changed

+16
-33
lines changed

opencode.json

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,13 @@
11
{
22
"$schema": "https://opencode.ai/config.json",
33
"provider": {
4-
"openrouter": {
5-
"models": {
6-
"moonshotai/kimi-k2": {
7-
"options": {
8-
"provider": {
9-
"order": ["baseten"],
10-
"allow_fallbacks": false
11-
}
12-
}
13-
}
14-
}
15-
},
16-
"huggingface": {
17-
"models": {
18-
"Qwen/Qwen3-235B-A22B-Instruct-2507:fireworks-ai": {}
19-
}
20-
},
21-
"local": {
22-
"npm": "@ai-sdk/openai-compatible",
23-
"name": "Local",
4+
"cerebras": {
245
"options": {
25-
"baseURL": "http://127.0.0.1:1234/v1",
26-
"includeUsage": true
6+
"apiKey": "csk-m33xrvt43whkypn8r4ph9xc8fenhx2f68c3pj22ext45v5k9"
277
},
8+
"npm": "@ai-sdk/cerebras",
289
"models": {
29-
"qwen/qwen3-coder-30b": {
30-
"name": "Qwen-Coder 30B",
31-
"limit": {
32-
"context": 262144,
33-
"output": 66536
34-
}
35-
}
10+
"qwen-3-coder-480b": {}
3611
}
3712
}
3813
},

packages/opencode/src/cli/cmd/auth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export const AuthLoginCommand = cmd({
100100
prompts.outro("Done")
101101
return
102102
}
103+
await ModelsDev.refresh().catch(() => {})
103104
const providers = await ModelsDev.get()
104105
const priority: Record<string, number> = {
105106
anthropic: 0,

packages/opencode/src/global/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ await Promise.all([
2727
fs.mkdir(Global.Path.log, { recursive: true }),
2828
])
2929

30-
const CACHE_VERSION = "3"
30+
const CACHE_VERSION = "4"
3131

3232
const version = await Bun.file(path.join(Global.Path.cache, "version"))
3333
.text()

packages/opencode/src/lsp/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export namespace LSP {
8484
}
8585
return {
8686
broken: new Set<string>(),
87+
servers,
8788
clients,
8889
}
8990
},

packages/opencode/src/provider/models.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,19 @@ export namespace ModelsDev {
6161

6262
export async function refresh() {
6363
const file = Bun.file(filepath)
64-
log.info("refreshing")
64+
log.info("refreshing", {
65+
file,
66+
})
6567
const result = await fetch("https://models.dev/api.json", {
6668
headers: {
6769
"User-Agent": Installation.USER_AGENT,
6870
},
69-
}).catch(() => {})
70-
if (result && result.ok) await Bun.write(file, result)
71+
}).catch((e) => {
72+
log.error("Failed to fetch models.dev", {
73+
error: e,
74+
})
75+
})
76+
if (result && result.ok) await Bun.write(file, await result.text())
7177
}
7278
}
7379

0 commit comments

Comments
 (0)