chore: add User-Agent headers for Cloudflare providers (#20538)

Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
pull/20413/head
MC 2026-04-01 21:02:17 -04:00 committed by GitHub
parent 00d6841f84
commit 0cad775427
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -681,6 +681,9 @@ export namespace Provider {
autoload: !!apiKey, autoload: !!apiKey,
options: { options: {
apiKey, apiKey,
headers: {
"User-Agent": `opencode/${Installation.VERSION} cloudflare-workers-ai (${os.platform()} ${os.release()}; ${os.arch()})`,
},
}, },
async getModel(sdk: any, modelID: string) { async getModel(sdk: any, modelID: string) {
return sdk.languageModel(modelID) return sdk.languageModel(modelID)
@ -732,6 +735,9 @@ export namespace Provider {
cacheKey: input.options?.cacheKey, cacheKey: input.options?.cacheKey,
skipCache: input.options?.skipCache, skipCache: input.options?.skipCache,
collectLog: input.options?.collectLog, collectLog: input.options?.collectLog,
headers: {
"User-Agent": `opencode/${Installation.VERSION} cloudflare-ai-gateway (${os.platform()} ${os.release()}; ${os.arch()})`,
},
} }
const aigateway = createAiGateway({ const aigateway = createAiGateway({