Osy#the first language built for agents
Agents firstAgentic appsWorkflowsDurable Execution — built inSecurityTestingThe editorThe UI modelOne program

Reference / Agent

default LLM model (app.DefaultModel)

app.DefaultModel = new LlmConfig { Provider = LlmProvider.Anthropic, Model = "…", ApiKey = Secret.X };

Declares the app's default LLM — the provider, model, API-key secret, and optional endpoint — as a single app-level config. `Provider` is one of `LlmProvider.Anthropic | OpenAI | Gemini | OpenAICompatible`; the API key is a `Secret.X` handle declared in `app.Secrets`. A singleton: declaring it twice is a compile error, and removing it clears the default.

preview1 example compiled by CIagentllmconfigprovider

Summary#

app.DefaultModel declares the application's default large-language model as one app-level config block. You name a provider, a model string, the API key (a Secret.X handle), and an optional custom BaseUrl. It is a per-app singleton — declared once — and it self-reconciles against source: removing it clears the default.

app.Secrets = [ new Secret("Anthropic") ];
app.DefaultModel = new LlmConfig {
  Provider = LlmProvider.Anthropic,
  Model    = "claude-opus-4-8",
  ApiKey   = Secret.Anthropic,
};

Signature#

app.Secrets = [ new Secret("Anthropic") ];   // the handle the config below reads

app.DefaultModel = new LlmConfig {
  Provider = LlmProvider.Anthropic,   // Anthropic | OpenAI | Gemini | OpenAICompatible
  Model    = "claude-opus-4-8",       // the provider's model id
  ApiKey   = Secret.Anthropic,        // a handle declared in app.Secrets
  BaseUrl  = "https://api.anthropic.com",  // optional — required for OpenAICompatible
};

A single app-level assignment. It is a singleton — declaring it twice is a compile error.

Description#

LlmConfig has four members:

  • Provider — a qualified LlmProvider enum member. Anthropic, OpenAI, and Gemini are first-party providers reached at their default endpoints. OpenAICompatible targets any OpenAI-wire-compatible server (a self-hosted model, a proxy, or an OpenRouter-style gateway) and requires a BaseUrl.
  • Model — the provider's model identifier (e.g. claude-opus-4-8, gpt-4o, gemini-2.5-flash).
  • ApiKey — a Secret.X handle. The secret must be declared in app.Secrets; the key is resolved at runtime from the secret store and never inlined in source.
  • BaseUrl (optional) — a custom endpoint. Optional for the first-party providers (they default to their own endpoints); required for OpenAICompatible.

Because it self-reconciles against source, the config behaves like a switch: declaring it upserts the singleton, removing it sweeps the row and clears the app default (no prune step needed). Every LLM call the platform makes on your behalf is metered against your budget regardless of which provider you choose.

Examples#

Point the app at an OpenAI-compatible endpoint you host yourself — OpenAICompatible plus a BaseUrl:

app.Secrets = [ new Secret("LocalLlm") ];
app.DefaultModel = new LlmConfig {
  Provider = LlmProvider.OpenAICompatible,
  Model    = "llama-3.1-70b",
  ApiKey   = Secret.LocalLlm,
  BaseUrl  = "https://llm.internal.example.com/v1",
};

See also#

  • [Searchable][Searchable], the field-search surface; semantic ranking uses the app embedding configured the same way

Related

[Searchable]

Mark a text field searchable. `[Searchable]` gives a String or Markdown property the best relevance search the app can…