gpu.aiDocs
UPDATED 2026.11.18READ 5 MINEDIT ON GITHUB →
CH·23Account

Secrets.

Store an API key or token once for your organization, then name it when you launch. The machine receives it as an environment variable with the same name.

§ 22.1How values are kept

Each value is encrypted with its own data key, and that key is encrypted by a key held in AWS KMS, which never leaves KMS. After you save a value it is never shown again: the console, the API, and the CLI return names and metadata only. A machine fetches its secrets over HTTPS with its own instance token when it starts, so values are not written into startup scripts or supplier settings. Every save, replacement, deletion, and delivery is recorded in your organization's activity log, with the name and what received it, never the value.

§ 22.2Save a secret

In the console, open Secrets and choose New secret. From the CLI, the value is read from a prompt, never from the command line:

SHELL
gpu secrets set HF_TOKEN
gpu secrets list

Or with the API:

SHELL
curl -X POST https://api.gpu.ai/v1/secrets \
  -H "Authorization: Bearer $GPUAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "HF_TOKEN", "value": "hf_...", "description": "read token"}'

A name is the environment variable name: letters, digits, and underscores. Names starting with GPUAI_ and a few the machine needs itself, such as PATH, are refused. PUT /v1/secrets/NAME replaces a value. Machines started afterwards get the new value.

§ 22.3Use it at launch

INSTANCES
gpu instances create --gpu rtx_4090 --secret HF_TOKEN
# API: "secrets": ["HF_TOKEN"] on POST /v1/instances
FUNCTIONS
from gpuai_sdk.functions import function

@function(gpu="l4", secrets=["HF_TOKEN"])
def generate(prompt):
    import os
    token = os.environ["HF_TOKEN"]
    ...
JOBS
gpu jobs submit --image python:3.12 --gpu l4 --secret WANDB_API_KEY -- python train.py
# API: "secrets": ["WANDB_API_KEY"] on POST /v1/jobs

A launch that names a secret your organization does not have is refused before anything starts. On an instance, secrets are also loaded in login shells, so they are there when you connect with SSH.

§ 22.4Import from a .env file or Infisical

Paste a .env file or an Infisical export into Import on the Secrets page, or use the CLI. Existing secrets are skipped unless you ask to replace them.

SHELL
gpu secrets import --file .env
infisical export --env=prod --format=json > secrets.json
gpu secrets import --file secrets.json --overwrite
rm secrets.json

§ 22.5Who can change secrets

In the console, organization admins create, replace, and delete secrets, and every member can see the names. With the API, keys that can launch instances can manage secrets.