Osy#betaa language · its runtime Osyrin · a hosted platform
Why Osy#Built for agentsAgents as declarationsWorkflows that waitRuns exactly onceSecure by defaultNothing to mockThe editor is the compilerUI in the languageDocuments are dataOne program

Reference / Config

declaring secrets (app.Secrets)

app.Secrets = [ new Secret("Name") [{ UserScoped = true }] ];

`app.Secrets` declares the named secrets your app uses — API keys, tokens, client secrets. Each is `new Secret("Name")`, optionally `{ UserScoped = true }` for a per-user secret rather than one app-wide value. Everything else references a secret by its `Secret.Name` handle — `app.DefaultModel`'s `ApiKey`, an OAuth client's `ClientSecret`. A secret's VALUE is never in source, only its name; the value lives in the secret store.

stable2 examples compiled by CIconfigsecretssecurity

Summary#

app.Secrets declares the named secrets your application consumes — a provider's API key, an access token, an OAuth client secret. You declare a secret's name here; you never write its value in source.

Not the API key of an API your app PUBLISHES. That is a different direction and a different mechanism: a published app.Apis route gated Auth = new ApiAuth { ApiKey = true } is authenticated by a per-user key kept on the app's [Principal] row, and nothing in ApiAuth names a Secret. See publishing a REST API (app.Apis).

Each secret is new Secret("Name"), and optionally { UserScoped = true } to make it a per-user secret rather than a single app-wide value. Every other config slot that needs a secret refers to it by its Secret.Name handle rather than by an inline string.

app.Secrets = [
  new Secret("OpenAI"),
  new Secret("PersonalToken") { UserScoped = true },
];

Signature#

app.Secrets = [                              // one entry per named secret
  new Secret("Anthropic"),                            // app-wide: one value for the whole app
  new Secret("CalendarToken") { UserScoped = true },  // per-user: each user supplies their own value
];

// referenced elsewhere by handle, never by literal value:
app.DefaultModel = new LlmConfig { ApiKey = Secret.Anthropic };

app.Secrets is a list — an app may declare as many named secrets as it needs.

Description#

Each entry is a new Secret("Name"), where the name is a string literal. That name is the only thing that lives in source. The secret's actual value — the key, token, or password — is never written in your app; it lives in the secret store and is supplied separately. On your own machine you supply it with osy secret set (Giving a secret its value); a deployed app's values are supplied by whoever operates its platform.

  • new Secret("Name") — declares an app-wide secret. There is one value, shared by the whole application, used for every request regardless of who makes it (for example, one server-side API key for a provider).
  • { UserScoped = true } — makes the secret per-user instead. Every user of the app supplies their own value, and the secret resolves to the value belonging to the current user. Use this when the credential belongs to the person, not the app (for example, a user's personal access token).

Once declared, a secret is referenced everywhere else by its Secret.Name handle — not by re-typing the name as a string and never by the value. app.DefaultModel's ApiKey, an OAuth client's ClientSecret, and a REST API's key all take a Secret.Name handle. The handle is how the platform links a config slot to the stored value at runtime while keeping the value itself out of your source.

Examples#

Declare an app-wide secret and reference it from the default model's ApiKey:

app.Secrets = [ new Secret("OpenAI") ];

app.DefaultModel = new LlmConfig {
  Provider = LlmProvider.OpenAI,
  Model    = "gpt-4o",
  ApiKey   = Secret.OpenAI,
};

A per-user secret — each user supplies their own value:

app.Secrets = [ new Secret("PersonalToken") { UserScoped = true } ];

See also#

Related

reading a secret's value (Secret.Name)

`Secret.Name` in a function body evaluates to the declared secret's value — the key itself, as a string, read at the…

Giving a secret its value

Declaring `app.Secrets` names a secret; it does not give it a value, and an app cannot run until something does. `osy…

OAuth clients (app.OAuthClients)

`app.OAuthClients` declares the third-party OAuth providers your app uses — for signing users in (Login) and for…

default LLM model (app.DefaultModel)

Declares the app's default LLM — the provider, model, API-key secret, and optional endpoint — as a single app-level…

publishing a REST API (app.Apis)

`app.Apis` publishes your app to a third party over HTTP. You never write a controller or an endpoint handler — you…