Skip to content

OpenAI adapter passes timeout to SDK without unit conversion (seconds vs milliseconds) #12450

@ScrewTSW

Description

@ScrewTSW

requestOptions.timeout is documented as a timeout value and users naturally set it in seconds (e.g. timeout: 300 for 5 minutes). However, packages/openai-adapters/src/apis/OpenAI.ts passes this value directly to the OpenAI JS SDK constructor, which expects milliseconds.

A user setting timeout: 300 gets a 300ms timeout instead of 300 seconds, causing immediate "Connection error" failures, especially with local models that need time to load and process prompts.

Location: packages/openai-adapters/src/apis/OpenAI.ts line 48:

timeout: config?.requestOptions?.timeout || undefined,

The OpenAI SDK default is 600000 (10 minutes in ms). When a user sets timeout: 300, it becomes 300ms - 2000x shorter than intended.

This is likely a root cause for many reports in #11818. See also #11954 where a user sets timeout: 1200 thinking it's seconds.

Fix: multiply by 1000 before passing to the SDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:integrationIntegrations (context providers, model providers, etc.)javascriptPull requests that update Javascript codekind:bugIndicates an unexpected problem or unintended behavior

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions