# What are environment variables and how do I use them?

> Cube Agent 2.4.1 Release (Build 2004105) User Guide.
> Category: Models & AI. Content baseline: 2026-12-05.
> Web page: https://cubeagent.app/en/docs/assistant_environment_variables/

## Bottom line

An environment variable is a "name + secret value" saved inside a specific assistant. It persists with that assistant; different assistants can define the same variable name with different values without reading or overwriting one another. It is designed for API keys, tokens, and service settings needed by Skills or JavaScript tools—avoiding putting sensitive values directly into chat messages, system prompts, Skill files, logs, or tool results.

## Where to configure it

Open **Assistants → Edit assistant → Prompt → Variables**, and add a variable name, purpose, and value—for example, `SILICONFLOW_API_KEY`. The list can be searched by name or purpose and hides values by default; tap an item to edit, or tap **Insert** to add a reference into the assistant prompt. To reuse variables in other assistants, use the copy feature to create independent copies.

Environment variables **save independently and take effect immediately** without waiting for the assistant's top-right Save button; discarding assistant prompt drafts will not undo saved variables. Unsaved edits to a variable block saving the assistant until you save or cancel the variable draft. New assistants must be saved first before adding environment variables.

## How to use them

- When calling external APIs, reference the current assistant's variable through host-side credential substitution in network requests, or request provider credentials in the code workspace; the app attaches authentication on approved HTTPS targets without exposing plaintext to scripts.
- When an assistant prompt genuinely needs a value directly, write `{{env.SILICONFLOW_API_KEY}}`.

## Are they sent to the model automatically?

No. Merely saving an environment variable never injects its name or value into model context.

However, if you write `{{env.VARIABLE_NAME}}` in a prompt, it is replaced with the live value before sending—**which sends that value to the current model provider**. Secrets should generally not be passed to models through prompts; prefer host-side credential substitution for API calls. `process.env` is empty by default—never print, write to files, or return sensitive values.

## Backup and export

Environment variables are included with selected assistants in full backups, assistant exports, and Nearby Transfer—including for sharing—and keys are not stripped automatically. Because exported files contain plaintext credentials, store them only in trusted locations or share them only with trusted recipients; deselect that assistant if you do not want to share them, and never attach such export packages to feedback tickets. If credentials cannot be read, the entire export stops.

## Environment variables vs. prompt variables

- Prompt variables such as `{{current_date}}` and `{{current_clock}}` are generated by the app for dates and times.
- Assistant environment variables are saved by you to store external service settings and secrets.
- `process.env` in the code workspace is empty by default; external API authentication uses host-side credential substitution. `{{env.KEY}}` inserts the real value into the prompt and sends it to the model.
