Image Alibaba

Qwen 2 API

Use the Qwen 2 API via RunAPI with a model skill, unified auth, and pay-as-you-go pricing.

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",
  "image_url": "https://cdn.runapi.ai/public/samples/image.jpg",
  "prompt": "Generate an isometric illustration of a cozy home office with warm lighting and plants on the desk."
}'
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: "Generate an isometric illustration of a cozy home office with warm lighting and plants on the desk.",
});
<?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' => 'Generate an isometric illustration of a cozy home office with warm lighting and plants on the desk.',
]);
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: "Generate an isometric illustration of a cozy home office with warm lighting and plants on the desk."
)
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

About Qwen 2

Qwen 2 is Alibaba's visual generation model supporting text-to-image and image editing. Built on the Tongyi Wanxiang foundation, it delivers detailed outputs with strong language-to-visual alignment.

Provider
Alibaba
Modality
Image

Available Versions

Variant Billing Pricing
qwen-2-edit-image call $0.06 View →
qwen-2-text-to-image call $0.06 View →
PRICING

Qwen 2 Pricing

Endpoint Resolution Duration Price
edit_image — — $0.06 / image

Prices shown for qwen-2-edit-image. Other variants retain their own endpoint pricing.

Agent integration

Run Qwen 2 From an Agent

HOW IT WORKS

Get Started with Qwen 2

  1. Create an API key

    Sign up and generate an API key from the dashboard.

  2. Pick a version

    Choose the version that best matches your quality and cost requirements.

  3. Send a request

    Submit your prompt and parameters to the model's documented endpoint.

  4. Get your result

    Poll the task or set a webhook, then download the completed output.

CONTEXT

About Qwen 2 on RunAPI

Qwen 2 is Alibaba's visual model from the Qwen family, supporting image generation and editing. Through RunAPI, all Qwen 2 endpoints share unified billing and API access.

Provider
Alibaba
See all →
Modality
Image
Browse models →

Why Use Qwen 2 Through RunAPI

One auth, every provider

A single RunAPI API key unlocks the whole model catalog across all providers. No separate accounts to create, no API keys to rotate per integration, and no credential management overhead. Add a new model to your app by changing one parameter.

Unified pricing & billing

Per-call pricing in USD, billed monthly into a single invoice. No subscription tiers, no minimum spend, and failed generations are never charged. The pricing page and check_pricing API show exact costs before you commit to a model.

Schema-first SDK

Typed schemas, parameter constraints, and setup notes are packaged in the model skill so your implementation starts from the right contract. The skill loads into Claude Code, Codex, Gemini CLI, Cursor, and VS Code — your agent knows the correct request shape before you write a line of code.

Qwen 2 Questions

What endpoints does Qwen 2 support?

Text-to-image and edit-image — covering generation from scratch and targeted region editing of a source image.

What is the Tongyi Wanxiang foundation?

Tongyi Wanxiang is Alibaba's visual generation platform that powers Qwen 2. It provides the underlying image understanding and generation capabilities.

How does image editing work?

The image-edit endpoint accepts a source image and text instructions, applying targeted modifications to specific regions while preserving the rest of the image.

Does Qwen 2 handle CJK text in images?

Yes — Qwen 2 has strong multilingual text understanding, including Chinese, Japanese, and Korean, for both prompt interpretation and visual content.

How does Qwen 2 compare to Z Image?

Qwen 2 supports both text-to-image and image editing, while Z Image focuses on fast text-to-image generation.

Which variant should I start with?

Pick the cheapest variant that meets your quality bar. Most teams start on the fast variant and graduate to pro for production.

SIMILAR MODELS

Similar Image Models

Start generating with Qwen 2