Skip to main content
The ONR DSL is intentionally declarative, meaning there is no Turing-complete scripting language embedded. However, you can use built-in variables to dynamically construct paths, headers, and keys.

Expression Contexts

In positions where the DSL requires an <expr>, you can use:
  1. String Literal: "abc"
  2. Variable: $channel.key
  3. Function: concat("Bearer ", $channel.key)
Note: Variables are only evaluated when used as bare expressions. If you wrap them in double quotes (e.g., "$channel.key"), they are treated as plain string literals and will not be expanded.

Built-in Variables

These variables are populated at runtime dynamically for every request.

channel.* context

  • $channel.base_url: The channel base URL (string). Overrides upstream_config.base_url if set by the API caller.
  • $channel.key: The downstream API key/token (string) meant to be passed to the upstream provider.
  • $channel.location: The provider location or region attached to the selected upstream key, such as global or us-central1.

credential.* context

  • $credential.project_id: The project id parsed from the active credential. For Google service account files, this is the JSON project_id.

request.* context

  • $request.model: The original requested model name from the upstream JSON body.
  • $request.model_mapped: The transformed model name, determined after any model_map operations fire.

Expression Examples