Qwen 2 API
Qwen 2 supports text-to-image and image editing.
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 supports text-to-image and image editing.
- 多变体覆盖不同速度/质量层级
- Model skill 包含文档、schema 和接入说明
- 适合面向应用的编码工作流
- 失败的生成不计费
对比全部 API 变体
为应用开发安装 Qwen 2 skill
把模型文档、schema、定价说明和接入步骤加载进代码工作区。
# Install the model skill for app development workflows
npx skills add runapi-ai/qwen-2 -g
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 到首次结果
选择模型
根据输出类型、质量要求和延迟目标选择模型与变体。
配置
设置 RunAPI key,并在代码工作区安装对应 model skill。
调用
按 skill 里的说明,把模型能力接入到你的应用里。
接收
按 task ID 轮询、在支持时使用流式,或处理 webhook 回调。
Qwen 2 API 是什么?
Qwen 2 是阿里巴巴 Qwen 系列的视觉模型,支持图像生成和编辑。通过 RunAPI,所有 Qwen 2 端点共享统一计费和 API。
为什么用 RunAPI 调用 Qwen 2 API
一把认证,覆盖所有提供方
一把 RunAPI key 解锁整个模型目录。无需为每家提供方单独建账户。
统一的定价与账单
USD 按次定价,按月结算。失败的生成不计费。
Schema 优先的 SDK
Typed schema 和接入说明已打包进 model skill,让实现从正确契约开始。
常见问题
Qwen 2 支持哪些端点?
Qwen 2 supports text-to-image and image editing.
通义万象基础是什么?
通义万象是阿里巴巴的视觉生成平台,是 Qwen 2 的底层支撑,提供底层的图像理解和生成能力。
图像编辑是如何工作的?
image-edit 端点接受源图像和文本指令,对特定区域进行针对性修改,同时保留图像的其余部分。
Qwen 2 能处理图像中的 CJK 文字吗?
能——Qwen 2 具备强大的多语言文字理解能力,包括中文、日语和韩语,同时适用于提示词理解和视觉内容生成。
Qwen 2 和 Z Image 有什么区别?
Qwen 2 supports text-to-image and image editing.
应该从哪个变体开始?
选满足质量要求的最便宜变体。多数团队从 fast 起步,生产时升级到 pro。
有免费额度吗?
新账户每个模型都有免费调用额度,之后按次计费。
支持流式吗?
模型支持流式时,RunAPI 端到端流式。
失败怎么计费?
失败的生成不计费。
输出会缓存吗?
输出按任务 ID 存储在 R2 供回取。输入不缓存。
可以商用吗?
可以——所有变体默认含商用许可,除非模型许可明确限制;有例外会在变体页面注明。
速率限制?
Key 级限流随使用层级伸缩。当前限制见定价页。
在哪里报问题?
在公共 GitHub 仓库提 issue 或邮件联系 support。