Add extra headers for OpenAI (#1615)

This commit is contained in:
Florian Engelhardt
2025-03-17 10:51:08 +01:00
committed by GitHub
parent f761e83033
commit 3b86549485
3 changed files with 8 additions and 0 deletions

View File

@@ -557,6 +557,7 @@ end
M.BASE_PROVIDER_KEYS = {
"endpoint",
"extra_headers",
"model",
"deployment",
"api_version",

View File

@@ -278,6 +278,12 @@ function M:parse_curl_args(prompt_opts)
["Content-Type"] = "application/json",
}
if provider_conf.extra_headers then
for key, value in pairs(provider_conf.extra_headers) do
headers[key] = value
end
end
if P.env.require_api_key(provider_conf) then
local api_key = self.parse_api_key()
if api_key == nil then

View File

@@ -200,6 +200,7 @@ vim.g.avante_login = vim.g.avante_login
---
---@class AvanteDefaultBaseProvider: table<string, any>
---@field endpoint? string
---@field extra_headers? table<string, any>
---@field model? string
---@field local? boolean
---@field proxy? string