OpenAI

fun OpenAI(token: String, logging: LoggingConfig = LoggingConfig(), timeout: Timeout = Timeout(socket = 30.seconds), organization: String? = null, headers: Map<String, String> = emptyMap(), host: OpenAIHost = OpenAIHost.OpenAI, proxy: ProxyConfig? = null, retry: RetryStrategy = RetryStrategy(), httpClientConfig: HttpClientConfig<*>.() -> Unit = {}): OpenAI

Creates an instance of OpenAI.

Parameters

token

secret API key

logging

client logging configuration

timeout

http client timeout

headers

extra http headers

organization

OpenAI organization ID

host

OpenAI host configuration.

proxy

HTTP proxy url

retry

rate limit retry configuration

httpClientConfig

additional custom client configuration


fun OpenAI(config: OpenAIConfig): OpenAI

Creates an instance of OpenAI.

Parameters

config

client config