OpenAiCompatibleBackend
IAiBackend implementation talking the OpenAI Chat Completions wire format. The system/user/assistant message shape is flat (no nested content blocks like Anthropic, no separate systemInstruction like Gemini) and tool calls round-trip through an explicit tool_call_id. Forces tool_choice = "required" so the model cannot answer in prose -- the conversation loop expects every turn to be a tool invocation. This class is provider-neutral: OpenAI and DeepSeek both speak the same schema, differing only in endpoint URL and default model. The caller supplies those at construction.
Constructors
OpenAiCompatibleBackend
#public OpenAiCompatibleBackend()
provider,
Which provider this backend talks to. Used for the Provider property and in error messages.
endpoint,
Full URL of the chat-completions endpoint, e.g.
https://api.openai.com/v1/chat/completions.defaultModel,
Initial value for Model. The caller can override it later.
apiKey
Bearer token passed in the Authorization header.
Properties
TranscriptCallback
#Optional hook invoked with (requestJson, responseBody) after every HTTP exchange, including non-2xx responses and retries. The host uses this to maintain a complete transcript of what was sent and received. Backends must invoke this before throwing on non-success status codes.
Implements: TranscriptCallback