For the complete documentation index, see llms.txt. This page is also available as Markdown.

Environment Variables

Environment variables read by the Roboflow CLI and Python SDK.

The Roboflow CLI and Python SDK read a small set of environment variables. Setting them in your shell or CI environment removes the need to pass credentials and configuration on every command.

ROBOFLOW_API_KEY

Your Roboflow API key. Used by:

  • CLI - every command falls back to this when --api-key / -k isn't passed.

  • Python SDK - roboflow.Roboflow() (with no arguments) and most adapter functions read this when no explicit key is provided.

export ROBOFLOW_API_KEY=rf_xxxxx
import roboflow

rf = roboflow.Roboflow()  # picks up ROBOFLOW_API_KEY automatically

Find your key in the Roboflow web app under Settings → API Key.

ROBOFLOW_CONFIG_DIR

Override the location where the CLI stores authentication credentials and the configured default workspace. Defaults to ~/.config/roboflow/.

export ROBOFLOW_CONFIG_DIR=/etc/roboflow
roboflow login
# credentials saved to /etc/roboflow/config.json

Useful in CI, container builds, or when running multiple Roboflow accounts side by side on the same machine.

API_URL

Override the base URL the SDK and CLI send REST API requests to. Defaults to https://api.roboflow.com.

You should not need to set this. It exists for Roboflow-internal testing against pre-production environments.

DEDICATED_DEPLOYMENT_URL

Override the base URL for the dedicated-deployments service. Defaults to https://roboflow.cloud.

You should not need to set this. It exists for Roboflow-internal testing against pre-production environments.

Precedence

When the same value can be supplied multiple ways, this is the order of precedence (highest first):

  1. Explicit flag - e.g. --api-key on a CLI command, or the api_key argument to a Python function.

  2. Environment variable - e.g. ROBOFLOW_API_KEY.

  3. On-disk config - e.g. ~/.config/roboflow/config.json for the CLI's saved credentials.

  4. Built-in default - only for non-secret values like API_URL.

CI / Agent recommendation

In CI or AI-agent contexts, prefer ROBOFLOW_API_KEY over roboflow login. The env var path requires no interactive prompts, no on-disk state, and rotates cleanly when you rotate the key in your secrets store.

Last updated

Was this helpful?