Add http-referer header for vercel ai gateway requests (#1403)
This commit is contained in:
@@ -97,7 +97,7 @@ export namespace Provider {
|
|||||||
Array.isArray(msg.content) && msg.content.some((part: any) => part.type === "image_url"),
|
Array.isArray(msg.content) && msg.content.some((part: any) => part.type === "image_url"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch { }
|
||||||
const headers: Record<string, string> = {
|
const headers: Record<string, string> = {
|
||||||
...init.headers,
|
...init.headers,
|
||||||
...copilot.HEADERS,
|
...copilot.HEADERS,
|
||||||
@@ -194,6 +194,17 @@ export namespace Provider {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
vercel: async () => {
|
||||||
|
return {
|
||||||
|
autoload: false,
|
||||||
|
options: {
|
||||||
|
headers: {
|
||||||
|
"http-referer": "https://opencode.ai/",
|
||||||
|
"x-title": "opencode",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const state = App.state("provider", async () => {
|
const state = App.state("provider", async () => {
|
||||||
@@ -263,26 +274,26 @@ export namespace Provider {
|
|||||||
cost:
|
cost:
|
||||||
!model.cost && !existing?.cost
|
!model.cost && !existing?.cost
|
||||||
? {
|
? {
|
||||||
input: 0,
|
input: 0,
|
||||||
output: 0,
|
output: 0,
|
||||||
cache_read: 0,
|
cache_read: 0,
|
||||||
cache_write: 0,
|
cache_write: 0,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
cache_read: 0,
|
cache_read: 0,
|
||||||
cache_write: 0,
|
cache_write: 0,
|
||||||
...existing?.cost,
|
...existing?.cost,
|
||||||
...model.cost,
|
...model.cost,
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
...existing?.options,
|
...existing?.options,
|
||||||
...model.options,
|
...model.options,
|
||||||
},
|
},
|
||||||
limit: model.limit ??
|
limit: model.limit ??
|
||||||
existing?.limit ?? {
|
existing?.limit ?? {
|
||||||
context: 0,
|
context: 0,
|
||||||
output: 0,
|
output: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
parsed.models[modelID] = parsedModel
|
parsed.models[modelID] = parsedModel
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user