圖像 Alibaba

Qwen 2 API

透過 RunAPI 使用 Qwen 2 API,包含 model skill、統一驗證與按用量計費。

runapi.ai
curl -X POST https://runapi.ai/api/v1/qwen_2/edit_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "qwen-2-text-to-image",
  "source_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",
    source_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',
        'source_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",
    source_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
@runapi.ai/qwen-2 v1
OVERVIEW

關於 Qwen 2

Qwen 2 是阿里巴巴的視覺生成模型,支援文字生成圖片及圖片編輯。它以通義萬相為基礎,輸出細節豐富,文字與畫面對應準確。

供應商
Alibaba
模式
圖像

比較所有 API 變體

變體 計費 定價
qwen-2-edit-image 次請求 $0.06 查看 →
qwen-2-text-to-image 次請求 $0.06 查看 →
PRICING

Qwen 2 定價

Endpoint 解析度 時長 價格
edit_image — — $0.06 / 張圖片

以下為 qwen-2-edit-image 的定價。其他變體保留各自的 endpoint 定價。

Agent 整合

透過 Agent 執行 Qwen 2

運作方式

開始使用 Qwen 2

  1. 選擇模型

    挑選符合輸出類型、品質門檻與延遲目標的模型與變體。

  2. 設定

    設定 RunAPI key,並在 coding workspace 安裝 model skill。

  3. 開發

    使用 skill 指引,在你的 app 內加入模型功能。

  4. 接收

    透過 task ID 查詢、在支援時串流,或處理 webhook callback。

CONTEXT

Qwen 2 API 是甚麼?

Qwen 2 是 Alibaba Qwen 系列的視覺模型,支援圖片生成及編輯。透過 RunAPI,所有 Qwen 2 端點共用統一計費及 API 存取。

供應商
Alibaba
查看全部 →
模式
圖像
瀏覽模型 →

為何透過 RunAPI 使用 Qwen 2 API

一個驗證,對應所有 provider

一組 RunAPI key 即可解鎖整個 catalog。無需分開帳戶,亦無需為每個整合輪換密鑰。

統一定價與計費

按次以 USD 收費,每月結算。失敗的生成不會收費。

內含 schema 的 skill

型別化 schema 與 setup 備註打包在 model skill 內,讓實作從正確契約開始。

Qwen 2 常見問題

Qwen 2 支援哪些端點?

文字生成圖片及圖片編輯(edit-image)——涵蓋從零生成圖片,以及對來源圖片的指定區域進行編輯。

甚麼是通義萬相基礎?

通義萬相是 Alibaba 的視覺生成平台,為 Qwen 2 提供支援,負責底層的圖片理解及生成能力。

圖片編輯如何運作?

image-edit 端點接受來源圖片及文字指令,對特定區域進行針對性修改,同時保留圖片其餘部分。

Qwen 2 能處理圖片中的中日韓文字嗎?

能——Qwen 2 具備出色的多語言文字理解能力,包括中文、日文及韓文,適用於 prompt 詮釋及視覺內容。

Qwen 2 與 Z Image 相比如何?

Qwen 2 同時支援文字生成圖片及圖片編輯,而 Z Image 則專注於快速文字生成圖片。

我應該先用邊個版本?

先選最平而且符合你質素要求的版本。大多數團隊會先用快速版本,之後再升級到 pro 用於正式生產。

相似模型

如果你鍾意 Qwen 2 API,可以試吓呢些

開始用 Qwen 2 API 開發。