Skip to content

TypeScript Type Issues in OpenAI Node.js SDK v4.88.0. Headers Type Mismatch. #1405

@JustSmileGG

Description

@JustSmileGG

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

I am encountering TypeScript type issues with the OpenAI Node.js SDK version 4.88.0. The main issues are:

  1. Headers Type Mismatch:
Type '{ [x: string]: string; } | { append(name: string, value: string): void; delete(name: string): void; get(name: string): string; getSetCookie(): string[]; has(name: string): boolean; set(name: string, value: string): void; forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void; }' is not assignable to type 'Record<string, string>'.

Environment

  • Node.js version: >=22.11.0
  • TypeScript version: ^5.8.2
  • OpenAI SDK version: 4.88.0
  • NestJS version: 11.0.5

Additional Context

  • I am using the SDK in a NestJS application
  • The issues occur during the build process
  • I have skipLibCheck: true in the tsconfig.json.

To Reproduce

Steps to Reproduce

  1. Create a new NestJS project
  2. Install OpenAI SDK v4.88.0
  3. Create a service that uses the OpenAI client
  4. Try to use the chat completions API with proper typing

Code snippets

private openAIClient = new OpenAI({ apiKey: process.env.OPENAI_API_KEY })

OS

macOS

Node version

v22.11.0

Library version

"openai": "^4.88.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions