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
| Flag | Description | Example |
|---|---|---|
--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: | -no example |
--input-format | Specifies the format consumed from standard input. Values: | -no example |
--include-partial-messages | Include partial assistant messages when using | -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: | 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 ( 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 | 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 number, | -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 default | -s user |
-t, --transport | Option of default | -t sse |
-e, --env | Option of | -e KEY=value |
-H, --header | Option of | -H "X-Api-Key: abc123" |
--timeout | Option of | --timeout 30000 |
--trust | Option of default | --trust |
--description | Option of | --description "Local tools" |
--include-tools | Option of default all tools included Docs: --include-tools | --include-tools mytool,othertool |
--exclude-tools | Option of default none Docs: --exclude-tools | --exclude-tools mytool |
--oauth-client-id | Option of | --oauth-client-id your-client-id |
--oauth-client-secret | Option of | --oauth-client-secret your-client-secret |
--oauth-redirect-uri | Option of default | --oauth-redirect-uri https://your-server.com/oauth/callback |
--oauth-authorization-url | Option of | --oauth-authorization-url https://provider.example.com/authorize |
--oauth-token-url | Option of | --oauth-token-url https://provider.example.com/token |
--oauth-scopes | Option of | --oauth-scopes scope1,scope2 |
--port <n> | Option of default | -no example |
--hostname <addr> | Option of default | -no example |
--token <str> | Option of | -no example |
--workspace <path> | Option of default | -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.
- qwenlm.github.io/qwen-code-docs/en/users/configuration/settings/34 items
- qwenlm.github.io/qwen-code-docs/en/users/features/headless/7 items
- qwenlm.github.io/qwen-code-docs/en/users/features/dual-output/3 items
- qwenlm.github.io/qwen-code-docs/en/users/features/mcp/15 items
- qwenlm.github.io/qwen-code-docs/en/users/qwen-serve/4 items
- qwenlm.github.io/qwen-code-docs/en/users/features/worktree/3 items
- qwenlm.github.io/qwen-code-docs/en/users/features/structured-output/2 items
- qwenlm.github.io/qwen-code-docs/en/users/features/hooks/1 item
- qwenlm.github.io/qwen-code-docs/en/users/configuration/model-providers/3 items
- qwenlm.github.io/qwen-code-docs/en/users/support/troubleshooting/1 item
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.