Skip to content

Commit cb7fd8f

Browse files
chore: add User-Agent headers for Cloudflare providers (anomalyco#20538)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
1 parent 2e7e949 commit cb7fd8f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/opencode/src/provider/provider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,9 @@ export namespace Provider {
681681
autoload: !!apiKey,
682682
options: {
683683
apiKey,
684+
headers: {
685+
"User-Agent": `opencode/${Installation.VERSION} cloudflare-workers-ai (${os.platform()} ${os.release()}; ${os.arch()})`,
686+
},
684687
},
685688
async getModel(sdk: any, modelID: string) {
686689
return sdk.languageModel(modelID)
@@ -732,6 +735,9 @@ export namespace Provider {
732735
cacheKey: input.options?.cacheKey,
733736
skipCache: input.options?.skipCache,
734737
collectLog: input.options?.collectLog,
738+
headers: {
739+
"User-Agent": `opencode/${Installation.VERSION} cloudflare-ai-gateway (${os.platform()} ${os.release()}; ${os.arch()})`,
740+
},
735741
}
736742

737743
const aigateway = createAiGateway({

0 commit comments

Comments
 (0)