Skip to main content

final class atoti_ai_openai.ConnectionConfig

Configuration for connecting to OpenAI.
This feature is experimental, its key is "ai".

Example

>>> import os
>>> from atoti_ai import AiConfig
>>> from atoti_ai_openai import ConnectionConfig, ChatConfig
>>> with tt.experimental({"ai"}):
...     connection_config = ConnectionConfig(
...         api_key=os.environ["AZURE_OPENAI_API_KEY"],
...         base_url="https://aiwopenai.openai.azure.com/openai/v1",
...     )
...     chat_config = ChatConfig(
...         model="gpt-4.1",
...         temperature=0.0,
...         max_tokens=5000,
...         top_p=0.8,
...     )
...     ai_config = AiConfig(connection=connection_config, chat=chat_config)
See also: The other ConnectionConfig implementations.

api_key : str | None = None

OpenAI API key for authentication.

base_url : str | None = None

Base URL for the OpenAI API. Useful for OpenAI-compatible providers. The path to the API (such as /v1) must be included.

custom_headers : Mapping[str, str] | None = None

Custom HTTP headers to add to every request.

max_retries : int | None = None

Maximum number of retries for requests to OpenAI.

organization_id : str | None = None

OpenAI organization ID.

timeout : timedelta | None = None

Timeout for requests to OpenAI.