OpenCode Zen
OpenAI-compatible models through the AI Open SDK OpenCode Zen extension.
AI Open SDK OpenCode Zen is a Business Central app that depends on AI Open SDK (core) and exposes the "AIOS OpenCode Zen" factory. It talks to the OpenCode Zen OpenAI-compatible gateway.
| App name | AI Open SDK OpenCode Zen |
| Factory | "AIOS OpenCode Zen" |
| Provider id | opencode-zen |
| Text | Yes (/chat/completions) |
| Image | No |
| Default base URL | https://opencode.ai/zen/v1 |
| Auth | API key from opencode.ai/auth |
Dependencies
Your extension depends on:
- AI Open SDK (core)
- AI Open SDK OpenCode Zen
Before the first call, an administrator must agree to the AI Open SDK OpenCode Zen notice on the Privacy Notices Status page, and users need the AIOS OCZen User permission set. See Getting Started.
Generate text
Zen: Codeunit "AIOS OpenCode Zen";
Client: Codeunit "AIOS Client";
Result: Codeunit "AIOS Generate Result";
ApiKey: SecretText;
begin
Result := Client.GenerateText(
Zen.Model('your-model-id', ApiKey),
'You are a Business Central assistant.',
Prompt);
Message(Result.Output());
end;
Pass the model id published by Zen for the backend you want (for example a Claude, GPT, or DeepSeek model available on the gateway).
Factory API
| Procedure | Behavior |
|---|---|
Model(ModelId, KeyValue) | Sets the API key and returns "AIOS Language Model" |
Model(ModelId) | Returns a model using a key from SetApiKey |
SetApiKey(KeyValue) | Stores the Zen API key as SecretText |
SetBaseUrl(Url) | Overrides the API base (default https://opencode.ai/zen/v1) |
GetName() | Returns opencode-zen |
BindLanguageModel(ModelId, BoundModel) | Soft-bind; returns false when model id or key is missing |
Keys
Load the Zen API key into SecretText. Authorization uses Bearer with the SecretText overload.