-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Description
title: "Support DashScope (Alibaba Cloud Bailian) provider with role mapping (developer → system)"
labels: ["enhancement", "provider-support", "dashscope"]
🐛 Problem Description
Alibaba Cloud Bailian (DashScope) API's OpenAI-compatible endpoint does not support the developer role, which OpenClaw uses by default for system prompts. This causes all DashScope models (including Qwen3.5-Plus) to fail with HTTP 400 errors.
Error Message
HTTP 400: developer is not one of ['system', 'assistant', 'user', 'tool', 'function'] - 'messages.['0'].role'
🔍 Root Cause
DashScope's OpenAI-compatible API (https://dashscope.aliyuncs.com/compatible-mode/v1) only accepts these roles:
- ✅
system - ✅
user - ✅
assistant - ✅
tool - ✅
function
But does NOT support:
- ❌
developer(OpenClaw default)
📋 Steps to Reproduce
- Configure DashScope provider in
~/.openclaw/openclaw.json:
{
"models": {
"providers": {
"dashscope": {
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"apiKey": "sk-xxxxxxxx",
"api": "openai-completions",
"models": [
{
"id": "qwen3.5-plus-2026-02-15",
"name": "Qwen3.5-Plus",
"reasoning": false,
"contextWindow": 1000000,
"maxTokens": 65536
}
]
}
}
}
}- Set primary model to DashScope:
{
"agents": {
"defaults": {
"model": {
"primary": "dashscope/qwen3.5-plus-2026-02-15"
}
}
}
}- Restart OpenClaw Gateway:
openclaw gateway restart-
Send any message to the agent
-
Expected: Model responds normally
-
Actual: HTTP 400 error with role validation failure
✅ Verification Tests
Test 1: Using system role (works)
curl -X POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5-plus-2026-02-15",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello"}
]
}'Result: ✅ Success (200 OK, valid response)
Test 2: Using developer role (fails)
curl -X POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5-plus-2026-02-15",
"messages": [
{"role": "developer", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello"}
]
}'Result: ❌ HTTP 400 Bad Request
💡 Proposed Solution
Add provider-level role mapping configuration to OpenClaw:
Option 1: Provider-level configuration
{
"models": {
"providers": {
"dashscope": {
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"api": "openai-completions",
"roleMapping": {
"developer": "system"
}
}
}
}
}Option 2: Built-in DashScope provider detection
Automatically detect DashScope provider and map developer → system:
- Check if
baseUrlmatchesdashscope.aliyuncs.com - Apply role mapping automatically
📚 Additional Context
DashScope Endpoints
- China Mainland:
https://dashscope.aliyuncs.com/compatible-mode/v1 - Singapore:
https://dashscope-intl.aliyuncs.com/compatible-mode/v1 - US (Virginia):
https://dashscope-us.aliyuncs.com/compatible-mode/v1
Important Configuration Notes
reasoningmust befalsefor DashScope models in OpenClaw config- Model IDs vary between SDK and HTTP API:
- SDK:
qwen3.5-plus - HTTP API:
qwen3.5-plus-2026-02-15
- SDK:
Reference Documentation
🔗 Related Issues
Similar role mapping solutions have been implemented for other providers:
- Minimax: Switched from OpenAI to Anthropic endpoint to avoid role conflicts
- This suggests OpenClaw already has infrastructure for provider-specific role handling
🎯 Impact
This issue prevents users from using Alibaba Cloud Bailian's Qwen models (including the powerful Qwen3.5-Plus with 1M context window) with OpenClaw, limiting options for users in China or those seeking cost-effective alternatives to Western AI providers.
Environment
- OpenClaw Version: 2026.2.15
- OS: Windows 11
- Node: v24.13.0
- DashScope API: OpenAI-compatible mode
- Model Tested: qwen3.5-plus-2026-02-15
Thank you for considering this enhancement! 🙏