Creates a new instance of OpenAI class with custom configuration.
The instance contains the same properties as the openai namespace.
create(configuration?)
configuration optional
An object containing:
baseURL optional
The base URL for OpenAI API (defaults to https://api.openai.com/v1/)
apiKey optional
An API key (StoredKey or string) or a function returning the API key.
(defaults to StoredKey("OpenAI")). It is
strongly recommended to use StoredKey for passing and storing secret keys. For example, you can create a key “AnotherOpenAIKey” and set the apiKey parameter to StoredKey("AnotherOpenAIKey").
organization optional
The name of the organization for your account.
An instance of OpenAI class.
const myapi = openai.create({ organization: "My org" })
myapi.listModels()