Skip to content

OpenAiCompatibleModel

Namespace: E2E

public sealed class OpenAiCompatibleModel : IAgentModel, IDisposable

Chat-completions client for OpenAI and any server that speaks the same tool-call JSON. Set BaseUrl to a local server such as http://127.0.0.1:11434/v1. The API key is optional for servers that do not check one. ModelProviders has presets for OpenRouter, the Vercel AI Gateway, SpaceXAI, and Ollama.

Inheritance: object

Implements: IAgentModel, IDisposable

View source

OpenAiCompatibleModel(OpenAiCompatibleModelOptions, HttpClient?)

Section titled “OpenAiCompatibleModel(OpenAiCompatibleModelOptions, HttpClient?)”
public OpenAiCompatibleModel(OpenAiCompatibleModelOptions options, HttpClient? httpClient = null)

Parameters

Name Type Description
options OpenAiCompatibleModelOptions
httpClient HttpClient

View source

public string Name { get; }

Provider and model id, printed in the run summary. Changing it does not miss the replay cache.

Value: string

View source

CompleteAsync(ModelRequest, CancellationToken)

Section titled “CompleteAsync(ModelRequest, CancellationToken)”
public Task<ModelResponse> CompleteAsync(ModelRequest request, CancellationToken cancellationToken)

Parameters

Name Type Description
request ModelRequest
cancellationToken CancellationToken

Returns: Task<ModelResponse>

View source

public void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View source