Closed
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
Type error when configuring fetchOptions
of new OpenAI
instance
Type '{ dispatcher: ProxyAgent; }' is not assignable to type 'undefined'.ts(2322)
client.d.mts(64, 5): The expected type comes from property 'fetchOptions' which is declared here on type 'ClientOptions'
(property) ClientOptions.fetchOptions?: undefined
Additional RequestInit options to be passed to fetch calls. Properties will be overridden by per-request fetchOptions.
To Reproduce
- Follow "Configuring proxies" from README https://github.com/openai/openai-node?tab=readme-ov-file#configuring-proxies
- Observe TypeScript errors
Code snippets
import OpenAI from 'openai';
import * as undici from 'undici';
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
const client = new OpenAI({
fetchOptions: {
dispatcher: proxyAgent,
},
});
OS
Windows
Node version
Node v22.12.0
Library version
openai v5.7.0