OpenAIConfig

constructor(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(), engine: HttpClientEngine? = null, httpClientConfig: HttpClientConfig<*>.() -> Unit = {})

Parameters

token

OpenAI Token

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

engine

explicit ktor engine for http requests.

httpClientConfig

additional custom client configuration


constructor(token: String, logLevel: LogLevel = LogLevel.Headers, logger: Logger = Logger.Simple, timeout: Timeout = Timeout(socket = 30.seconds), organization: String? = null, headers: Map<String, String> = emptyMap(), host: OpenAIHost = OpenAIHost.OpenAI, proxy: ProxyConfig? = null, retry: RetryStrategy = RetryStrategy(), engine: HttpClientEngine? = null, httpClientConfig: HttpClientConfig<*>.() -> Unit = {})

Deprecated

Use primary constructor with LoggingConfig instead.

Replace with

import com.aallam.openai.api.logging.Logger
import com.openai.config.LoggingConfig
OpenAIConfig(token, LoggingConfig(logLevel, logger), timeout, organization, headers, host, proxy, retry)