Benchmark: Support API_KEY without 'bearer' (#10380)

This commit is contained in:
Muqi Li
2025-09-13 07:29:04 +08:00
committed by GitHub
parent 366043db8e
commit d5e2a37414

View File

@@ -105,10 +105,13 @@ def remove_suffix(text: str, suffix: str) -> str:
def get_auth_headers() -> Dict[str, str]:
api_key = os.environ.get("OPENAI_API_KEY")
if api_key:
return {"Authorization": f"Bearer {api_key}"}
openai_api_key = os.environ.get("OPENAI_API_KEY")
if openai_api_key:
return {"Authorization": f"Bearer {openai_api_key}"}
else:
api_key = os.environ.get("API_KEY")
if api_key:
return {"Authorization": f"{api_key}"}
return {}