# OpenAiCompatibleBackend class

Namespace: [Grasshopper2.Components.Descriptive](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.components.descriptive.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public sealed class OpenAiCompatibleBackend : IAiBackend
```

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](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.openaicompatiblebackend/ctor.md)

## Properties

- [MaxRetries](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.openaicompatiblebackend/maxretries.md): Maximum number of automatic 429/503 retries before giving up.
- [MaxTokens](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.openaicompatiblebackend/maxtokens.md): Maximum tokens the model may produce in a single turn.
- [Model](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.openaicompatiblebackend/model.md): Model identifier passed to the API.
- [Provider](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.openaicompatiblebackend/provider.md)
- [TranscriptCallback](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.openaicompatiblebackend/transcriptcallback.md): 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.

## Methods

- [Generate](https://developer.rhino3d.com/api/gh2/type/grasshopper2.components.descriptive.openaicompatiblebackend/generate.md)
