OpenAIChatClient<T>
Models & Types · AiDotNet.Agentic.Models.Connectors
An IChatClient for OpenAI’s Chat Completions API with native tool calling, streaming,
structured output, and multimodal (image) input.
Inheritance: ChatClientBase<T> → OpenAIChatClient<T>
Known derived types: AzureOpenAIChatClient<T>, MistralChatClient<T>, OllamaChatClient<T>, ReasoningOpenAIChatClient<T>
For Beginners
This is the adapter that lets the rest of the library talk to OpenAI models (GPT-4o and friends) without knowing any OpenAI-specific details.
How It Works
Translates the provider-neutral ChatMessage/ChatOptions model into OpenAI’s
wire format and back, mapping provider strings (roles, finish_reason) onto the library’s enums.
The same wire format is used by Azure OpenAI, so that connector derives from this one.
Constructors
| Constructor | Summary |
|---|---|
OpenAIChatClient(string apiKey, string modelName, string endpoint, HttpClient httpClient) |
Initializes a new OpenAI chat client. |