auth¶
Configure authentication tokens and manage profiles. Each profile stores credentials for a different project or environment.
Examples¶
# Save a token (secure prompt, no echo)
contree auth
# Save to a named profile
contree auth --profile=personal
# Force overwrite existing profile
contree auth -y
# List all profiles and probe whether they work
contree auth ls
# Structured output for scripts and agents
contree -f json auth ls
# List profiles without network probes
contree auth ls --offline
# Switch active profile
contree auth switch personal
# Remove a profile
contree auth remove personal
contree auth rm personal -y
Help output¶
Behavior¶
When you run contree auth, the CLI:
Prompts for the token securely via
getpass(no echo, not stored in shell history)Prompts for the project ID
Verifies the token with the API (
GET /v1/whoami)Writes credentials to
~/.config/contree-cli/config.iniIf the profile already exists, prompts for confirmation (use
-yto skip)
Flags¶
--token— API token (prompted securely if omitted)--url— API base URL (default:https://api.studio.nebius.com/sandboxes)--project— Project ID (prompted if omitted)--profile— Profile name (default:default)-y/--force— Overwrite existing profile without confirmation
Environment variable shortcuts¶
When CLI flags (--token, --project) are not passed, contree auth
checks these environment variables before falling back to an interactive
prompt:
Variable |
Fallback for |
Priority |
|---|---|---|
|
|
flag > env > prompt |
|
|
flag > env > prompt |
If both variables are set, contree auth runs fully non-interactively
(no prompts):
export NEBIUS_API_KEY=eyJ...
export NEBIUS_AI_PROJECT=your-project-id
contree auth -y # no prompts, saves immediately
auth ls status column¶
contree auth ls verifies each saved profile against the API
with a 2-second timeout and adds a status column.
Possible values:
ok– probe succeededtimeout– probe did not complete within 2 secondserror– probe failed for another reason, such as a bad token or another network/API erroroffline– you passed--offline, so no probe was attempted
Use contree auth ls --offline when you want to inspect saved
profiles without any network traffic.
For automation and agents, prefer:
contree -f json auth ls
contree -f json auth ls --offline
auth remove¶
Delete a saved profile from the config file.
contree auth remove personal
contree auth rm personal # alias
contree auth del personal -y # skip confirmation
If the removed profile was active, the CLI switches to the first
remaining profile (or default if none remain).
Warning
Avoid --token=eyJ... on the command line — the token is visible in
process listings (ps) and shell history. Omit --token to use the
secure prompt instead.
Alternative authentication¶
You can also authenticate without the config file:
# Environment variable (avoid in shared environments)
export CONTREE_TOKEN=eyJ...
# Inline flag (per-command, visible in process listings)
contree --token=eyJ... images
See also¶
Install & Authenticate – full authentication guide
Configuration & Profiles – config file format and precedence