Langflow CLI
The Langflow command line interface (Langflow CLI) is the main interface for managing and running the Langflow server.
CLI commands
The following sections describe the available CLI commands and their options.
langflow
Running the CLI without any arguments displays a list of available options and commands.
_10langflow [OPTIONS]_10# or_10python -m langflow [OPTIONS]
Options
| Option | Default | Values | Description |
|---|---|---|---|
--install-completion | Not applicable | Not applicable | Install auto-completion for the current shell. |
--show-completion | Not applicable | Not applicable | Show the location of the auto-completion config file, if installed. |
--help | Not applicable | Not applicable | Display information about the command usage and its options and arguments. |
langflow api-key
To create API keys with the Langflow CLI, AUTO_LOGIN must be set to TRUE, or you must be logged in as a superuser.
- If
AUTO_LOGINisFALSE, you must be logged in as a superuser. - If
AUTO LOGINisTRUE, you're already logged in as superuser.
For more information, see API keys and authentication.
_10langflow api-key [OPTIONS]_10# or_10uv run langflow api-key [OPTIONS]
Options
| Option | Default | Values | Description |
|---|---|---|---|
--install-completion | Not applicable | Not applicable | Install auto-completion for the current shell. |
--show-completion | Not applicable | Not applicable | Show the location of the auto-completion config file (if installed). |
--help | Not applicable | Not applicable | Display information about the command usage and its options and arguments. |
langflow copy-db
Copy the database files to the current directory, which is the directory containing __main__.py.
You can find this directory by running which langflow.
Copy the Langflow database files, langflow.db and langflow-pre.db (if they exist), from the cache directory to the current directory.
_10langflow copy-db_10# or_10python -m langflow copy-db
Options
| Option | Default | Values | Description |
|---|---|---|---|
--help | Not applicable | Not applicable | Display information about the command usage and its options and arguments. |
langflow migration
Run or test database migrations.
_10langflow migration [OPTIONS]_10# or_10python -m langflow migration [OPTIONS]
Options
| Option | Default | Values | Description |
|---|---|---|---|
--test | true | Boolean | Run migrations in test mode. Use --no-test to disable test mode. |
--fix | false (--no-fix) | Boolean | Fix migrations. This is a destructive operation, and all affected data will be deleted. Only use this option if you know what you are doing. |
--help | Not applicable | Not applicable | Display information about the command usage and its options and arguments. |
langflow run
Start the Langflow server.
_10langflow run [OPTIONS]_10# or_10python -m langflow run [OPTIONS]
Options
For information about the environment variables that correspond to these options, see Supported environment variables.
langflow superuser
Create a superuser account.
_10langflow superuser [OPTIONS]_10# or_10python -m langflow superuser [OPTIONS]
Options
| Option | Default | Values | Description |
|---|---|---|---|
--username | Required | String | Specify the name for the superuser. |
--password | Required | String | Specify the password for the superuser. |
For more information about these values, see LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD.
Precedence
Langflow CLI options override the values of environment variables set in your terminal or primary .env file.
For example, if you have LANGFLOW_PORT=7860 defined as an environment variable, but you run the CLI with --port 7880, Langflow sets the port to 7880, the value passed with the CLI.
Assign values
There are two ways you can assign a value to a CLI option.
You can write the option flag and its value with a single space between them: --option value.
Or, you can write them using an equals sign (=) between the option flag and the value: --option=value.
Values that contain spaces must be surrounded by quotation marks: --option 'Value with Spaces' or --option='Value with Spaces'.
Boolean values
Boolean options turn a behavior on or off, and therefore accept no arguments. To activate a boolean option, type it on the command line. For example:
_10langflow run --remove-api-keys
All boolean options have a corresponding option that negates it.
For example, the negating option for --remove-api-keys is --no-remove-api-keys.
These options let you negate boolean options that you may have set in your primary .env environment variables.