set_ai_route
Create or replace an AI gateway alias that lets apps route model requests through the gateway and keeps provider keys out of containers.
Instructions
Create or replace a machine AI gateway alias (submitter or admin).
Apps then declare ``[ai.default] provider = "gateway"`` and
``model = "<alias>"``: the daemon injects the gateway URL and a per-app
virtual key, and the provider key never enters a container. Answers
``enabled: false`` while ``[ai_gateway]`` is off (the alias is stored
and serves once it is enabled). Refusals: 422 ``ai_gateway.alias_invalid``,
``ai_gateway.base_url_invalid`` (not https, private address, userinfo),
``ai_gateway.secret_ref_invalid``.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alias | Yes | Machine alias an app names in ``[ai.<name>] model`` with ``provider = "gateway"``: a lowercase letter, then up to 31 of a-z, 0-9, '_' or '-'. | |
| model | Yes | Provider model the alias maps to (an ollama model name for provider 'ollama'). | |
| base_url | No | Provider ``api`` only: OpenAI-compatible base URL, usually ending in ``/v1``; https to a public host, or http to loopback or the models bridge. | |
| provider | No | ``api`` (an OpenAI-compatible provider) or ``ollama`` (a model served on this machine). | api |
| api_key_ref | No | Provider ``api`` only: a ``${secrets.shared.KEY}`` reference to the provider key, set beforehand with ``set_secret`` on scope ``shared``. Never the key itself. | |
| idempotency_key | No | Caller-chosen key: a retry with the same key replays the first result instead of acting twice. Omit and a fresh key is minted per call, so each call acts. |