Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
754a8ca9
Unverified
Commit
754a8ca9
authored
Jan 31, 2026
by
Zack Yu
Committed by
GitHub
Jan 31, 2026
Browse files
fix: only include Authorization header when OPENAI_API_KEY is set (#33488)
Signed-off-by:
zack041
<
zackyu041@gmail.com
>
parent
302ecf64
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
26 deletions
+17
-26
vllm/benchmarks/lib/endpoint_request_func.py
vllm/benchmarks/lib/endpoint_request_func.py
+17
-26
No files found.
vllm/benchmarks/lib/endpoint_request_func.py
View file @
754a8ca9
...
...
@@ -138,6 +138,16 @@ def _update_headers_common(
headers
[
"x-request-id"
]
=
request_func_input
.
request_id
def
_get_headers
(
content_type
:
str
|
None
=
None
)
->
dict
[
str
,
str
]:
headers
=
{}
if
content_type
:
headers
[
"Content-Type"
]
=
content_type
api_key
=
os
.
environ
.
get
(
"OPENAI_API_KEY"
)
if
api_key
:
headers
[
"Authorization"
]
=
f
"Bearer
{
api_key
}
"
return
headers
async
def
async_request_openai_completions
(
request_func_input
:
RequestFuncInput
,
session
:
aiohttp
.
ClientSession
,
...
...
@@ -170,9 +180,7 @@ async def async_request_openai_completions(
}
_update_payload_common
(
payload
,
request_func_input
)
headers
=
{
"Authorization"
:
f
"Bearer
{
os
.
environ
.
get
(
'OPENAI_API_KEY'
)
}
"
,
}
headers
=
_get_headers
()
_update_headers_common
(
headers
,
request_func_input
)
output
=
RequestFuncOutput
()
...
...
@@ -301,10 +309,7 @@ async def async_request_openai_chat_completions(
}
_update_payload_common
(
payload
,
request_func_input
)
headers
=
{
"Content-Type"
:
"application/json"
,
"Authorization"
:
f
"Bearer
{
os
.
environ
.
get
(
'OPENAI_API_KEY'
)
}
"
,
}
headers
=
_get_headers
(
"application/json"
)
_update_headers_common
(
headers
,
request_func_input
)
output
=
RequestFuncOutput
()
...
...
@@ -396,9 +401,7 @@ async def async_request_openai_audio(
}
_update_payload_common
(
payload
,
request_func_input
)
headers
=
{
"Authorization"
:
f
"Bearer
{
os
.
environ
.
get
(
'OPENAI_API_KEY'
)
}
"
,
}
headers
=
_get_headers
()
_update_headers_common
(
headers
,
request_func_input
)
# Send audio file
...
...
@@ -537,10 +540,7 @@ async def async_request_openai_embeddings(
}
_update_payload_common
(
payload
,
request_func_input
)
headers
=
{
"Content-Type"
:
"application/json"
,
"Authorization"
:
f
"Bearer
{
os
.
environ
.
get
(
'OPENAI_API_KEY'
)
}
"
,
}
headers
=
_get_headers
(
"application/json"
)
_update_headers_common
(
headers
,
request_func_input
)
return
await
_run_pooling_request
(
...
...
@@ -576,10 +576,7 @@ async def async_request_vllm_rerank(
"truncate_prompt_tokens"
:
-
1
,
}
headers
=
{
"Content-Type"
:
"application/json"
,
"Authorization"
:
f
"Bearer
{
os
.
environ
.
get
(
'OPENAI_API_KEY'
)
}
"
,
}
headers
=
_get_headers
(
"application/json"
)
_update_headers_common
(
headers
,
request_func_input
)
return
await
_run_pooling_request
(
...
...
@@ -615,10 +612,7 @@ async def async_request_openai_embeddings_chat(
}
_update_payload_common
(
payload
,
request_func_input
)
headers
=
{
"Content-Type"
:
"application/json"
,
"Authorization"
:
f
"Bearer
{
os
.
environ
.
get
(
'OPENAI_API_KEY'
)
}
"
,
}
headers
=
_get_headers
(
"application/json"
)
_update_headers_common
(
headers
,
request_func_input
)
return
await
_run_pooling_request
(
...
...
@@ -721,10 +715,7 @@ async def async_request_infinity_embeddings(
_update_payload_common
(
payload
,
request_func_input
)
headers
=
{
"Content-Type"
:
"application/json"
,
"Authorization"
:
f
"Bearer
{
os
.
environ
.
get
(
'OPENAI_API_KEY'
)
}
"
,
}
headers
=
_get_headers
(
"application/json"
)
_update_headers_common
(
headers
,
request_func_input
)
return
await
_run_pooling_request
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment