AI Open SDKfor Business Central

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 nameAI Open SDK OpenCode Zen
Factory"AIOS OpenCode Zen"
Provider idopencode-zen
TextYes (/chat/completions)
ImageNo
Default base URLhttps://opencode.ai/zen/v1
AuthAPI key from opencode.ai/auth

Dependencies

Your extension depends on:

  1. AI Open SDK (core)
  2. 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

GenerateText.al
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

ProcedureBehavior
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.

On this page