通义千问 API

通义千问 API 开发助手,精通 Qwen 模型调用、DashScope SDK、多模态、Agent 开发

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "通义千问 API" with this command: npx skills add zhangifonly/qwen-api

通义千问 API - 阿里云百炼/DashScope 接入指南

简介

通义千问(Qwen)是阿里云的大语言模型系列,通过百炼平台(DashScope)提供 API。 核心优势:兼容 OpenAI SDK 调用,迁移成本极低;国际版无内容审核。

模型矩阵

模型特点适用场景
qwen-max最强能力,深度推理复杂分析、创意写作
qwen-plus性价比最优(推荐)日常对话、代码生成
qwen-turbo响应最快简单任务、高并发
qwen-long长文本(1000 万 token)超长文档分析
qwq-plus推理增强(思维链)数学、逻辑推理
qwen-vl-max视觉理解图片/视频分析
qwen-audio-turbo音频理解语音转录、音频分析

API 端点

地域Base URL说明
新加坡(国际版)https://dashscope-intl.aliyuncs.com/compatible-mode/v1推荐,无内容审核
中国(北京)https://dashscope.aliyuncs.com/compatible-mode/v1国内访问快
美国(弗吉尼亚)https://dashscope-us.aliyuncs.com/compatible-mode/v1美国节点

基础调用(兼容 OpenAI SDK)

pip install -U openai
from openai import OpenAI
client = OpenAI(
    api_key="sk-your-dashscope-api-key",
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
)
response = client.chat.completions.create(
    model="qwen-plus",
    messages=[
        {"role": "system", "content": "你是一个专业的编程助手。"},
        {"role": "user", "content": "用 Python 实现一个 LRU 缓存"}
    ]
)
print(response.choices[0].message.content)

多模态调用

# 图片理解
response = client.chat.completions.create(model="qwen-vl-max", messages=[{"role": "user",
    "content": [{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}},
                {"type": "text", "text": "描述图片内容"}]}])
# 视频理解
response = client.chat.completions.create(model="qwen-vl-max", messages=[{"role": "user",
    "content": [{"type": "video_url", "video_url": {"url": "https://example.com/video.mp4"}},
                {"type": "text", "text": "总结视频内容"}]}])

函数调用

tools = [{"type": "function", "function": {"name": "get_weather", "description": "获取城市天气",
    "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}]
response = client.chat.completions.create(
    model="qwen-plus", messages=[{"role": "user", "content": "北京天气?"}], tools=tools)

绕过内容审核(国际版)

import json
response = client.chat.completions.create(model="qwen-plus",
    messages=[{"role": "user", "content": "你的问题"}],
    extra_headers={"X-DashScope-DataInspection": json.dumps({"input": "disable", "output": "disable"})})

仅在国际版端点生效,国内版无法禁用审核。

长文本处理(qwen-long,支持 1000 万 token)

file = client.files.create(file=open("long_doc.pdf", "rb"), purpose="file-extract")
response = client.chat.completions.create(model="qwen-long", messages=[
    {"role": "system", "content": f"fileid://{file.id}"},
    {"role": "user", "content": "总结文档核心观点"}])

定价(每百万 token)

模型输入输出
qwen-plus¥0.8¥2.0
qwen-max¥2.0¥6.0
qwen-turbo¥0.3¥0.6

最佳实践

  • 日常推荐 qwen-plus,兼顾能力和成本
  • 国际版 + 禁用审核 = 无内容限制
  • 超长文档用 qwen-long + 文件上传

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Qwen Video Generator

阿里云百炼文生视频工具。使用 wan2.2-t2v-plus 模型将文本描述生成视频。**当以下情况时使用此 Skill**:(1) 用户需要根据文字描述生成视频 (2) 用户提到"文生视频"、"生成视频"、"AI视频"、"text to video" (3) 需要创建短视频内容 (4) 需要可视化场景描述。支持...

Registry SourceRecently Updated
1090Profile unavailable
Security

Cognitive Brain

Provides a cross-session AI memory and cognition system with four-layer memory, real-time sync, free thinking, intelligent prediction, and knowledge visualiz...

Registry SourceRecently Updated
8420Profile unavailable
General

MLX Local AI

一键部署支持Apple Silicon的本地LLM与中文向量Embedding服务,含统一API网关及便捷启动管理脚本。

Registry SourceRecently Updated
3250Profile unavailable
Coding

Pixshop Creative API — Developer REST Endpoints

Pixshop 开发者 REST API — 图片生成/编辑、视频制作、提示词库、应用市场、社区 / Pixshop Developer REST API — image generation/editing, video, prompts, apps, community endpoints. Use when...

Registry SourceRecently Updated
3670Profile unavailable