BUG: Request header is not properly handled for /v1beta/openai/chat/completions

,

It seems the API endpoint fails to process the host header correctly.

Start an HTTPS request using the following command:

openssl s_client -connect generativelanguage.googleapis.com:443

Working Request:

Paste the following as input:

POST /v1beta/openai/chat/completions HTTP/1.1
Host: generativelanguage.googleapis.com
Authorization: Bearer API_KEY
Content-Type: application/json
Content-Length: 75

{"messages":[{"content":"Hello","role":"user"}],"model":"gemini-2.0-flash"}

Non-Working Request:

Paste the following as input:

POST /v1beta/openai/chat/completions HTTP/1.1
host: generativelanguage.googleapis.com
Authorization: Bearer API_KEY
Content-Type: application/json
Content-Length: 75

{"messages":[{"content":"Hello","role":"user"}],"model":"gemini-2.0-flash"}

It appears that the API endpoint is case-sensitive when processing the Host header, rejecting lowercase variants.

Hi @russellwmy , Welcome to the forum.

Thanks for reporting the bug. I have escalated it to the team

1 Like

Do you have an estimated timeline for that? According to the HTTP/1.1 specification (RFC 7230), HTTP headers are case-insensitive. I’m working in Rust, and I’ve noticed that all HTTP client libraries implement HTTP headers in lowercase.