This commit is contained in:
奕桁
2025-08-01 00:31:34 +08:00
parent 08415c9597
commit 44de3f686c

View File

@@ -39,12 +39,14 @@ curl -qL https://www.npmjs.com/install.sh | sh
``` ```
### Install from npm ### Install from npm
```bash ```bash
npm install -g @qwen-code/qwen-code@latest npm install -g @qwen-code/qwen-code@latest
qwen --version qwen --version
``` ```
### Install from source ### Install from source
```bash ```bash
git clone https://github.com/QwenLM/qwen-code.git git clone https://github.com/QwenLM/qwen-code.git
cd qwen-code cd qwen-code
@@ -93,6 +95,7 @@ Qwen Code supports multiple API providers. You can configure your API key throug
#### Configuration Methods #### Configuration Methods
1. **Environment Variables** 1. **Environment Variables**
```bash ```bash
export OPENAI_API_KEY="your_api_key_here" export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="your_api_endpoint" export OPENAI_BASE_URL="your_api_endpoint"
@@ -110,6 +113,7 @@ Qwen Code supports multiple API providers. You can configure your API key throug
#### API Provider Options #### API Provider Options
> ⚠️ **Regional Notice:** > ⚠️ **Regional Notice:**
>
> - **Mainland China**: Use Alibaba Cloud Bailian or ModelScope > - **Mainland China**: Use Alibaba Cloud Bailian or ModelScope
> - **International**: Use Alibaba Cloud ModelStudio or OpenRouter > - **International**: Use Alibaba Cloud ModelStudio or OpenRouter
@@ -117,6 +121,7 @@ Qwen Code supports multiple API providers. You can configure your API key throug
<summary><b>🇨🇳 For Users in Mainland China</b></summary> <summary><b>🇨🇳 For Users in Mainland China</b></summary>
**Option 1: Alibaba Cloud Bailian** ([Apply for API Key](https://bailian.console.aliyun.com/)) **Option 1: Alibaba Cloud Bailian** ([Apply for API Key](https://bailian.console.aliyun.com/))
```bash ```bash
export OPENAI_API_KEY="your_api_key_here" export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1" export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
@@ -124,6 +129,7 @@ export OPENAI_MODEL="qwen3-coder-plus"
``` ```
**Option 2: ModelScope (Free Tier)** ([Apply for API Key](https://modelscope.cn/docs/model-service/API-Inference/intro)) **Option 2: ModelScope (Free Tier)** ([Apply for API Key](https://modelscope.cn/docs/model-service/API-Inference/intro))
- ✅ **2,000 free API calls per day** - ✅ **2,000 free API calls per day**
- ⚠️ Connect your Aliyun account to avoid authentication errors - ⚠️ Connect your Aliyun account to avoid authentication errors
@@ -132,12 +138,14 @@ export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="https://api-inference.modelscope.cn/v1" export OPENAI_BASE_URL="https://api-inference.modelscope.cn/v1"
export OPENAI_MODEL="Qwen/Qwen3-Coder-480B-A35B-Instruct" export OPENAI_MODEL="Qwen/Qwen3-Coder-480B-A35B-Instruct"
``` ```
</details> </details>
<details> <details>
<summary><b>🌍 For International Users</b></summary> <summary><b>🌍 For International Users</b></summary>
**Option 1: Alibaba Cloud ModelStudio** ([Apply for API Key](https://modelstudio.console.alibabacloud.com/)) **Option 1: Alibaba Cloud ModelStudio** ([Apply for API Key](https://modelstudio.console.alibabacloud.com/))
```bash ```bash
export OPENAI_API_KEY="your_api_key_here" export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="https://dashscope-intl.aliyuncs.com/compatible-mode/v1" export OPENAI_BASE_URL="https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
@@ -145,11 +153,13 @@ export OPENAI_MODEL="qwen3-coder-plus"
``` ```
**Option 2: OpenRouter (Free Tier Available)** ([Apply for API Key](https://openrouter.ai/)) **Option 2: OpenRouter (Free Tier Available)** ([Apply for API Key](https://openrouter.ai/))
```bash ```bash
export OPENAI_API_KEY="your_api_key_here" export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="https://openrouter.ai/api/v1" export OPENAI_BASE_URL="https://openrouter.ai/api/v1"
export OPENAI_MODEL="qwen/qwen3-coder:free" export OPENAI_MODEL="qwen/qwen3-coder:free"
``` ```
</details> </details>
## Usage Examples ## Usage Examples
@@ -251,6 +261,7 @@ qwen
## Commands & Shortcuts ## Commands & Shortcuts
### Session Commands ### Session Commands
- `/help` - Display available commands - `/help` - Display available commands
- `/clear` - Clear conversation history - `/clear` - Clear conversation history
- `/compress` - Compress history to save tokens - `/compress` - Compress history to save tokens
@@ -258,6 +269,7 @@ qwen
- `/exit` or `/quit` - Exit Qwen Code - `/exit` or `/quit` - Exit Qwen Code
### Keyboard Shortcuts ### Keyboard Shortcuts
- `Ctrl+C` - Cancel current operation - `Ctrl+C` - Cancel current operation
- `Ctrl+D` - Exit (on empty line) - `Ctrl+D` - Exit (on empty line)
- `Up/Down` - Navigate command history - `Up/Down` - Navigate command history