Gangmax Blog

Use Qwen Models Provided by Ali Bailian

1. Recharge

Go to here to recharge you account.

2. API Key

Create Bailian API Key from here.

3. Setup your AI agents

You can browse the website to find out the instructions for different AI agents. This post only lists “Claude Code” and “OpenCode”.

Claude Code

Create the “~/.calude/settings.json” file with the following content:

1
2
3
4
5
6
7
8
9
10
11
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_BASE_URL": "https://dashscope.aliyuncs.com/apps/anthropic",
"ANTHROPIC_MODEL": "qwen3.7-max",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3.6-flash",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.7-max",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.7-max",
"CLAUDE_CODE_SUBAGENT_MODEL": "qwen3.7-max"
}
}

Notes

  1. Use your API key to replace “YOUR_API_KEY”.

  2. The “ANTHROPIC_BASE_URL” here is for the “usage-based pricing” mode. For the other modes like “token plan for team” and “coding plan”, there’re different URLs. More details can be found here. Note that if you’re out of China, the website may give you different URLs.

OpenCode

Create the “~/.config/opencode/opencode.json” file with the following content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"bailian-payg": {
"npm": "@ai-sdk/anthropic",
"name": "Alibaba Cloud Model Studio",
"options": {
"baseURL": "https://dashscope.aliyuncs.com/apps/anthropic/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"qwen3.7-max": {
"name": "Qwen3.7 Max",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"qwen3.6-plus": {
"name": "Qwen3.6 Plus",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"deepseek-v3.2": {
"name": "DeepSeek V3.2"
}
}
}
}
}

Notes

  1. Use your API key to replace “YOUR_API_KEY”.

  2. The “baseURL” here is for the “usage-based pricing” mode. For the other modes like “token plan for team” and “coding plan”, there’re different URLs. More details can be found here. Note that if you’re out of China, the website may give you different URLs.

Comments