# Qwen 2 Pro

> Premium Qwen 2 (2026-04-22) with highest quality output.

## Overview

- **Model ID**: `qwen-image-2-pro`
- **Workflow**: `qwen/v1/text-to-image`
- **Provider**: Qwen
- **Category**: Text → Image (image)
- **Output**: One or more image URLs.
- **Tags**: premium, image input, negative prompt, 2k
- **Unified endpoint**: `POST https://api.picsart.com/workflows/v1/models/execute` (model id in the body)
- **Compatibility endpoint**: `POST https://api.picsart.com/workflows/qwen/v1/text-to-image/execute` (vendor's own parameters)
- **Execution**: sync (`/execute`) returns the result in one call; async is also available
- **Model page**: https://picsart.com/api-platform/models/qwen-image-2-pro

## Pricing

Rates are in USD. Every row below is an exact rate for the settings it names — the columns are the settings that change the price for this model. Every response reports what was actually charged in `response.usage.credits`.

| Rate |
| --- |
| $0.0825 / generation |

Published rates. Volume pricing, invoicing and annual agreements: https://picsart.com/api-platform/contact-sales

## Authentication

The SDK and the REST API authenticate with a Picsart API key sent as a bearer token. Create a key in the console at https://picsart.com/api-platform/dashboard/api-keys, keep it in a server-side environment variable, and never ship it in browser code or commit it.

```bash
export PICSART_API_KEY="YOUR_KEY"
```

```http
Authorization: Bearer $PICSART_API_KEY
```

The CLI and the MCP server do not use an API key: `gen-ai login` signs in through the browser once per machine and stores a token locally.

## Interfaces

- **SDK** — `@picsart/ai-sdk` (TypeScript, Node 20+, ESM). Type-safe `ai.generate()` / `ai.generateText()` with per-model parameter types; polls long jobs for you.
- **REST** — the API gateway at `https://api.picsart.com`. Sync `/execute`, or async `/submit` + `/{taskId}/result`.
- **CLI** — `@picsart/gen-ai` (`gen-ai`). Generate from a terminal, quote cost before spending, emit JSON for pipelines.
- **MCP** — the same models inside Claude Code, Cursor, Windsurf and other MCP hosts. Setup: https://picsart.com/gen-ai-mcp/

```bash
npm install @picsart/ai-sdk      # SDK
npm install -g @picsart/gen-ai   # CLI (also drives the MCP server)
```

## Unified API (recommended)

One parameter set, used by the SDK and by REST alike: the names below are what `ai.generate('qwen-image-2-pro', …)` takes, and what goes inside the inner `params` of a REST call. Over REST the model id travels in the body, not the path — one workflow, `v1/models`, fronts the whole catalogue.

### Execution modes

- **Sync** — `POST /workflows/v1/models/execute` returns the result in one call. Only for jobs that finish within ~20 seconds; otherwise it times out.
- **Async** — `POST /workflows/v1/models/submit` returns a task id; poll `GET /workflows/v1/models/{taskId}/result` until `response.status` is `COMPLETED` or `FAILED`. Task statuses: `ACCEPTED` · `IN_PROGRESS` · `COMPLETED` · `FAILED`.
- **SDK** — `ai.generate()` always awaits the finished result; polling is hidden.

### Input parameters

- **`prompt`** (`string`, _required_): Prompt
  - Max length: 800 characters
- **`negativePrompt`** (`string`, _optional_): Negative Prompt
  - Max length: 500 characters
- **`resolution`** (`string`, _optional_)
  - Default: `"2048x2048"`
  - Options: `2048x2048`, `2688x1536`, `1536x2688`, `2368x1728`, `1728x2368`
- **`count`** (`number`, _optional_)
  - Default: `1`
  - Options: `1`, `2`, `4`, `6`
- **`enhancePrompt`** (`boolean`, _optional_)
  - Default: `true`
- **`imageUrls`** (`list<string>`, _optional_): Source Images
  - Accepts: image URLs (max 3)
- **`seed`** (`number`, _optional_): Seed
  - Range: 0–2147483647 (step 1)

### Input JSON Schema

The inner `params` object. Over REST it is wrapped as `{ "params": { "model": "<id>", "params": <this> } }`; the SDK takes it directly.

```json
{
  "type": "object",
  "required": [
    "prompt"
  ],
  "properties": {
    "prompt": {
      "type": "string",
      "maxLength": 800,
      "description": "Prompt"
    },
    "negativePrompt": {
      "type": "string",
      "maxLength": 500,
      "description": "Negative Prompt"
    },
    "resolution": {
      "type": "string",
      "enum": [
        "2048x2048",
        "2688x1536",
        "1536x2688",
        "2368x1728",
        "1728x2368"
      ],
      "default": "2048x2048"
    },
    "count": {
      "type": "number",
      "enum": [
        1,
        2,
        4,
        6
      ],
      "default": 1
    },
    "enhancePrompt": {
      "type": "boolean",
      "default": true
    },
    "imageUrls": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri",
        "description": "image URL"
      },
      "maxItems": 3,
      "description": "Source Images"
    },
    "seed": {
      "type": "number",
      "minimum": 0,
      "maximum": 2147483647,
      "multipleOf": 1,
      "description": "Seed"
    }
  },
  "additionalProperties": false
}
```

### Required parameters example

The required parameters plus the defaults that shape the output, as a REST body:

```json
{
  "params": {
    "model": "qwen-image-2-pro",
    "params": {
      "prompt": "A serene mountain lake at golden hour, ultra detailed",
      "resolution": "2048x2048"
    }
  }
}
```

### Response

The body is the gateway's status envelope: the output is at `response.result`, next to the task id, its status and the credits charged. Asset models return `url` plus an `items` array of results.

```json
{
  "status": "success",
  "response": {
    "id": "task_abc123",
    "status": "COMPLETED",
    "result": {
      "url": "https://cdn.picsart.com/…/result",
      "items": [
        {
          "url": "https://cdn.picsart.com/…/result"
        }
      ],
      "model": "qwen-image-2-pro"
    }
  }
}
```

What `ai.generate()` / `ai.generateText()` resolve to (the envelope already unwrapped):

```json
{
  "items": [
    {
      "url": "https://cdn.picsart.com/…/result"
    }
  ],
  "model": "qwen-image-2-pro"
}
```

### Usage examples

#### TypeScript (SDK)

```typescript
import { createClient } from '@picsart/ai-sdk';

const ai = createClient({
  apiKey: process.env.PICSART_API_KEY,
  apiUrl: 'https://api.picsart.com',
});

const result = await ai.generate('qwen-image-2-pro', {
  prompt: "A serene mountain lake at golden hour, ultra detailed",
  resolution: "2048x2048"
});

console.log(result.url); // image URL
```

#### cURL (sync)

```bash
curl -X POST 'https://api.picsart.com/workflows/v1/models/execute' \
  -H 'Authorization: Bearer $PICSART_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "params": {
    "model": "qwen-image-2-pro",
    "params": {
      "prompt": "A serene mountain lake at golden hour, ultra detailed",
      "resolution": "2048x2048"
    }
  }
}'
```

#### CLI

```bash
gen-ai login  # once per machine
gen-ai models info qwen-image-2-pro  # this model's parameters
gen-ai pricing qwen-image-2-pro  # quote before spending credits
gen-ai generate -m qwen-image-2-pro \
  -p "A serene mountain lake at golden hour"
```

## Compatibility API (vendor parameters)

Alongside the unified API, the `qwen/v1/text-to-image` workflow takes Qwen's own parameters exactly as the vendor defines them — nothing renamed or reshaped. It is the shortest path onto Picsart for request bodies already written against the vendor; the trade is that a request is written for one vendor, and the result comes back in the vendor's own shape. Same authentication.

- **Endpoint**: `POST https://api.picsart.com/workflows/qwen/v1/text-to-image/execute` (sync) · `POST …/submit` + `GET …/{taskId}/result` (async)
- **SDK**: `ai.apis.run('qwen/v1/text-to-image', params, { mode })` — params forwarded verbatim

### Vendor parameters

| Parameter | Type | Required | Default | Details |
| --- | --- | --- | --- | --- |
| `prompt` | `string` | yes | — | Text prompt describing desired image content. Chinese and English supported. Max 800 chars. |
| `negative_prompt` | `string` | no | — | Negative prompt to exclude unwanted content. Max 500 chars. |
| `model` | `string` | no | — | Model name. Defaults to qwen-image-2.0-pro if omitted. · Options: `qwen-image-2.0-pro`, `qwen-image-2.0-pro-2026-04-22`, `qwen-image-3.0`, `qwen-image-3.0-pro` |
| `size` | `string` | no | — | Output size as "width*height". Pixel count must be between 512*512 and 2048*2048. Default: 2048*2048. Recommended: 2048*2048, 2688*1536, 1536*2688, 2368*1728, 1728*2368. |
| `prompt_extend_mode` | `string` | no | — | Prompt-rewriting strategy, applied only when prompt_extend is enabled. "direct" (DPE) is the default; "agent" (APE) uses an agentic rewrite. Supported by the qwen-image-3.0 family. · Options: `direct`, `agent` |
| `n` | `number` | no | `1` | Number of images to generate (1-6). Default: 1. Affects cost. |
| `prompt_extend` | `boolean` | no | `true` | Enable LLM prompt rewriting. Improves quality for short prompts but increases processing time. Default: true. |
| `enable_thinking` | `boolean` | no | — | Enable thinking mode for better image quality at the cost of generation time. Requires prompt_extend=true. Supported by the qwen-image-3.0 family. Default: true. |
| `watermark` | `boolean` | no | `false` | Add "Qwen-Image" watermark in the lower-right corner. Default: false. |
| `seed` | `number` | no | — | Random seed for reproducibility (0-2147483647). If omitted, system generates a random seed. Identical seeds do not guarantee identical results. |
| `options` | `object` | no | — | GenAI options for safety checks and Drive saving. |
| └ `safety_checks` | `object` | no | — | Safety check settings |
| └   `enabled` | `boolean` | no | — | Whether to run content moderation. Defaults to true. |
| └ `drive` | `object` | no | — | Save result to Picsart Drive |
| └   `name` | `string` | yes | — | File name in Picsart Drive |
| └   `attributes` | `object` | no | — | Custom attributes to attach to the file |
| └   `folder` | `object` | no | — | Target folder in Picsart Drive |
| └ `inputs_transformation` | `object` | no | — | Input transformation settings |
| └   `downscale_oversized_images` | `boolean` | no | — | Whether to downscale oversized input images. Defaults to false. |

### Example request body

```json
{
  "params": {
    "prompt": "A serene mountain lake at golden hour, ultra detailed"
  }
}
```

### Usage examples

#### TypeScript (`ai.apis.run`)

```typescript
import { createClient, ApiRunMode } from '@picsart/ai-sdk';

const ai = createClient({
  apiKey: process.env.PICSART_API_KEY,
  apiUrl: 'https://api.picsart.com',
});

// Calls the 'qwen/v1/text-to-image' workflow directly — params are sent as-is.
const { result, usage } = await ai.apis.run('qwen/v1/text-to-image', {
  prompt: "A serene mountain lake at golden hour, ultra detailed"
}, {
  mode: ApiRunMode.SYNC,
});

console.log(result); // workflow-specific output
console.log(usage?.credits); // amount charged, in $
```

#### cURL (sync)

```bash
curl -X POST 'https://api.picsart.com/workflows/qwen/v1/text-to-image/execute' \
  -H 'Authorization: Bearer $PICSART_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "params": {
    "prompt": "A serene mountain lake at golden hour, ultra detailed"
  }
}'
```

### Response

Over HTTP the vendor-shaped result arrives inside the gateway envelope at `response.result`:

```json
{
  "status": "success",
  "response": {
    "id": "wf_abc123",
    "status": "COMPLETED",
    "result": {
      "items": [
        {
          "url": "https://cdn.picsart.com/…/result.jpg",
          "mimeType": "image/jpeg",
          "driveFile": {}
        }
      ]
    }
  }
}
```

`ai.apis.run()` unwraps that envelope and resolves to `{ result, usage }`:

```json
{
  "result": {
    "items": [
      {
        "url": "https://cdn.picsart.com/…/result.jpg",
        "mimeType": "image/jpeg",
        "driveFile": {}
      }
    ]
  }
}
```

## Additional resources

- Model page: https://picsart.com/api-platform/models/qwen-image-2-pro
- Try it: https://picsart.com/api-platform/models/qwen-image-2-pro/playground
- SDK: https://picsart.com/api-platform/models/qwen-image-2-pro/sdk
- REST API (unified): https://picsart.com/api-platform/models/qwen-image-2-pro/api
- Compatibility API (vendor parameters): https://picsart.com/api-platform/models/qwen-image-2-pro/advanced
- Pricing: https://picsart.com/api-platform/models/qwen-image-2-pro/pricing
- This document: https://picsart.com/api-platform/models/qwen-image-2-pro/llms.txt
- All models: https://picsart.com/api-platform/models
- Docs — quickstart https://picsart.com/api-platform/docs/quickstart, authentication https://picsart.com/api-platform/docs/authentication, SDK https://picsart.com/api-platform/docs/sdk, REST https://picsart.com/api-platform/docs/api-reference, CLI https://picsart.com/api-platform/docs/cli, MCP https://picsart.com/api-platform/docs/mcp
- CLI reference: https://picsart.github.io/picsart-mcp-cli-docs/guide/introduction
