Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Qwen Code CLI reference - CLI flags

Qwen Code command-line flags

Qwen Code documents 73 CLI flags, including --system-prompt, --append-system-prompt and --output-style. You pass these to qwen on the command line. Each row gives the docs' description, accepted values and an example where one is documented.

Last verified 10 official pagesFull Qwen Code reference

Qwen Code CLI flags
FlagDescriptionExample
--model, -m

Specifies the Qwen model to use for this session.

Alias: -m. Values: Model name

Docs: --model, -m
npm start -- --model qwen3-coder-plus
--prompt, -p

Used to pass a prompt directly to the command. This invokes Qwen Code in a non-interactive mode.

Alias: -p. Values: Your prompt text

Docs: --prompt, -p
-no example
--prompt-interactive, -i

Starts an interactive session with the provided prompt as the initial input.

Alias: -i. Values: Your prompt text

Docs: --prompt-interactive, -i
qwen -i "explain this code"
--system-prompt

Overrides the built-in main session system prompt for this run.

Values: Your prompt text

Docs: --system-prompt
-no example
--append-system-prompt

Appends extra instructions to the main session system prompt for this run.

Values: Your prompt text

Docs: --append-system-prompt
-no example
--output-style

Selects the output style that shapes how responses are written for this run.

Values: Style name

Docs: --output-style
-no example
--output-format, -o

Specifies the format of the CLI output for non-interactive mode.

Alias: -o. Values: text, json, stream-json

Docs: --output-format, -o
-no example
--input-format

Specifies the format consumed from standard input.

Values: text, stream-json

Docs: --input-format
-no example
--include-partial-messages

Include partial assistant messages when using stream-json output format.

Docs: --include-partial-messages
-no example
--sandbox, -s

Enables sandbox mode for this session.

Alias: -s

Docs: --sandbox, -s
-no example
--debug, -d

Enables debug mode for this session, providing more verbose output.

Alias: -d

Docs: --debug, -d
-no example
--help, -h

Displays help information about command-line arguments.

Alias: -h

Docs: --help, -h
-no example
--yolo

Enables YOLO mode, which automatically approves all tool calls.

Docs: --yolo
-no example
--approval-mode

Sets the approval mode for tool calls.

Values: plan, default, auto-edit, auto, yolo

Docs: --approval-mode
qwen --approval-mode auto-edit
--allowed-tools

A comma-separated list of tool names that will bypass the confirmation dialog.

Values: Tool names

Docs: --allowed-tools
qwen --allowed-tools "Shell(git status)"
--disabled-slash-commands

Slash command names to hide/disable (comma-separated or repeated).

Values: Command names

Docs: --disabled-slash-commands
qwen --disabled-slash-commands "auth,mcp,extensions"
--telemetry

Enables telemetry.

Docs: --telemetry
-no example
--telemetry-target

Sets the telemetry target.

Docs: --telemetry-target
-no example
--telemetry-otlp-endpoint

Sets the OTLP endpoint for telemetry.

Docs: --telemetry-otlp-endpoint
-no example
--telemetry-otlp-protocol

Sets the OTLP protocol for telemetry (grpc or http).

default grpc

Docs: --telemetry-otlp-protocol
-no example
--telemetry-log-prompts

Enables logging of prompts for telemetry.

Docs: --telemetry-log-prompts
-no example
--acp

Enables ACP mode (Agent Client Protocol). Useful for IDE/editor integrations like Zed.

Docs: --acp
-no example
--experimental-lsp

Enables the experimental LSP (Language Server Protocol) feature for code intelligence.

Docs: --experimental-lsp
-no example
--extensions, -e

Specifies a list of extensions to use for the session.

Alias: -e. Values: Extension names

Docs: --extensions, -e
qwen -e my-extension -e my-other-extension
--list-extensions, -l

Lists all available extensions and exits.

Alias: -l

Docs: --list-extensions, -l
-no example
--proxy

Sets the proxy for the CLI.

Values: Proxy URL

Docs: --proxy
--proxy http://localhost:7890
--include-directories

Includes additional directories in the workspace for multi-directory support.

Values: Directory paths

Docs: --include-directories
--include-directories /path/to/project1,/path/to/project2
--screen-reader

Enables screen reader mode, which adjusts the TUI for better compatibility with screen readers.

Docs: --screen-reader
-no example
--version

Displays the version of the CLI.

Docs: --version
-no example
--openai-logging

Enables logging of OpenAI API calls for debugging and analysis.

Docs: --openai-logging
-no example
--openai-logging-dir

Sets a custom directory path for OpenAI API logs.

Values: Directory path

Docs: --openai-logging-dir
qwen --openai-logging-dir "~/qwen-logs" --openai-logging
--safe-mode

Disable all customizations (context files, hooks, extensions, skills, MCP servers, and more) to isolate problems. Also settable via QWEN_CODE_SAFE_MODE=true.

Docs: --safe-mode
qwen -p "query" --safe-mode
--continue

Resume the most recent session for this project.

Docs: --continue
qwen --continue -p "Pick up where we left off"
--resume [sessionId]

Resume a specific session (or choose interactively).

Docs: --resume [sessionId]
qwen --resume 123e... -p "Finish the refactor"
--max-session-turns

Cap the number of user/model/tool turns in the run; exits with code 53 on overrun.

Settings key: model.maxSessionTurns

Docs: --max-session-turns
qwen -p "..." --max-session-turns 30
--max-wall-time

Wall-clock budget for the run; budget aborts exit with code 55.

accepts 90 (s), 30s, 5m, 1h, 1.5h

Docs: --max-wall-time
qwen -p "..." --max-wall-time 10m
--max-tool-calls

Cumulative tool-call budget for the run; budget aborts exit with code 55.

Settings key: model.maxToolCalls

Docs: --max-tool-calls
qwen -p "..." --max-tool-calls 50
--json-fd <n>

Write structured JSON events to file descriptor n; mutually exclusive with --json-file.

number, n >= 3

Docs: --json-fd <n>
-no example
--json-file <path>

Write structured JSON events to a file; the path can be a regular file, a FIFO, or /dev/fd/N.

path

Docs: --json-file <path>
-no example
--input-file <path>

Watch this file for JSONL commands written by an external program.

path

Docs: --input-file <path>
-no example
-s, --scope

Option of qwen mcp add: Configuration scope (user or project).

default user

Docs: -s, --scope
-s user
-t, --transport

Option of qwen mcp add: Transport type (stdio, sse, http).

default stdio

Docs: -t, --transport
-t sse
-e, --env

Option of qwen mcp add: Set environment variables.

Docs: -e, --env
-e KEY=value
-H, --header

Option of qwen mcp add: Set HTTP headers for SSE and HTTP transports.

Docs: -H, --header
-H "X-Api-Key: abc123"
--timeout

Option of qwen mcp add: Set connection timeout in milliseconds.

Docs: --timeout
--timeout 30000
--trust

Option of qwen mcp add: Trust the server; skip confirmations in trusted workspaces.

default false

Docs: --trust
--trust
--description

Option of qwen mcp add: Set the description for the server.

Docs: --description
--description "Local tools"
--include-tools

Option of qwen mcp add: A comma-separated list of tools to include.

default all tools included

Docs: --include-tools
--include-tools mytool,othertool
--exclude-tools

Option of qwen mcp add: A comma-separated list of tools to exclude.

default none

Docs: --exclude-tools
--exclude-tools mytool
--oauth-client-id

Option of qwen mcp add: OAuth client ID for MCP server authentication (sse/http only).

Docs: --oauth-client-id
--oauth-client-id your-client-id
--oauth-client-secret

Option of qwen mcp add: OAuth client secret for MCP server authentication.

Docs: --oauth-client-secret
--oauth-client-secret your-client-secret
--oauth-redirect-uri

Option of qwen mcp add: OAuth redirect URI for authentication callback.

default http://localhost:7777/oauth/callback

Docs: --oauth-redirect-uri
--oauth-redirect-uri https://your-server.com/oauth/callback
--oauth-authorization-url

Option of qwen mcp add: OAuth authorization URL.

Docs: --oauth-authorization-url
--oauth-authorization-url https://provider.example.com/authorize
--oauth-token-url

Option of qwen mcp add: OAuth token URL.

Docs: --oauth-token-url
--oauth-token-url https://provider.example.com/token
--oauth-scopes

Option of qwen mcp add: OAuth scopes (comma-separated).

Docs: --oauth-scopes
--oauth-scopes scope1,scope2
--port <n>

Option of qwen serve: TCP port. 0 = OS-assigned ephemeral port.

default 4170

Docs: --port <n>
-no example
--hostname <addr>

Option of qwen serve: Bind interface; anything beyond loopback requires a token.

default 127.0.0.1

Docs: --hostname <addr>
-no example
--token <str>

Option of qwen serve: Bearer token. Falls back to the QWEN_SERVER_TOKEN env var.

Docs: --token <str>
-no example
--workspace <path>

Option of qwen serve: Absolute workspace directory registered by this daemon; repeatable.

default process.cwd()

Docs: --workspace <path>
-no example
--worktree [name | #N | url]

Start the whole session inside a git worktree; cannot be combined with --acp/--experimental-acp.

Docs: --worktree [name | #N | url]
qwen --worktree=my-feature
--json-schema

Constrain the model's final answer to a supplied JSON Schema; headless only.

Docs: --json-schema
-no example
--bare

Bare mode: ignores most settings-derived inputs and turns off all hooks (or QWEN_CODE_SIMPLE).

Docs: --bare
-no example
--exclude-tools

Disable the named built-in tools for the run (comma-separated).

Comma-separated tool names

Docs: --exclude-tools
--exclude-tools shell,write,edit
--core-tools

Allowlist of core tools (equivalent of tools.core); structured_output bypasses it.

Docs: --core-tools
-no example
--allowed-mcp-server-names

Allowlist of MCP server names for the run; when set, mcp.excluded is ignored.

Docs: --allowed-mcp-server-names
-no example
--auth-type

Selects the auth type/protocol at launch; combine with --model to point at a provider entry.

Docs: --auth-type
-no example
--openai-api-key

API key for the active OpenAI-compatible provider; highest-priority credential source.

Docs: --openai-api-key
-no example
--openai-base-url

Base URL for the active OpenAI-compatible provider.

Docs: --openai-base-url
-no example
--experimental-acp

Deprecated flag replaced by --acp (Agent Client Protocol mode).

Docs: --experimental-acp
-no example
--fallback-model

Fallback model IDs to try on capacity errors (429/503/529); CLI form of modelFallbacks.

Docs: --fallback-model
-no example
--mcp-config

Supplies MCP servers for the current invocation (path-taking flag).

Docs: --mcp-config
-no example
--telemetry-outfile

File to write telemetry to (path-taking flag).

Docs: --telemetry-outfile
-no example
--insecure

Skip TLS certificate verification (or QWEN_TLS_INSECURE=1); only for trusted networks.

Docs: --insecure
-no example

The rest of the Qwen Code reference

FAQ

How many CLI flags does Qwen Code have?

The official Qwen Code docs list 73 CLI flags, including --system-prompt, --append-system-prompt and --output-style. All of them are in the table above, in the docs' order.

What does --model, -m do in Qwen Code?

Specifies the Qwen model to use for this session. Values: Alias: -m. Values: Model name. Example: npm start -- --model qwen3-coder-plus

Where are Qwen Code CLI flags documented?

On 10 official docs pages at qwenlm.github.io, last read on October 17, 2026. Every row in the table links the exact section it came from.

Sources

Last verified . Names and examples are copied verbatim from the 10 official pages below, and every row above links the exact section it came from.

Newsletter

Know when your tools change

One email per week. New coding agent releases, the flags and commands they add, and what they mean for how you work.