Skip to content

Commit 50e4b3e

Browse files
committed
add version to user-agent
1 parent 6ebd828 commit 50e4b3e

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

packages/opencode/src/installation/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export namespace Installation {
136136
}
137137

138138
export const VERSION = typeof OPENCODE_VERSION === "string" ? OPENCODE_VERSION : "dev"
139+
export const USER_AGENT = `opencode/${VERSION}`
139140

140141
export async function latest() {
141142
return fetch("https://api.github.com/repos/sst/opencode/releases/latest")

packages/opencode/src/provider/models.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Log } from "../util/log"
33
import path from "path"
44
import { z } from "zod"
55
import { data } from "./models-macro" with { type: "macro" }
6+
import { Installation } from "../installation"
67

78
export namespace ModelsDev {
89
const log = Log.create({ service: "models.dev" })
@@ -63,7 +64,7 @@ export namespace ModelsDev {
6364
log.info("refreshing")
6465
const result = await fetch("https://models.dev/api.json", {
6566
headers: {
66-
"User-Agent": "opencode",
67+
"User-Agent": Installation.USER_AGENT,
6768
},
6869
}).catch(() => {})
6970
if (result && result.ok) await Bun.write(file, result)

0 commit comments

Comments
 (0)