feat: allow overriding provider headers (#2161)

This commit is contained in:
Avinash Thakur
2025-06-07 23:34:00 +05:30
committed by GitHub
parent 86489ef2be
commit 8396cc77e4
12 changed files with 24 additions and 23 deletions

View File

@@ -497,12 +497,6 @@ 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 Providers.env.require_api_key(provider_conf) then
local api_key = self.parse_api_key()
if api_key == nil then
@@ -536,7 +530,7 @@ function M:parse_curl_args(prompt_opts)
url = Utils.url_join(provider_conf.endpoint, "/chat/completions"),
proxy = provider_conf.proxy,
insecure = provider_conf.allow_insecure,
headers = headers,
headers = Utils.tbl_override(headers, self.extra_headers),
body = vim.tbl_deep_extend("force", {
model = provider_conf.model,
messages = self:parse_messages(prompt_opts),