> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Command: secret

> Manage encrypted secrets for training jobs and inference endpoints

The `flexai secret` command allows for the management of Secrets using the FlexAI Secret Manager.

Secrets are encrypted at rest and are only made available to Workload Runtimes as system *environment variables*.

Any number of Secrets can be passed on to a Training Job using the `-S`/`--secret` flag:

```bash {4,5} theme={null}
flexai training run test-training-123 \
  --dataset open_web \
  --repository-url https://github.com/flexaihq/nanoGPT/ \
  --secret HF_TOKEN=hf_token_dev \
  --secret WANDB_API_KEY=wandb-key \
  -- train.py ...
```

The same way Secrets can be passed to when creating an Inference Endpoint using the `--hf-token-secret` or `--api-key-secret` flags:

```bash {2,3} theme={null}
flexai inference serve llm-text-inference-prod \
  --hf-token-secrethf_token_prod \
  --api-key-secret api-key-prod \
  -- --model=mistralai/Mistral-7B-Instruct-v0.1 ...
```

Commands that leverage the FlexAI Secret Manager include:

* [`flexai training run`](/cli/reference/training/run) - Starts a new Training Job.
* [`flexai inference serve`](/cli/reference/inference/serve) - Creates an Inference Endpoint.
* [`flexai storage create`](/cli/reference/storage/create) - Creates a new Remote Storage Provider Connection.

## Available subcommands

* [`flexai secret create`](/cli/reference/secret/create) - Creates and stores a new secret in the FlexAI Secret Manager.
* [`flexai secret delete`](/cli/reference/secret/delete) - Deletes an existing secret from the FlexAI Secret Manager.
* [`flexai secret list`](/cli/reference/secret/list) - Lists all the secrets that have been created.
