Qwen (Tongyi)
Configure DB-GPT to use Alibaba Cloud's Qwen models via the DashScope API.
Prerequisitesâ
- A DashScope API key
- DB-GPT installed with
proxy_openaiextra
Install dependenciesâ
uv sync --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts"
Configurationâ
Edit configs/dbgpt-proxy-tongyi.toml:
[models]
[[models.llms]]
name = "qwen-plus"
provider = "proxy/tongyi"
api_base = "https://dashscope.aliyuncs.com/compatible-mode/v1"
api_key = "${env:DASHSCOPE_API_KEY}"
[[models.embeddings]]
name = "text-embedding-v3"
provider = "proxy/tongyi"
api_url = "https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings"
api_key = "${env:DASHSCOPE_API_KEY}"
tip
Set the environment variable to keep your key out of config:
export DASHSCOPE_API_KEY="your-dashscope-api-key"
Available modelsâ
LLMsâ
| Model | Config name | Notes |
|---|---|---|
| Qwen-Max | qwen-max | Flagship model, best quality |
| Qwen-Plus | qwen-plus | Balanced performance and cost |
| Qwen-Turbo | qwen-turbo | Fastest and cheapest |
| Qwen-Long | qwen-long | Extended context window |
Embeddingsâ
| Model | Config name | Notes |
|---|---|---|
| text-embedding-v3 | text-embedding-v3 | Recommended |
| text-embedding-v2 | text-embedding-v2 | Previous generation |
Start the serverâ
uv run dbgpt start webserver --config configs/dbgpt-proxy-tongyi.toml
Troubleshootingâ
| Issue | Solution |
|---|---|
InvalidAPIKey | Verify your DashScope API key and ensure it is activated |
| Model quota exceeded | Check your DashScope console for usage limits |
| Slow response | Try qwen-turbo for faster responses |
What's nextâ
- Getting Started â Full setup walkthrough
- Model Providers â Try other providers