Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
Bug Description
The SDK throws a fatal error Header name must be a valid HTTP token ["openaı-organization"] on systems running with a Turkish OS locale (e.g., Windows set to Turkish language).
Exact Root Cause
The issue stems directly from src/internal/headers.ts (Line 77):
const lowerName = name.toLowerCase();
When the internal Stainless API engine passes header keys like "OpenAI-Organization" or "OpenAI-Project", JavaScript's standard .toLowerCase() on a Turkish locale converts the uppercase I to a dotless ı, turning the keys into "openaı-organization" and "openaı-project". Since ı is a non-ASCII character, the underlying Node.js network layer (undici/http) fails validation and terminates the process.
Temporary Workaround (Proven to Work)
As a temporary hotfix, manually modifying the packaged bundle (e.g., extension.js in IDE extensions) and changing the literal definitions from camelCase to strict lowercase entirely prevents this bug:
- Change
"OpenAI-Organization" to "openai-organization"
- Change
"OpenAI-Project" to "openai-project"
By declaring them lowercase from the start, we bypass the need for runtime normalization which triggers the Turkish I-problem.
Suggested Official Fix
To ensure locale-invariant header normalization, replace the standard .toLowerCase() with a locale-safe conversion in headers.ts:
const lowerName = name.toLocaleLowerCase('en-US');
To Reproduce
- Set the operating system language/locale to Turkish (tr-TR).
- Install the openai-node library.
- Attempt to initialize the client and make an API request using a third-party proxy provider (e.g., OpenRouter) that passes through header builders.
- The system throws a fatal token validation error due to "openaı-organization".
Code snippets
OS
Windows (with Turkish locale / tr-TR)
Node version
Managed internally by Continue IDE extension
Library version
Latest version bundled inside Continue IDE extension
Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
Bug Description
The SDK throws a fatal error
Header name must be a valid HTTP token ["openaı-organization"]on systems running with a Turkish OS locale (e.g., Windows set to Turkish language).Exact Root Cause
The issue stems directly from src/internal/headers.ts (Line 77):
When the internal Stainless API engine passes header keys like
"OpenAI-Organization"or"OpenAI-Project", JavaScript's standard.toLowerCase()on a Turkish locale converts the uppercaseIto a dotlessı, turning the keys into"openaı-organization"and"openaı-project". Sinceıis a non-ASCII character, the underlying Node.js network layer (undici/http) fails validation and terminates the process.Temporary Workaround (Proven to Work)
As a temporary hotfix, manually modifying the packaged bundle (e.g.,
extension.jsin IDE extensions) and changing the literal definitions from camelCase to strict lowercase entirely prevents this bug:"OpenAI-Organization"to"openai-organization""OpenAI-Project"to"openai-project"By declaring them lowercase from the start, we bypass the need for runtime normalization which triggers the Turkish I-problem.
Suggested Official Fix
To ensure locale-invariant header normalization, replace the standard
.toLowerCase()with a locale-safe conversion inheaders.ts:To Reproduce
Code snippets
OS
Windows (with Turkish locale / tr-TR)
Node version
Managed internally by Continue IDE extension
Library version
Latest version bundled inside Continue IDE extension