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

CLI reference - 421 items

Qwen Code CLI reference

Qwen Code documents 85 slash commands, 73 CLI flags, 46 subcommands, 36 keyboard shortcuts, 103 settings keys, 56 environment variables and 22 config files. This page lists all 421 with what each one does, the values it accepts and a working example where the docs give one.

Last verified 27 official pagesRun as qwen

Qwen Code slash commands
CommandDescriptionExample
/init

Analyze current directory and create initial context file.

Docs: /init
-no example
/summary

Generate project summary based on conversation history.

optional [path]; default .qwen/PROJECT_SUMMARY.md

Docs: /summary
`/summary` or `/summary docs/my-summary.md`
/compress

Replace chat history with summary to save tokens (alias /summarize).

Docs: /compress
`/compress` or `/summarize`
/compress-fast

Fast compression without AI; strips old tool outputs and thinking parts.

Docs: /compress-fast
-no example
/resume

Resume a previous conversation session.

Docs: /resume
`/resume` or `/continue`
/recap

Generate a one-line session recap now.

Docs: /recap
-no example
/restore

Revert project files to the checkpoint before a tool call ran.

Docs: /restore
`/restore` (list) or `/restore <ID>`
/delete

Delete a previous session.

Docs: /delete
-no example
/branch

Fork the current conversation into a new session.

Docs: /branch
-no example
/fork

Spawn a background agent that inherits the full conversation.

Docs: /fork
`/fork <directive>`
/rewind

Rewind conversation to a previous turn.

Docs: /rewind
`/rewind` or `/rollback`
/export

Export session history to file.

html, md, json, jsonl

Docs: /export
`/export html`, `/export md`, `/export json`, `/export jsonl`
/rename

Rename or tag the current session.

Docs: /rename
`/rename My Feature` or `/tag`
/commit

Create a git commit with an AI-drafted message.

Docs: /commit
`/commit` or `/commit only stage the parser changes`
/clear

Clear conversation history and free up context.

Docs: /clear
`/clear`, `/reset`, `/new`
/context

Show context window usage breakdown; /context detail shows per-item usage.

Docs: /context
`/context detail`
/history

Control history display preferences and visibility.

Docs: /history
`/history collapse-on-resume`, `/history expand-on-resume`, `/history expand-now`
/diff

Open an interactive diff viewer showing uncommitted changes and per-turn diffs.

Docs: /diff
-no example
/log

Open a commit history viewer for the workspace (Web Shell only).

Docs: /log
-no example
/theme

Change Qwen Code visual theme.

Docs: /theme
-no example
/vim

Turn input area Vim editing mode on/off.

Docs: /vim
-no example
/voice

Toggle voice dictation input.

hold, tap, off, status

Docs: /voice
`/voice`, `/voice hold`, `/voice tap`, `/voice off`, `/voice status`
/directory

Manage multi-directory support workspace (alias /dir).

Docs: /directory
`/dir add ./src,./tests`, `/dir show`
/cd

Move this session to a new working directory.

Docs: /cd
`/cd ../other-project`
/editor

Open dialog to select supported editor.

Docs: /editor
-no example
/statusline

Open interactive status line preset dialog; with text, generate a command-mode status line via agent.

Docs: /statusline
`/statusline show model and git branch`
/terminal-setup

Configure terminal keybindings for multiline input.

Docs: /terminal-setup
-no example
/language

View or change language settings; ui sets UI language, output sets LLM output language.

ui [language], output [language]

Docs: /language
`/language ui zh-CN`
/mcp

List configured MCP servers and tools.

Docs: /mcp
`/mcp`, `/mcp desc`, `/mcp nodesc`, `/mcp schema`
/import-config

Import MCP servers from Claude configs.

Docs: /import-config
`/import-config all`, `/import-config claude-code`
/tools

Display currently available tool list.

Docs: /tools
`/tools`, `/tools desc`
/skills

Open the Skills panel to browse, search, toggle, and launch skills.

Docs: /skills
`/skills`, `/<skill-name>`
/learn

Create a reusable project skill from a file, directory, URL, video, or text.

Docs: /learn
`/learn https://docs.example.com/api`
/curator

Inspect, pin, archive, or restore inactive project auto-skills.

Docs: /curator
`/curator`, `/curator run --dry-run`
/plan

Switch to plan mode or exit plan mode.

Docs: /plan
`/plan`, `/plan <task>`, `/plan exit`
/approval-mode

Change the tool-approval mode (current session only).

plan, default, auto-edit, auto, yolo

Docs: /approval-mode
`/approval-mode`, `/approval-mode auto-edit`
/peers

Review held peer messages; manage trusted controllers.

Docs: /peers
`/peers`, `/peers accept <id>`, `/peers deny all`
/model

Switch model used in current session.

Docs: /model
`/model`, `/model <model-id>` (switch immediately)
/model --fast

Set a lighter model for prompt suggestions.

Docs: /model --fast
`/model --fast qwen3-coder-flash`
/model --voice

Set the model used for voice transcription.

Docs: /model --voice
`/model --voice <model-id>`
/model --vision

Set the vision-bridge model used to transcribe images for a text-only main model.

Docs: /model --vision
`/model --vision <model-id>`
/model --compaction

Set the model used for chat compression.

Docs: /model --compaction
`/model --compaction <model-id>`, `/model --compaction clear`
/model --image

Set an image-generation-capable model for the built-in image generation tool.

Docs: /model --image
`/model --image <model-id>`
/effort

Set reasoning effort for thinking-capable models (mapped and clamped per provider).

low, medium, high, xhigh, max

Docs: /effort
`/effort high`
/output-style

Choose the output style that shapes how responses are written.

Docs: /output-style
`/output-style Concise`
/extensions

Manage extensions (list, manage, explore, install); changes hot-reload.

list, manage, explore, install

Docs: /extensions
`/extensions list`, `/extensions manage`
/memory

Open the Memory Manager dialog.

Docs: /memory
-no example
/remember

Save a durable memory.

Docs: /remember
`/remember Prefer terse responses`
/forget

Remove matching entries from auto-memory.

Docs: /forget
`/forget <query>`
/dream

Manually run auto-memory consolidation.

Docs: /dream
-no example
/hooks

Manage Qwen Code hooks.

Docs: /hooks
`/hooks`, `/hooks list`
/reload-plugins

Reload extension changes (commands, skills, agents, workflows, hooks, MCP/LSP servers) from disk.

Docs: /reload-plugins
-no example
/permissions

Manage permission rules.

Docs: /permissions
-no example
/agents

Manage subagents.

Docs: /agents
`/agents manage`, `/agents create`
/arena

Manage Arena sessions.

start, stop, status, select (alias choose)

Docs: /arena
`/arena start`, `/arena stop`, `/arena status`
/tasks

List background tasks.

Docs: /tasks
-no example
/workflows

Inspect workflow runs; cooperatively pause/resume a background run.

Docs: /workflows
`/workflows`, `/workflows <runId>`, `/workflows p <runId>`
/lsp

Show LSP server status (registered only with --experimental-lsp).

Docs: /lsp
-no example
/trust

Manage folder trust settings.

Docs: /trust
-no example
/review

Multi-agent code review (12 parallel agents at high effort).

--comment, --fix, --resume, --effort low|medium|high

Docs: /review
`/review`, `/review 123`, `/review 123 --comment`, `/review --effort low`
/coordinate

Coordinate read-only workers and one optional worktree writer.

Docs: /coordinate
`/coordinate investigate and fix the authentication regression`
/loop

Run a prompt on a recurring schedule.

Docs: /loop
`/loop 5m check the build`
/goal-draft

Turn a fuzzy intention into a verifiable /goal objective.

Docs: /goal-draft
`/goal-draft make the auth tests pass`
/simplify

Review recent changes and apply safe cleanup edits directly.

Docs: /simplify
`/simplify`, `/simplify focus on duplication`
/qc-helper

Answer questions about Qwen Code usage and configuration.

Docs: /qc-helper
`/qc-helper how do I configure MCP?`
/btw <your question>

Ask a quick side question without interrupting the main conversation.

Docs: /btw <your question>
-no example
/advisor

Get a second-opinion review of the conversation above, optionally with a focus.

optional <focus>

Docs: /advisor
-no example
/help

Display help information for available commands.

Docs: /help
`/help` or `/?`
/status

Display version information; /status paths shows session file and log paths.

Docs: /status
`/status` or `/about`
/stats

Open the interactive usage statistics dashboard (Session, Activity, and Efficiency tabs).

model, tools, skills, daily, monthly, export

Docs: /stats
`/stats` or `/usage`
/stats model

Show per-model token breakdown and estimated cost.

Docs: /stats model
-no example
/stats export

Export usage statistics to CSV or JSON.

Docs: /stats export
`/stats export <daily|monthly> [date|month] [--format csv|json] [--output path]`
/settings

Open settings editor.

Docs: /settings
-no example
/config

Get or set any setting by dot-path key (writes to user settings).

Docs: /config
`/config` (list all), `/config <key>`, `/config <key>=<value>`
/auth

Change authentication method.

Docs: /auth
`/auth`, `/connect`, `/login`
/doctor

Run installation and environment diagnostics.

memory, cpu-profile, rollback

Docs: /doctor
`/doctor`, `/doctor memory`
/docs

Open full Qwen Code documentation in browser.

Docs: /docs
-no example
/ide

Manage IDE integration.

Docs: /ide
`/ide status`, `/ide install`, `/ide enable`, `/ide disable`
/insight

Generate programming insights from chat history.

Docs: /insight
-no example
/setup-github

Set up GitHub Actions.

Docs: /setup-github
-no example
/bug

Submit issue about Qwen Code.

Docs: /bug
`/bug Button click unresponsive`
/copy

Copy to clipboard: reply (Nth-last), code (by lang), LaTeX, or Mermaid.

Docs: /copy
`/copy`, `/copy 2`, `/copy python`, `/copy latex`, `/copy mermaid`
/quit

Exit Qwen Code immediately.

Docs: /quit
`/quit` or `/exit`
/batch-api

Ask the agent to plan and submit a Batch API job; it previews the plan before anything is billed.

Docs: /batch-api
-no example
/update

Update a standalone install from inside a session; honors QWEN_UPDATE_BASE_URL.

Docs: /update
-no example
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
Qwen Code subcommands
CommandDescriptionExample
qwen sessions list

List recent conversation sessions with metadata.

--json (default false), --limit

Docs: qwen sessions list
qwen sessions list --json --limit 50
qwen sessions ps

List interactive sessions running right now.

--json

Docs: qwen sessions ps
qwen sessions ps --json
qwen sessions controllers

Manage trusted controller tokens.

Docs: qwen sessions controllers
qwen sessions controllers add --label <name>
qwen mcp add

Add an MCP server configuration (stdio, sse or http).

qwen mcp add [options] <name> <commandOrUrl> [args...]

Docs: qwen mcp add
-no example
qwen mcp remove

Remove an MCP server configuration by name.

Docs: qwen mcp remove
qwen mcp remove <name>
qwen mcp list

List configured MCP servers.

Docs: qwen mcp list
-no example
qwen extensions install

Install an extension from a marketplace, git repo, npm package, local path or archive URL.

--scope project|workspace, --registry

Docs: qwen extensions install
qwen extensions install <marketplace-name>:<plugin-name>
qwen extensions uninstall

Uninstall an installed extension.

Docs: qwen extensions uninstall
qwen extensions uninstall qwen-cli-security
qwen extensions disable

Disable an extension at the user level, or for one workspace with --scope=workspace.

Docs: qwen extensions disable
qwen extensions disable extension-name --scope=workspace
qwen extensions enable

Enable an extension, optionally for a specific workspace with --scope=workspace.

Docs: qwen extensions enable
qwen extensions enable extension-name
qwen extensions update

Update an installed extension, or all of them with --all.

Docs: qwen extensions update
qwen extensions update --all
qwen extensions new

Create a new extension scaffold.

Docs: qwen extensions new
-no example
qwen extensions sources add

Add a marketplace source (owner/repo, git URL, https URL to marketplace.json, or local path).

Docs: qwen extensions sources add
qwen extensions sources add <source>
qwen extensions sources list

List configured marketplace sources.

Docs: qwen extensions sources list
qwen extensions sources list
qwen extensions sources update

Re-fetch a marketplace's plugin listing.

Docs: qwen extensions sources update
qwen extensions sources update <name>
qwen extensions sources remove

Remove a marketplace source.

Docs: qwen extensions sources remove
qwen extensions sources remove <name>
qwen extensions settings set

Set an extension setting value.

[--scope user|workspace]

Docs: qwen extensions settings set
-no example
qwen extensions settings list

List an extension's settings.

Docs: qwen extensions settings list
qwen extensions settings list <extension-name>
qwen channel start

Start all configured channels in a shared agent process, or a single named channel.

Docs: qwen channel start
qwen channel start my-channel
qwen channel stop

Gracefully stop the running channel service (or the daemon selection with --daemon-url).

--daemon-url, --token

Docs: qwen channel stop
qwen channel stop
qwen channel status

Show whether the channel service is running, its uptime and session counts per channel.

--daemon-url, --token

Docs: qwen channel status
qwen channel status
qwen channel set

Select channels on a token-protected qwen serve daemon at runtime.

Docs: qwen channel set
qwen channel set my-channel --token secret
qwen channel pairing list

List pending pairing requests for a channel.

Docs: qwen channel pairing list
qwen channel pairing list my-channel
qwen channel pairing approve

Approve a pairing request by its code.

Docs: qwen channel pairing approve
qwen channel pairing approve my-channel <CODE>
qwen channel configure-weixin

Configure the WeChat (Weixin) channel.

Docs: qwen channel configure-weixin
-no example
qwen serve

Start the experimental HTTP daemon serving the API and the built-in Web Shell (default http://127.0.0.1:4170/).

Docs: qwen serve
qwen serve --open
qwen update

Update a standalone installation; honors QWEN_UPDATE_BASE_URL.

Docs: qwen update
qwen update
qwen sandbox

Report the active Linux tool execution sandbox boundary, verify it with --verify, or run a command inside it.

--verify

Docs: qwen sandbox
qwen sandbox --verify
qwen review run

Headless wrapper that runs /review non-interactively; exit 0 completed, 1 no verdict, 3 blocking.

[target] [--json] [--fail-on request-changes] [--comment] [--resume] [--quiet]

Docs: qwen review run
-no example
qwen batch check

Verify Batch API setup; nothing is billed.

Docs: qwen batch check
qwen batch check
qwen batch run

Submit a batch plan; --dry-run previews it, --expect <snapshot> submits exactly that snapshot.

--dry-run, --expect

Docs: qwen batch run
qwen batch run .qwen/batch/plans/<slug>.json --dry-run
qwen batch collect

Validate results and write target files, optionally waiting for the batch to finish.

Docs: qwen batch collect
qwen batch collect <task-id> [--wait [--timeout <s>]]
qwen batch retry

Resubmit only the failed items; truncated items need a larger --max-output-tokens.

Docs: qwen batch retry
qwen batch retry <task-id> --max-output-tokens 8192
qwen batch list

List every recorded batch task with its project.

Docs: qwen batch list
qwen batch list
qwen batch cancel

Cancel a batch task; partial results are still billed.

Docs: qwen batch cancel
qwen batch cancel <task-id>
qwen batch clean

Delete the local record of a batch task (cancels nothing); --force overrides the safety refusal.

Docs: qwen batch clean
qwen batch clean <task-id>
qwen board task

Create a task on an Agent Board and print its id (experimental).

--board, --as

Docs: qwen board task
qwen board task "check the API response" --board orders --as api
qwen board show

Show a board's tasks and asks; --as filters to that actor, --json emits JSON.

Docs: qwen board show
qwen board show --board orders
qwen board claim

Claim a board task.

Docs: qwen board claim
qwen board claim <task-id> --board orders --as web
qwen board done

Complete a claimed board task, optionally with --note.

Docs: qwen board done
-no example
qwen board ask

Ask another actor a question; with --wait exit 0 answered, 2 declined, 3 TTL expired, 4 wait ended.

--wait, --timeout, --ttl

Docs: qwen board ask
-no example
qwen board answer

Answer an ask on the board.

Docs: qwen board answer
qwen board answer <ask-id> "yes" --board orders --as web
qwen board decline

Decline an ask on the board.

Docs: qwen board decline
qwen board decline <ask-id> "not my area" --board orders --as web
qwen board prune

Remove settled records older than a cutoff in days.

--older-than <days>

Docs: qwen board prune
qwen board prune --board orders --as human --older-than 7
qwen auth

Removed. Legacy invocations print a removal notice with migration guidance; use /auth instead.

Docs: qwen auth
-no example
Qwen Code keyboard shortcuts
ShortcutDescription
Esc

Close dialogs and suggestions; with an empty prompt, cancel an ongoing request.

Docs: Esc
Ctrl+C

Cancel the ongoing request and clear the input. Press twice to exit the application.

Docs: Ctrl+C
Ctrl+D

Exit the application if the input is empty. Press twice to confirm.

Docs: Ctrl+D
Ctrl+L

Clear the screen.

Docs: Ctrl+L
Ctrl+O / Alt/Option+T

Toggle expanded detail mode: expand or collapse all thinking blocks and tool outputs inline.

Docs: Ctrl+O / Alt/Option+T
Ctrl+S

Stashes non-empty input for the current project and restores it on the next launch.

Docs: Ctrl+S
Ctrl+T

Toggle the display of tool descriptions.

Docs: Ctrl+T
Alt/Option+M

Toggle Markdown output between rich rendered previews and raw/source mode.

Docs: Alt/Option+M
Shift+Tab (Tab on Windows)

Cycle approval modes (plan, default, auto-edit, auto, yolo).

Docs: Shift+Tab (Tab on Windows)
!

Toggle shell mode when the input is empty.

Docs: !
?

Toggle keyboard shortcuts display when the input is empty.

Docs: ?
/

Open slash-command completion.

Docs: /
@

Open completion for files, folders, and other context.

Docs: @
Space (empty prompt)

Start voice dictation when it and a voice model are configured.

Docs: Space (empty prompt)
Ctrl+Enter / Cmd+Enter / Shift+Enter / Ctrl+J

Insert a newline.

Docs: Ctrl+Enter / Cmd+Enter / Shift+Enter / Ctrl+J
Enter

Submit the current prompt. While a response is running, steer the current turn.

Docs: Enter
Ctrl+Q

Queue the current prompt or command for the next turn instead of steering.

Docs: Ctrl+Q
Up Arrow (at the top) / Esc

When queued messages are present, move them back into the input for editing.

Docs: Up Arrow (at the top) / Esc
Tab

Autocomplete the current suggestion if one exists.

Docs: Tab
Ctrl+C

Clear the input prompt.

Docs: Ctrl+C
Ctrl+R

Reverse search through input/shell history.

Docs: Ctrl+R
Ctrl+Y

Retry the last failed request.

Docs: Ctrl+Y
Ctrl+V / Option+V (Windows: Alt+V)

Paste clipboard content; an image is saved and a reference to it is inserted in the prompt.

Docs: Ctrl+V / Option+V (Windows: Alt+V)
Ctrl+X

Open the current input in an external editor.

Docs: Ctrl+X
Ctrl+Z

Undo the last input edit.

Docs: Ctrl+Z
Ctrl+Shift+Z

Redo the last undone input edit.

Docs: Ctrl+Shift+Z
Ctrl+K

Delete from the cursor to the end of the line.

Docs: Ctrl+K
Ctrl+U

Delete from the cursor to the beginning of the line.

Docs: Ctrl+U
Ctrl+F

Toggle keyboard focus between the running foreground shell and the prompt.

Docs: Ctrl+F
Ctrl+Shift+Up / Ctrl+Shift+Down

Scroll the focused shell up or down.

Docs: Ctrl+Shift+Up / Ctrl+Shift+Down
Ctrl+B

Promote the foreground shell to a background task.

Docs: Ctrl+B
Shift+Up

Scroll history up one line (when ui.useTerminalBuffer is enabled).

Docs: Shift+Up
Shift+Down

Scroll history down one line.

Docs: Shift+Down
Ctrl+Home

Jump to the top of the conversation.

Docs: Ctrl+Home
Ctrl+End

Jump to the bottom (and re-engage live auto-follow).

Docs: Ctrl+End
Ctrl+G

See context CLI received from IDE.

Docs: Ctrl+G
Qwen Code settings keys
KeyDescription
general.preferredEditor

The preferred editor to open files in.

string; default undefined

Docs: general.preferredEditor
general.outputStyle

Name of the output style (built-in Concise, Proactive, Explanatory, Learning, or a custom style).

string; default undefined

Docs: general.outputStyle
general.vimMode

Enable Vim keybindings.

boolean; default false

Docs: general.vimMode
general.enableAutoUpdate

Enable automatic update checks and installations on startup.

boolean; default true

Docs: general.enableAutoUpdate
general.showSessionRecap

Auto-show a one-line "where you left off" recap when returning to the terminal.

boolean; default false

Docs: general.showSessionRecap
general.gitCoAuthor.commit

Add a Co-authored-by trailer and a per-file AI-attribution git note to commits made through Qwen Code.

boolean; default true

Docs: general.gitCoAuthor.commit
general.gitCoAuthor.pr

Append a Qwen Code attribution line to pull request descriptions when running gh pr create.

boolean; default true

Docs: general.gitCoAuthor.pr
general.language

Language for the user interface; "auto" detects from system settings. Requires restart.

enum; default "auto"

Docs: general.language
general.outputLanguage

Language for model output; "auto" detects from system settings. Requires restart.

string; default "auto"

Docs: general.outputLanguage
general.chatRecording

Save chat history to disk. Disabling this also prevents --continue and --resume from working.

boolean; default true

Docs: general.chatRecording
output.format

The format of the CLI output.

string; values "text", "json", "stream-json"; default "text"

Docs: output.format
review.effort

Default effort for /review when neither --effort nor a remembered level applies.

enum: low, medium, high, auto; default "auto"

Docs: review.effort
ui.theme

The color theme for the UI.

string; default "Qwen Dark"

Docs: ui.theme
ui.customThemes

Custom theme definitions.

object; default {}

Docs: ui.customThemes
ui.statusLine

Custom status line configuration (supports command, refreshInterval, respectUserColors, hideContextIndicator).

object; default undefined

Docs: ui.statusLine
ui.hideWindowTitle

Hide the window title bar.

boolean; default false

Docs: ui.hideWindowTitle
ui.hideTips

Hide all tips (startup and post-response) in the UI.

boolean; default false

Docs: ui.hideTips
ui.hideBanner

Hide the startup ASCII logo and info panel.

boolean; default false

Docs: ui.hideBanner
ui.showLineNumbers

Show line numbers in code blocks in the CLI output.

boolean; default true

Docs: ui.showLineNumbers
ui.renderMode

Default Markdown display mode: "render" for rich previews or "raw" for source-oriented Markdown.

string; default "render"

Docs: ui.renderMode
ui.enableWelcomeBack

Show welcome back dialog when returning to a project with conversation history.

boolean; default true

Docs: ui.enableWelcomeBack
ui.accessibility.screenReader

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

boolean; default false

Docs: ui.accessibility.screenReader
ui.enableFollowupSuggestions

Enable followup suggestions that predict what you want to type next after the model responds.

boolean; default true

Docs: ui.enableFollowupSuggestions
ui.useTerminalBuffer

Render conversation history in an in-app scrollable viewport instead of the terminal scrollback buffer.

boolean; default true

Docs: ui.useTerminalBuffer
ui.mouseTracking

Enable in-app SGR mouse tracking.

boolean; default true

Docs: ui.mouseTracking
ide.enabled

Enable IDE integration mode.

boolean; default false

Docs: ide.enabled
privacy.usageStatisticsEnabled

Enable collection of usage statistics.

boolean; default true

Docs: privacy.usageStatisticsEnabled
model.name

The Qwen model to use for conversations.

string; default undefined

Docs: model.name
model.reasoningEffort

How hard reasoning-capable models think, applied across all providers; set with /effort.

enum: low, medium, high, xhigh, max; default undefined

Docs: model.reasoningEffort
model.sessionTokenLimit

Maximum recorded prompt token count allowed before sending the next message; -1 means unlimited.

number; default -1

Docs: model.sessionTokenLimit
model.maxSessionTurns

Maximum number of user/model/tool turns to keep in a session. -1 means unlimited.

integer; default -1

Docs: model.maxSessionTurns
model.maxWallTimeSeconds

Wall-clock budget for headless / unattended runs, in seconds; overridable via --max-wall-time.

number; default -1

Docs: model.maxWallTimeSeconds
model.maxToolCalls

Cumulative tool-call budget for a run; -1 unlimited, 0 no tool calls. Aborts with exit code 55.

number; default -1

Docs: model.maxToolCalls
model.maxSubagentDepth

Maximum sub-agent nesting depth (1-based levels); values clamp to 1-100.

number; default 5

Docs: model.maxSubagentDepth
model.generationConfig

Advanced overrides passed to the underlying content generator (timeout, maxRetries, samplingParams, etc.).

object; default undefined

Docs: model.generationConfig
model.enableOpenAILogging

Enables logging of OpenAI API calls for debugging and analysis.

boolean; default false

Docs: model.enableOpenAILogging
model.openAILoggingDir

Custom directory path for OpenAI API logs; defaults to logs/openai.

string; default undefined

Docs: model.openAILoggingDir
fastModel

Model used for generating prompt suggestions and speculative execution; empty uses the main model.

string; default ""

Docs: fastModel
advisorModel

Model used by /advisor for second-opinion reviews of the conversation.

string; default ""

Docs: advisorModel
visionModel

Image-capable model used as the vision bridge when a text-only main model receives an image.

string; default ""

Docs: visionModel
compactionModel

Model used for chat compression (auto-compaction). Leave empty to fall back to the main model.

string; default ""

Docs: compactionModel
imageModel

Model used by the built-in image_gen tool.

string; default ""

Docs: imageModel
voiceModel

Model used for voice transcription; voice dictation stays disabled until one is selected.

string; default ""

Docs: voiceModel
modelFallbacks

Ordered fallback model IDs (comma-separated, max 3) tried on capacity errors (429/503/529).

string; default ""

Docs: modelFallbacks
modelPricing

Optional per-model pricing for cost estimation in /stats model.

object; default undefined

Docs: modelPricing
context.fileName

The name of the context file(s).

string or array of strings; default undefined

Docs: context.fileName
context.autoCompactThreshold

Target fraction of the context window at which auto-compaction triggers.

number; default undefined (uses internal 0.85)

Docs: context.autoCompactThreshold
context.includeDirectories

Additional directories to include in the workspace context.

array; default []

Docs: context.includeDirectories
context.loadFromIncludeDirectories

Controls whether /memory refresh loads QWEN.md files from all added directories.

boolean; default false

Docs: context.loadFromIncludeDirectories
context.fileFiltering.respectGitIgnore

Respect .gitignore files when searching.

boolean; default true

Docs: context.fileFiltering.respectGitIgnore
context.fileFiltering.respectQwenIgnore

Respect .qwenignore and configured custom ignore files when searching.

boolean; default true

Docs: context.fileFiltering.respectQwenIgnore
context.fileFiltering.enableFuzzySearch

When true, enables fuzzy search capabilities when searching for files.

boolean; default true

Docs: context.fileFiltering.enableFuzzySearch
tools.sandbox

Sandbox execution environment (can be a boolean or a path string).

boolean or string; default undefined

Docs: tools.sandbox
tools.sandboxImage

Sandbox image URI used by Docker/Podman when --sandbox-image and QWEN_SANDBOX_IMAGE are unset.

string; default undefined

Docs: tools.sandboxImage
tools.shell.enableInteractiveShell

Use node-pty for an interactive shell experience.

boolean; default mode-based

Docs: tools.shell.enableInteractiveShell
tools.core

Deprecated. Will be removed in next version.

array of strings; default undefined

Docs: tools.core
tools.exclude

Deprecated. Use permissions.deny instead.

array of strings; default undefined

Docs: tools.exclude
tools.allowed

Deprecated. Use permissions.allow instead.

array of strings; default undefined

Docs: tools.allowed
tools.approvalMode

Sets the default approval mode for tool usage.

string; default auto

Docs: tools.approvalMode
tools.discoveryCommand

Command to run for tool discovery.

string; default undefined

Docs: tools.discoveryCommand
tools.callCommand

Command to run for calling a discovered tool.

string; default undefined

Docs: tools.callCommand
tools.useRipgrep

Use ripgrep for file content search instead of the fallback implementation.

boolean; default true

Docs: tools.useRipgrep
tools.workflowsEnabled

Enable the Workflow tool, which lets the model author and run scripts that orchestrate subagents.

boolean; default false

Docs: tools.workflowsEnabled
tools.truncateToolOutputThreshold

Truncate tool output if it is larger than this many characters.

number; default 25000

Docs: tools.truncateToolOutputThreshold
memory.enableManagedAutoMemory

Enable background extraction of memories from conversations.

boolean; default true

Docs: memory.enableManagedAutoMemory
memory.enableManagedAutoDream

Enable automatic consolidation (deduplication and cleanup) of collected memories.

boolean; default true

Docs: memory.enableManagedAutoDream
memory.enableTeamMemory

Enable a project memory tier shared with collaborators via the git-tracked .qwen/team-memory/ directory.

boolean; default false

Docs: memory.enableTeamMemory
permissions.allow

Rules for auto-approved tool calls (no confirmation needed).

array of strings; default undefined

Docs: permissions.allow
permissions.ask

Rules for tool calls that always require user confirmation. Takes priority over allow.

array of strings; default undefined

Docs: permissions.ask
permissions.deny

Rules for blocked tool calls. Highest priority - overrides both allow and ask.

array of strings; default undefined

Docs: permissions.deny
slashCommands.disabled

Slash command names to hide and refuse to execute.

array of strings; default undefined

Docs: slashCommands.disabled
skills.disabled

Hard-disabled skill names.

array of strings; default undefined

Docs: skills.disabled
skills.enabled

Explicit skill opt-ins; cancels a matching skills.defaultDisabled entry.

array of strings; default undefined

Docs: skills.enabled
mcp.serverCommand

Command to start an MCP server.

string; default undefined

Docs: mcp.serverCommand
mcp.allowed

An allowlist of MCP server names to make available to the model; supports glob patterns.

array of strings; default undefined

Docs: mcp.allowed
mcp.excluded

A denylist of MCP servers to exclude; a server in both lists is excluded.

array of strings; default undefined

Docs: mcp.excluded
mcp.toolIdleTimeoutMs

Idle timeout in milliseconds for MCP tool calls (10000 to 3600000).

number; default 300000

Docs: mcp.toolIdleTimeoutMs
security.folderTrust.enabled

Setting to track whether Folder trust is enabled.

boolean; default false

Docs: security.folderTrust.enabled
security.auth.selectedType

The currently selected authentication type.

string; default undefined

Docs: security.auth.selectedType
security.auth.enforcedType

The required auth type (useful for enterprises).

string; default undefined

Docs: security.auth.enforcedType
advanced.excludedEnvVars

Environment variables to exclude from project context.

array of strings; default ["DEBUG","DEBUG_MODE"]

Docs: advanced.excludedEnvVars
advanced.bugCommand

Configuration for the bug report command; overrides the default URL for /bug.

object; default undefined

Docs: advanced.bugCommand
plansDirectory

Custom directory for approved Plan Mode files (top-level key).

string; default undefined

Docs: plansDirectory
experimental.cron

Enable in-session cron/loop tools (cron_create, cron_list, cron_delete). Requires restart.

boolean; default true

Docs: experimental.cron
experimental.agentTeam

Enable agent-team collaboration tools for multi-agent coordination. Requires restart.

boolean; default false

Docs: experimental.agentTeam
mcpServers.<SERVER_NAME>.command

The command to execute to start the MCP server via standard I/O.

string; optional

Docs: mcpServers.<SERVER_NAME>.command
mcpServers.<SERVER_NAME>.args

Arguments to pass to the command.

array of strings; optional

Docs: mcpServers.<SERVER_NAME>.args
mcpServers.<SERVER_NAME>.env

Environment variables to set for the server process.

object; optional

Docs: mcpServers.<SERVER_NAME>.env
mcpServers.<SERVER_NAME>.cwd

The working directory in which to start the server.

string; optional

Docs: mcpServers.<SERVER_NAME>.cwd
mcpServers.<SERVER_NAME>.url

The URL of an MCP server that uses Server-Sent Events (SSE) for communication.

string; optional

Docs: mcpServers.<SERVER_NAME>.url
mcpServers.<SERVER_NAME>.httpUrl

The URL of an MCP server that uses streamable HTTP for communication.

string; optional

Docs: mcpServers.<SERVER_NAME>.httpUrl
mcpServers.<SERVER_NAME>.headers

A map of HTTP headers to send with requests to url or httpUrl.

object; optional

Docs: mcpServers.<SERVER_NAME>.headers
mcpServers.<SERVER_NAME>.timeout

Timeout in milliseconds for requests to this MCP server.

number; optional

Docs: mcpServers.<SERVER_NAME>.timeout
mcpServers.<SERVER_NAME>.trust

Trust this server and bypass its tool call confirmations in a trusted workspace.

boolean; optional

Docs: mcpServers.<SERVER_NAME>.trust
mcpServers.<SERVER_NAME>.includeTools

List of tool names to include from this MCP server (allowlist behavior).

array of strings; optional

Docs: mcpServers.<SERVER_NAME>.includeTools
mcpServers.<SERVER_NAME>.excludeTools

List of tool names to exclude from this MCP server.

array of strings; optional

Docs: mcpServers.<SERVER_NAME>.excludeTools
telemetry.enabled

Whether or not telemetry is enabled.

boolean

Docs: telemetry.enabled
telemetry.otlpEndpoint

The endpoint for the OTLP Exporter.

string

Docs: telemetry.otlpEndpoint
telemetry.otlpProtocol

The protocol for the OTLP Exporter (grpc or http).

string

Docs: telemetry.otlpProtocol
telemetry.logPrompts

Whether or not to include user prompt content and API request/response text in the logs.

boolean

Docs: telemetry.logPrompts
telemetry.outfile

Path to write telemetry to a file. When set, overrides OTLP export.

string

Docs: telemetry.outfile
modelProviders

Declares which models are available and how to connect to them; keys are API protocols (openai, anthropic, gemini).

Docs: modelProviders
env

Stores API keys directly in settings.json as a lowest-priority fallback (shell export and .env take precedence).

Docs: env
Qwen Code environment variables
VariableDescriptionExample
QWEN_HOME

Customizes the global configuration directory (default: ~/.qwen).

Docs: QWEN_HOME
-no example
QWEN_RUNTIME_DIR

Overrides the runtime output directory (conversations, logs, todos); defaults to QWEN_HOME.

Docs: QWEN_RUNTIME_DIR
-no example
QWEN_USAGE_STATISTICS_ENABLED

Set to true or 1 to enable usage statistics; any other value disables them.

Overrides the privacy.usageStatisticsEnabled setting.

Docs: QWEN_USAGE_STATISTICS_ENABLED
-no example
QWEN_TELEMETRY_ENABLED

Set to true or 1 to enable telemetry; any other value disables it.

Overrides the telemetry.enabled setting.

Docs: QWEN_TELEMETRY_ENABLED
-no example
QWEN_TELEMETRY_OTLP_ENDPOINT

Sets the OTLP endpoint for telemetry.

Overrides the telemetry.otlpEndpoint setting.

Docs: QWEN_TELEMETRY_OTLP_ENDPOINT
-no example
QWEN_TELEMETRY_OUTFILE

Sets the file path to write telemetry to. When set, overrides OTLP export.

Overrides the telemetry.outfile setting.

Docs: QWEN_TELEMETRY_OUTFILE
-no example
QWEN_SANDBOX

Alternative to the sandbox setting in settings.json; overrides the CLI flag and settings.

Accepts true, false, docker, podman, or a custom command string

Docs: QWEN_SANDBOX
-no example
QWEN_SANDBOX_IMAGE

Overrides sandbox image selection for Docker/Podman.

Takes precedence over tools.sandboxImage

Docs: QWEN_SANDBOX_IMAGE
-no example
SEATBELT_PROFILE

(macOS specific) Switches the Seatbelt (sandbox-exec) profile on macOS.

default permissive-open

Docs: SEATBELT_PROFILE
-no example
DEBUG

Set to true or 1 to enable verbose debug logging; excluded from project .env files by default.

Docs: DEBUG
-no example
DEBUG_MODE

Set to true or 1 to enable verbose debug logging; excluded from project .env files by default.

Docs: DEBUG_MODE
-no example
NO_COLOR

Set to any value to disable all color output in the CLI.

Docs: NO_COLOR
-no example
CLI_TITLE

Set to a string to customize the title of the CLI.

Docs: CLI_TITLE
-no example
QWEN_CODE_MAX_OUTPUT_TOKENS

Overrides the default maximum output tokens per response; disables automatic escalation.

Docs: QWEN_CODE_MAX_OUTPUT_TOKENS
export QWEN_CODE_MAX_OUTPUT_TOKENS=16000
QWEN_CODE_UNATTENDED_RETRY

Set to true or 1 to retry transient 429/529 capacity errors indefinitely with backoff.

Docs: QWEN_CODE_UNATTENDED_RETRY
-no example
QWEN_CODE_PROFILE_STARTUP

Set to 1 to write a JSON startup timing report to ~/.qwen/startup-perf/.

Docs: QWEN_CODE_PROFILE_STARTUP
export QWEN_CODE_PROFILE_STARTUP=1
QWEN_CODE_LEGACY_MCP_BLOCKING

Set to 1 to wait synchronously for every MCP server's discover handshake at startup.

Docs: QWEN_CODE_LEGACY_MCP_BLOCKING
-no example
QWEN_CODE_MODELS_DEV

Set to off to ignore the bundled models.dev model catalog.

off

Docs: QWEN_CODE_MODELS_DEV
export QWEN_CODE_MODELS_DEV=off
QWEN_CODE_MODELS_DEV_REFRESH

Set to off to stop the daily models.dev download into ~/.qwen/model-registry.json.

off

Docs: QWEN_CODE_MODELS_DEV_REFRESH
-no example
OPENAI_API_KEY

API key for the OpenAI-compatible protocol; the default envKey for openai entries.

Docs: OPENAI_API_KEY
-no example
OPENAI_BASE_URL

Base URL for the OpenAI-compatible protocol.

Docs: OPENAI_BASE_URL
-no example
OPENAI_MODEL

Model ID for the OpenAI-compatible protocol (alias: QWEN_MODEL).

Docs: OPENAI_MODEL
-no example
QWEN_MODEL

Alias of OPENAI_MODEL for the OpenAI-compatible protocol.

Docs: QWEN_MODEL
-no example
ANTHROPIC_API_KEY

API key for the Anthropic protocol (modelProviders key anthropic).

Docs: ANTHROPIC_API_KEY
-no example
ANTHROPIC_BASE_URL

Base URL for the Anthropic protocol.

Docs: ANTHROPIC_BASE_URL
-no example
ANTHROPIC_MODEL

Model ID for the Anthropic protocol.

Docs: ANTHROPIC_MODEL
-no example
GEMINI_API_KEY

API key for the Google GenAI protocol (modelProviders key gemini).

Docs: GEMINI_API_KEY
-no example
GEMINI_MODEL

Model ID for the Google GenAI protocol.

Docs: GEMINI_MODEL
-no example
GOOGLE_API_KEY

API key for Vertex AI; used with GOOGLE_MODEL and sets GOOGLE_GENAI_USE_VERTEXAI=true.

Docs: GOOGLE_API_KEY
-no example
GOOGLE_MODEL

Model ID for Vertex AI entries.

Docs: GOOGLE_MODEL
-no example
GOOGLE_CLOUD_PROJECT

Google Cloud project for keyless Vertex AI access via Application Default Credentials.

Docs: GOOGLE_CLOUD_PROJECT
-no example
DASHSCOPE_API_KEY

Alibaba Cloud DashScope API key, commonly used as the envKey of Qwen model provider entries.

Docs: DASHSCOPE_API_KEY
-no example
QWENCLOUD_API_KEY

API key for QwenCloud used in headless or scripted setup.

Docs: QWENCLOUD_API_KEY
export QWENCLOUD_API_KEY="sk-your-api-key"
BAILIAN_CODING_PLAN_API_KEY

API key for the Alibaba Cloud Coding Plan in headless or scripted setup.

Docs: BAILIAN_CODING_PLAN_API_KEY
export BAILIAN_CODING_PLAN_API_KEY="sk-sp-xxxxxxxxx"
OPENROUTER_API_KEY

OpenRouter API key; used with OPENAI_BASE_URL=https://openrouter.ai/api/v1.

Docs: OPENROUTER_API_KEY
-no example
QWEN_CODE_SYSTEM_SETTINGS_PATH

Overrides the path of the system settings file (highest-precedence settings file).

Docs: QWEN_CODE_SYSTEM_SETTINGS_PATH
-no example
QWEN_CODE_SYSTEM_DEFAULTS_PATH

Overrides the path of the system defaults settings file (lowest-precedence settings file).

Docs: QWEN_CODE_SYSTEM_DEFAULTS_PATH
-no example
QWEN_UPDATE_BASE_URL

Custom HTTPS release root for standalone updates (qwen update, /update, automatic updates).

HTTPS URL without credentials, query string or fragment

Docs: QWEN_UPDATE_BASE_URL
export QWEN_UPDATE_BASE_URL="https://downloads.example.com/qwen-code"
QWEN_DISABLED_SLASH_COMMANDS

Denylist of slash commands; unioned with slashCommands.disabled and --disabled-slash-commands.

Comma-separated command names

Docs: QWEN_DISABLED_SLASH_COMMANDS
-no example
QWEN_CODE_ENABLE_WORKFLOWS

Set to 1 to force the Workflow tool on (overrides tools.workflowsEnabled).

1

Docs: QWEN_CODE_ENABLE_WORKFLOWS
-no example
QWEN_CODE_ENABLE_AGENT_TEAM

Set to 1 to enable agent-team collaboration tools (same as experimental.agentTeam).

1

Docs: QWEN_CODE_ENABLE_AGENT_TEAM
-no example
QWEN_CODE_DISABLE_CRON

Set to 1 to disable the in-session cron/loop tools (experimental.cron).

1

Docs: QWEN_CODE_DISABLE_CRON
-no example
QWEN_CODE_API_TIMEOUT_MS

Sets the per-request API timeout in milliseconds; 0 disables the request timeout.

default 120000

Docs: QWEN_CODE_API_TIMEOUT_MS
-no example
QWEN_STREAM_IDLE_TIMEOUT_MS

Global idle timeout between streamed chunks; 0 disables the idle guard.

default 240000

Docs: QWEN_STREAM_IDLE_TIMEOUT_MS
-no example
QWEN_CODE_SAFE_MODE

Equivalent of --safe-mode: disables all customizations to isolate problems.

true

Docs: QWEN_CODE_SAFE_MODE
-no example
QWEN_CODE_SIMPLE

Equivalent of --bare; among other effects it turns off all hooks.

Docs: QWEN_CODE_SIMPLE
-no example
QWEN_CODE_SUPPRESS_YOLO_WARNING

Set to 1 to suppress the stderr warning when --yolo runs headless without a sandbox.

1

Docs: QWEN_CODE_SUPPRESS_YOLO_WARNING
-no example
QWEN_PROJECT_DIR

Set to the project directory in the environment of every command hook.

Docs: QWEN_PROJECT_DIR
"$QWEN_PROJECT_DIR/.qwen/hooks/security-check.sh"
QWEN_CODE_LANG

Highest-priority source for UI language auto-detection.

Docs: QWEN_CODE_LANG
-no example
QWEN_TLS_INSECURE

Set to 1 to skip TLS certificate verification (same as --insecure).

1

Docs: QWEN_TLS_INSECURE
-no example
SANDBOX_FLAGS

Injects custom flags into the docker or podman command for container-based sandboxing.

Space-separated flags

Docs: SANDBOX_FLAGS
export SANDBOX_FLAGS="--security-opt label=disable"
SANDBOX_SET_UID_GID

On Linux, forces (true) or disables (false) UID/GID mapping so the sandbox runs as your user.

true or false

Docs: SANDBOX_SET_UID_GID
export SANDBOX_SET_UID_GID=true
QWEN_SERVER_TOKEN

Bearer token for qwen serve when --token is not passed.

Docs: QWEN_SERVER_TOKEN
QWEN_SERVER_TOKEN=secret qwen serve
QWEN_CODE_MERMAID_IMAGE_RENDERING

Controls Mermaid image rendering in the terminal markdown renderer.

Documented value: 1

Docs: QWEN_CODE_MERMAID_IMAGE_RENDERING
QWEN_CODE_MERMAID_IMAGE_RENDERING=1
Qwen Code config files
PathDescription
~/.qwen/settings.json

User settings file; applies to all Qwen Code sessions for the current user.

Docs: ~/.qwen/settings.json
.qwen/settings.json

Project settings file in the project root; overrides user settings for that project.

Docs: .qwen/settings.json
/etc/qwen-code/system-defaults.json

System defaults file (Linux path); lowest-precedence settings layer. Override with QWEN_CODE_SYSTEM_DEFAULTS_PATH.

Windows: C:\ProgramData\qwen-code\system-defaults.json; macOS: /Library/Application Support/QwenCode/system-defaults.json

Docs: /etc/qwen-code/system-defaults.json
/etc/qwen-code/settings.json

System settings file (Linux path); overrides user and project settings. Override with QWEN_CODE_SYSTEM_SETTINGS_PATH.

Windows: C:\ProgramData\qwen-code\settings.json; macOS: /Library/Application Support/QwenCode/settings.json

Docs: /etc/qwen-code/settings.json
.qwen/.env

Recommended project env file for Qwen Code variables; never filtered by the default excluded-vars list.

Docs: .qwen/.env
.env

Environment file loaded automatically; DEBUG and DEBUG_MODE are excluded from project .env files by default.

Docs: .env
~/.qwen/tmp/<project_hash>/shell_history

Project-specific history of shell commands run in the CLI.

Docs: ~/.qwen/tmp/<project_hash>/shell_history
QWEN.md

Default context file for hierarchical instructional context (configurable via context.fileName); /init creates one.

Docs: QWEN.md
~/.qwen/QWEN.md

Global context file that applies to all your projects.

Docs: ~/.qwen/QWEN.md
.qwen/QWEN.local.md

Personal, project-local context file.

Docs: .qwen/QWEN.local.md
.qwen/PROJECT_SUMMARY.md

Default output of /summary; read by the welcome-back flow.

Docs: .qwen/PROJECT_SUMMARY.md
.qwenignore

Ignore file whose patterns exclude files from Qwen Code tools.

Docs: .qwenignore
.qwen/sandbox-macos-<profile_name>.sb

Custom macOS Seatbelt profile selected with SEATBELT_PROFILE=<profile_name>.

Docs: .qwen/sandbox-macos-<profile_name>.sb
.qwen/sandbox.Dockerfile

Custom sandbox image definition for container-based sandboxing.

Docs: .qwen/sandbox.Dockerfile
.qwen/skills/<name>/SKILL.md

Project Agent Skill; each Skill is a directory containing a SKILL.md.

Docs: .qwen/skills/<name>/SKILL.md
~/.qwen/commands/

Global custom slash command files (Markdown recommended; TOML deprecated); test.md becomes /test.

Docs: ~/.qwen/commands/
<project>/.qwen/commands/

Project custom slash command files; subdirectories form namespaces such as /git:commit.

Docs: <project>/.qwen/commands/
~/.qwen/output-styles/<name>.md

User-level custom output style (project styles go in <project>/.qwen/output-styles/).

Docs: ~/.qwen/output-styles/<name>.md
~/.qwen/rules/

User-level rules directory (or $QWEN_HOME/rules/); project rules go in <project>/.qwen/rules/.

Docs: ~/.qwen/rules/
.lsp.json

LSP server configuration file in the project root (LSP is experimental, enabled with --experimental-lsp).

Docs: .lsp.json
~/.qwen/mcp-oauth-tokens.json

Default MCP OAuth token store (plaintext, mode 0600).

Docs: ~/.qwen/mcp-oauth-tokens.json
qwen-extension.json

Extension manifest file; Claude and Gemini manifests are converted to it on install.

Docs: qwen-extension.json

FAQ

How many commands and options does Qwen Code have?

The official Qwen Code docs list 421 items: 85 slash commands, 73 CLI flags, 46 subcommands, 36 keyboard shortcuts, 103 settings keys, 56 environment variables and 22 config files. The largest group is settings keys, with 103.

Where does Qwen Code keep its configuration?

Qwen Code documents 22 config files and locations, including ~/.qwen/settings.json, .qwen/settings.json and /etc/qwen-code/system-defaults.json. The docs describe ~/.qwen/settings.json as: User settings file; applies to all Qwen Code sessions for the current user.

Which environment variables does Qwen Code read?

The docs list 56 environment variables, such as QWEN_HOME, QWEN_RUNTIME_DIR, QWEN_USAGE_STATISTICS_ENABLED and QWEN_TELEMETRY_ENABLED. Each one is in the environment variables table above with what it controls.

Sources

Last verified . Names and examples are copied verbatim from the 27 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.