Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@richizo/openclaw-qwen-code-cli

npm version License: MIT

OpenClaw provider plugin that routes Qwen Code LLM calls through the locally installed Qwen Code CLI (qwen binary) instead of calling the DashScope API directly.

No API key needed in OpenClaw. Authentication is handled entirely by the Qwen Code CLI, which uses your existing DashScope / Alibaba Cloud credentials.

Prerequisites

# Install Qwen Code CLI
npm install -g @qwen-code/cli

# Authenticate
qwen login

Installation

openclaw plugins install @richizo/openclaw-qwen-code-cli

Configuration

Enable the plugin in your ~/.openclaw/openclaw.json:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "qwen-code-cli/qwen-coder"
      },
      "models": {
        "qwen-code-cli/qwen-coder": {},
        "qwen-code-cli/qwen3-coder-plus": {}
      }
    }
  },
  "plugins": {
    "entries": {
      "qwen-code-cli": { "enabled": true }
    }
  }
}

Advanced config

"qwen-code-cli": {
  "enabled": true,
  "config": {
    "command": "/path/to/qwen",   // default: "qwen" (resolved from PATH)
    "timeoutMs": 120000           // default: 120000 (2 min)
  }
}

Models

Model ID Description
qwen-code-cli/qwen-coder Qwen Coder via CLI
qwen-code-cli/qwen3-coder-plus Qwen3 Coder Plus via CLI (reasoning)

Features

JSONL output parsing

The plugin uses --output-format json --yolo flags and parses the Qwen Code CLI's JSONL output, extracting the type:"result" event to get the response text and token usage.

Token usage reporting

The plugin extracts input_tokens and output_tokens from the CLI's JSON output and reports them back to OpenClaw for usage tracking.

Non-TTY compatibility

The qwen binary may block on stdin when no TTY is attached. The plugin uses stdio: ["ignore", "pipe", "pipe"] to prevent this hang.

How it works

The plugin spawns qwen --output-format json --yolo --prompt "<prompt>" as a subprocess and parses the JSONL output.

OpenClaw agent  →  qwen-code-cli plugin  →  qwen subprocess  →  DashScope (via CLI auth)

License

MIT — see LICENSE