OpenAIClientOptionsWithAzureAgent interface
Extended OpenAI client options to include Azure Agent endpoint configuration.
- Extends
-
ClientOptions
Properties
| azure |
Azure Agent endpoint configuration. |
Inherited Properties
| admin |
Defaults to process.env['OPENAI_ADMIN_KEY']. |
| api |
API key used for authentication.
|
| baseURL | Override the default base URL for the API, e.g., "https://api.example.com/v2/" Defaults to process.env['OPENAI_BASE_URL']. |
| dangerously |
By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
Only set this option to |
| default |
Default headers to include with every request to the API. These can be removed in individual requests by explicitly setting the
header to |
| default |
Default query parameters to include with every request to the API. These can be removed in individual requests by explicitly setting the
param to |
| fetch | Specify a custom If not provided, we expect that |
| fetch |
Additional |
| logger | Set the logger. Defaults to globalThis.console. |
| log |
Set the log level. Defaults to process.env['OPENAI_LOG'] or 'warn' if it isn't set. |
| max |
The maximum number of times that the client will retry a request in case of a temporary failure, like a network error or a 5XX error from the server. |
| organization | Defaults to process.env['OPENAI_ORG_ID']. |
| project | Defaults to process.env['OPENAI_PROJECT_ID']. |
| timeout | The maximum amount of time (in milliseconds) that the client should wait for a response from the server before timing out a single request. Note that request timeouts are retried by default, so in a worst-case scenario you may wait much longer than this timeout before the promise succeeds or fails. |
| webhook |
Defaults to process.env['OPENAI_WEBHOOK_SECRET']. |
| workload |
Workload identity configuration for OAuth2 token exchange authentication.
Mutually exclusive with |
Property Details
azureConfig
Inherited Property Details
adminAPIKey
Defaults to process.env['OPENAI_ADMIN_KEY'].
adminAPIKey?: null | string
Property Value
null | string
Inherited From OpenAIClientOptions.adminAPIKey
apiKey
API key used for authentication.
- Accepts either a static string or an async function that resolves to a string.
- Defaults to process.env['OPENAI_API_KEY'].
- When a function is provided, it is invoked before each request so you can rotate or refresh credentials at runtime.
- The function must return a non-empty string; otherwise an OpenAIError is thrown.
- If the function throws, the error is wrapped in an OpenAIError with the original
error available as
cause. - Mutually exclusive with
workloadIdentity.
apiKey?: null | string | ApiKeySetter
Property Value
null | string | ApiKeySetter
Inherited From OpenAIClientOptions.apiKey
baseURL
Override the default base URL for the API, e.g., "https://api.example.com/v2/"
Defaults to process.env['OPENAI_BASE_URL'].
baseURL?: null | string
Property Value
null | string
Inherited From OpenAIClientOptions.baseURL
dangerouslyAllowBrowser
By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
Only set this option to true if you understand the risks and have appropriate mitigations in place.
dangerouslyAllowBrowser?: boolean
Property Value
boolean
Inherited From OpenAIClientOptions.dangerouslyAllowBrowser
defaultHeaders
Default headers to include with every request to the API.
These can be removed in individual requests by explicitly setting the
header to null in request options.
defaultHeaders?: HeadersLike
Property Value
HeadersLike
Inherited From OpenAIClientOptions.defaultHeaders
defaultQuery
Default query parameters to include with every request to the API.
These can be removed in individual requests by explicitly setting the
param to undefined in request options.
defaultQuery?: Record<string, undefined | string>
Property Value
Record<string, undefined | string>
Inherited From OpenAIClientOptions.defaultQuery
fetch
Specify a custom fetch function implementation.
If not provided, we expect that fetch is defined globally.
fetch?: Fetch
Property Value
Fetch
Inherited From OpenAIClientOptions.fetch
fetchOptions
Additional RequestInit options to be passed to fetch calls.
Properties will be overridden by per-request fetchOptions.
fetchOptions?: MergedRequestInit
Property Value
MergedRequestInit
Inherited From OpenAIClientOptions.fetchOptions
logger
Set the logger.
Defaults to globalThis.console.
logger?: Logger
Property Value
Logger
Inherited From OpenAIClientOptions.logger
logLevel
Set the log level.
Defaults to process.env['OPENAI_LOG'] or 'warn' if it isn't set.
logLevel?: LogLevel
Property Value
LogLevel
Inherited From OpenAIClientOptions.logLevel
maxRetries
The maximum number of times that the client will retry a request in case of a temporary failure, like a network error or a 5XX error from the server.
maxRetries?: number
Property Value
number
Inherited From OpenAIClientOptions.maxRetries
organization
Defaults to process.env['OPENAI_ORG_ID'].
organization?: null | string
Property Value
null | string
Inherited From OpenAIClientOptions.organization
project
Defaults to process.env['OPENAI_PROJECT_ID'].
project?: null | string
Property Value
null | string
Inherited From OpenAIClientOptions.project
timeout
The maximum amount of time (in milliseconds) that the client should wait for a response from the server before timing out a single request.
Note that request timeouts are retried by default, so in a worst-case scenario you may wait much longer than this timeout before the promise succeeds or fails.
timeout?: number
Property Value
number
Inherited From OpenAIClientOptions.timeout
webhookSecret
Defaults to process.env['OPENAI_WEBHOOK_SECRET'].
webhookSecret?: null | string
Property Value
null | string
Inherited From OpenAIClientOptions.webhookSecret
workloadIdentity
Workload identity configuration for OAuth2 token exchange authentication.
Mutually exclusive with apiKey.
workloadIdentity?: WorkloadIdentity
Property Value
WorkloadIdentity
Inherited From OpenAIClientOptions.workloadIdentity