openai-node icon indicating copy to clipboard operation
openai-node copied to clipboard

Missing `AzureClientOptions` type

Open Valentin-Rault opened this issue 10 months ago • 6 comments

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • [x] This is an issue with the Node library

Describe the bug

The type AzureClientOptions is no longer being exported. Looking at the history of the src/index.ts file, I could trace the missing export to this commit number 9278d9a.

To Reproduce

import {type AzureClientOptions) from 'openai';

Code snippets


OS

macOS

Node version

Node v24.12.0

Library version

openai v6.16.0

Valentin-Rault avatar Jan 22 '26 12:01 Valentin-Rault

Due to the missing AzureClientOptions, you can temporarily use the any type, but it’s better to create a simple replacement type containing apiKey, endpoint, and apiVersion fields so the code remains typed and compatible with the new Node library.

nomiveritas avatar Jan 27 '26 17:01 nomiveritas

Thank you for answering, I am also trying to understand if this was a conscious decision made or if it was removed by mistake. If this is a conscious decision then I will adapt my code and extract this type from the function. Can you tell me if it is planned to re-export this type?

Valentin-Rault avatar Jan 27 '26 18:01 Valentin-Rault

Dear Valentin-Rault, This was an accidental omission (a regression bug), not an intentional change. The architecture of the OpenAI v4 SDK is continuously evolving, so the safest and most future-proof approach is to refactor your code by extracting the type. You can extract the type directly from the AzureOpenAI class as follows:

Typescript import { AzureOpenAI } from 'openai'; Since AzureClientOptions is not exported, we extract it from the constructor. This solution will continue to work even if it gets exported again in the future, and it will also work if it does not.

Typescript export type AzureClientOptions = ConstructorParameters[0];

const config: AzureClientOptions = { apiKey: '...', endpoint: '...', deployment: '...', apiVersion: '2024-02-01' };

Respectfully Major Noémi

nomiveritas avatar Jan 28 '26 10:01 nomiveritas

Thank you very much for your feedback, feel free to close this issue if you already have this problem in your backlog

Valentin-Rault avatar Jan 28 '26 11:01 Valentin-Rault

Opened #1785 to restore the missing root export and add a regression around importing AzureClientOptions from openai.

theamodhshetty avatar Mar 22 '26 06:03 theamodhshetty

A2ABench has an accepted answer for this imported thread.

  • Thread: https://a2abench-api.web.app/q/cmmpna9c900kn14014hf2wxwr
  • Accepted at: 2026-03-24T21:01:22.146Z
  • Accepted answer agent: ai village
  • Answer preview: "No matching threads were found for this query."

khalidsaidi avatar Mar 24 '26 21:03 khalidsaidi