Dashscope provides access to Alibaba Cloud’s Qwen family of large language models. Qwen models are multilingual, efficient, and offer strong performance across various tasks including reasoning, coding, and creative writing. We recommend experimenting to find the best-suited model for your use-case. Here are some general recommendations:
  • qwen-plus is good for most general use-cases with balanced performance and cost.
  • qwen-max offers the highest quality for complex reasoning tasks.
  • qwen-turbo provides faster inference for simpler tasks.
Dashscope also supports advanced features like structured outputs and thinking processes for enhanced reasoning capabilities.

Authentication

Set your DASHSCOPE_API_KEY environment variable. You can get one from Alibaba Cloud here.
export DASHSCOPE_API_KEY=sk-***

Example

Use DashScope with your Agent:
from agno.agent import Agent, RunResponse
from agno.models.dashscope import DashScope

agent = Agent(
    model=DashScope(id="qwen-plus"),
    markdown=True
)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story.")

Thinking Process

DashScope models support enabling thinking processes for enhanced reasoning:
from agno.agent import Agent
from agno.models.dashscope import DashScope

agent = Agent(
    model=DashScope(
        id="qwen-plus",
        enable_thinking=True,
        include_thoughts=True,
    ),
)
View more examples here.

Params

ParameterTypeDefaultDescription
idstr"qwen-plus"The id of the Dashscope Qwen model to use
namestr"Qwen"The name of the model
providerstr"Dashscope"The provider of the model
api_keyOptional[str]NoneThe Dashscope API key for authentication
base_urlstr"https://dashscope-intl.aliyuncs.com/compatible-mode/v1"The base URL for the Dashscope API
enable_thinkingOptional[bool]NoneEnable thinking process for enhanced reasoning
include_thoughtsOptional[bool]NoneInclude thinking process in the response
DashScope also supports the params of OpenAI.