Skip to content

Model & Routing

Copy page

The first group of Release settings: which model answers, what happens when it doesn’t, which languages it advertises, and how its traffic is routed.

SettingFieldIn the SDK?
Assistant modelassistantvia updateInWorkspace
Fallback chainfallbackAssistants
LanguagessupportedLanguages
AI GatewayaiGateway
Context cachecontextCache

assistant is a { id, finetune } reference to a model from the catalog — over a hundred base and fine-tuned options across providers. Browse them in Model Catalog; training your own is Fine-tuning.

An ordered chain the Release falls through to when the primary model returns a retryable failure. First success wins.

await divinci.releases.updateInWorkspace(workspaceId, releaseId, {
fallbackAssistants: [
{ id: "@cf/meta/llama-4-scout", finetune: false },
{ id: "gemini-3-5-flash", finetune: false },
],
});

Retryable means a provider 429, a 5xx, a capacity or quota error, or a timeout — the transient class. A refusal, a malformed prompt, or a content filter is not retryable and does not fail over: those would fail identically on the next model, so retrying would only cost more.

Which languages the Release advertises and will answer in. Unset, the set is derived from the model — the platform knows roughly what each family handles:

TierSizeApplies to
All 36full platform setGemini family
Major (~19)major world languagesLarge open models — Llama 4, Llama 3.3 70B, Qwen3 30B, GLM-4, Kimi K2, Mistral Small, SEA-Lion…
Core (~9)en es fr de pt it zh-hans ja koSmall models (≤~20B) and anything unrecognised

Matching is a substring test on the lowercased model id, so it tolerates provider prefixes and version suffixes. Lock the set explicitly with custom:

await divinci.releases.updateInWorkspace(workspaceId, releaseId, {
supportedLanguages: { mode: "custom", codes: ["en", "es", "fr"] },
});

Codes are BCP-47 (es, zh-hans). The resolved set drives two things: the server-side response-language allowlist — a language request outside the set is ignored — and the language switcher your client renders.

Routes model traffic through a Cloudflare AI Gateway for analytics, rate limiting, and caching. It does not change how the model answers — same model, same prompt, same output; only the path differs.

await divinci.releases.updateInWorkspace(workspaceId, releaseId, {
aiGateway: { enabled: true, useDefaultGateway: true },
});
FieldDefaultPurpose
enabledfalseMaster switch
useWhiteLabelDefaultsInherit the workspace’s gateway settings — the “use workspace defaults” checkbox
useDefaultGatewaytrueUse Divinci’s gateway (divinci-ai-gateway)
gatewayIddivinci-ai-gatewayYour own gateway id when useDefaultGateway is false
customAccountIdYour Cloudflare account id, for a BYO gateway
cacheTtlSeconds3600Sent as cf-aig-cache-ttl; bounds how stale a gateway cache hit can be

Leave useWhiteLabelDefaults on unless this Release specifically needs different routing from the rest of the workspace — that inheritance is what keeps gateway configuration in one place.

Cost control, not behaviour: implicit caching is free and on by default, and for most Releases needs no attention. Explicit mode adds a TTL you control and can cut input-token cost substantially on repeated prompts — worth reaching for once you have real volume, not before. Full detail in Caching & Performance.

  • A fallback chain is not a failover for bad output. It fires on transport and capacity errors only. A model that answers badly answers badly.
  • Every fallback entry should be a model you would be happy to serve. There is no quality gate between them — position in the array is the whole policy.
  • Languages are advertised, not enforced on the model. The allowlist governs what your client offers and what the server accepts as a language request; it cannot stop a model replying in something else if asked to in the prompt.
  • The gateway is observability, not a safety net. Enabling it does not add retries or failover — that is fallbackAssistants.