Qwen 2 API
Qwen 2 API 调用阿里 Qwen 视觉模型,支持文生图、图像 remix 和图像编辑。
运行中
·
3 variants
·
起价 $0.040
curl -X POST https://runapi.ai/api/v1/qwen_2/edit_image \
-H "Authorization: Bearer $RUNAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-2-text-to-image",
"image_url": "https://cdn.runapi.ai/public/samples/image.jpg",
"prompt": "生成一张等距视角的温馨家庭办公室插画,暖色照明,桌面上有绿植。"
}'
import { Qwen2Client } from "@runapi.ai/qwen-2";
const client = new Qwen2Client();
const result = await client.editImage.run({
model: "qwen-2-text-to-image",
image_url: "https://cdn.runapi.ai/public/samples/image.jpg",
prompt: "生成一张等距视角的温馨家庭办公室插画,暖色照明,桌面上有绿植。",
});
<?php
require __DIR__ . "/vendor/autoload.php";
use RunApi\Qwen2\Qwen2Client;
$client = new Qwen2Client();
$result = $client->editImage->run([
'model' => 'qwen-2-text-to-image',
'image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
'prompt' => '生成一张等距视角的温馨家庭办公室插画,暖色照明,桌面上有绿植。',
]);
require "runapi/qwen_2"
client = RunApi::Qwen2::Client.new
result = client.edit_image.run(
model: "qwen-2-text-to-image",
image_url: "https://cdn.runapi.ai/public/samples/image.jpg",
prompt: "生成一张等距视角的温馨家庭办公室插画,暖色照明,桌面上有绿植。"
)
npx skills add runapi-ai/qwen-2 -g
# Claude Code
claude mcp add runapi -s user -- npx -y @runapi.ai/mcp
# Codex
codex plugin install runapi-mcp@agents
# Cursor / Windsurf / VS Code
npx @runapi.ai/mcp init cursor
概览
Qwen 2 是阿里巴巴的视觉生成模型,支持文生图、图像 remix 和图像编辑,基于通义万象底座构建,具备强语言到视觉的对齐能力。
- 多变体覆盖不同速度/质量层级
- Model skill 包含文档、schema 和接入说明
- 适合面向应用的编码工作流
- 失败的生成不计费
变体
对比全部 API 变体
技能
为应用开发安装 Qwen 2 skill
把模型文档、schema、定价说明和接入步骤加载进代码工作区。
# Install the model skill for app development workflows
npx skills add runapi-ai/qwen-2 -g
Or use this setup request in your coding tool:
Install the Qwen 2 skill for this app: 1. Add runapi-ai/qwen-2 with the skills installer. 2. Load SKILL.md in this workspace. 3. Use its docs, schemas, pricing notes, and setup steps when adding model features. 4. Confirm the install path when done.
工作流程
四步从 model skill 到首次结果
01
选择模型
根据输出类型、质量要求和延迟目标选择模型与变体。
02
配置
设置 RunAPI key,并在代码工作区安装对应 model skill。
03
调用
按 skill 里的说明,把模型能力接入到你的应用里。
04
接收
按 task ID 轮询、在支持时使用流式,或处理 webhook 回调。
背景
Qwen 2 API 是什么?
Qwen 2 是阿里巴巴 Qwen 系列的视觉模型,支持图像生成和编辑。通过 RunAPI,所有 Qwen 2 端点共享统一计费和 API。
Provider
Alibaba
Modality
Image
为何选择 RunAPI
为什么用 RunAPI 调用 Qwen 2 API
一把认证,覆盖所有提供方
一把 RunAPI key 解锁整个模型目录。无需为每家提供方单独建账户。
统一的定价与账单
USD 按次定价,按月结算。失败的生成不计费。
Schema 优先的 SDK
Typed schema 和接入说明已打包进 model skill,让实现从正确契约开始。
常见问题
常见问题
应该从哪个变体开始?
选满足质量要求的最便宜变体。多数团队从 fast 起步,生产时升级到 pro。
有免费额度吗?
新账户每个模型都有免费调用额度,之后按次计费。
支持流式吗?
模型支持流式时,RunAPI 端到端流式。
失败怎么计费?
失败的生成不计费。
输出会缓存吗?
输出按任务 ID 存储在 R2 供回取。输入不缓存。
可以商用吗?
可以——所有变体默认含商用许可,除非模型许可明确限制;有例外会在变体页面注明。
速率限制?
Key 级限流随使用层级伸缩。当前限制见定价页。
在哪里报问题?
在公共 GitHub 仓库提 issue 或邮件联系 support。
相似模型
如果喜欢 Qwen 2 API,也可以试试这些
立即开始