> ## Documentation Index
> Fetch the complete documentation index at: https://gccai.heqingsong.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# wan2.7 Pembuatan & Pengeditan Gambar

>  - Seri gambar Wan2.7: mendukung text-to-image, pengeditan gambar, pengeditan interaktif, pembuatan sekuensial, dan referensi multi-gambar
- Mode pemrosesan asinkron — kirim tugas dan polling hasil menggunakan task_id yang dikembalikan
- Mendukung resolusi 1K / 2K / 4K; wan2.7-image-pro mendukung hingga 4K untuk text-to-image
- Penagihan didasarkan pada jumlah gambar yang berhasil dibuat, terlepas dari resolusi atau rasio aspek 

```bash cURL theme={null}
curl --request POST \
  --url https://gccai.heqingsong.uk/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "wan2.7-image-pro",
    "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
  }'
```

```python Python theme={null}
import requests

url = "https://gccai.heqingsong.uk/v1/images/generations"

payload = {
    "model": "wan2.7-image-pro",
    "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript JavaScript theme={null}
const url = "https://gccai.heqingsong.uk/v1/images/generations";

const payload = {
  model: "wan2.7-image-pro",
  prompt: "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
};

const headers = {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(payload)
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
```

```go Go theme={null}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    url := "https://gccai.heqingsong.uk/v1/images/generations"

    payload := map[string]interface{}{
        "model":  "wan2.7-image-pro",
        "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display",
    }

    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}
```

```java Java theme={null}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class Main {
    public static void main(String[] args) throws Exception {
        String payload = """
        {
          "model": "wan2.7-image-pro",
          "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
        }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://gccai.heqingsong.uk/v1/images/generations"))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(payload))
            .build();

        System.out.println(client.send(request,
            HttpResponse.BodyHandlers.ofString()).body());
    }
}
```

```php PHP theme={null}
<?php

$url = "https://gccai.heqingsong.uk/v1/images/generations";

$payload = [
    "model" => "wan2.7-image-pro",
    "prompt" => "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
```

```ruby Ruby theme={null}
require 'net/http'
require 'json'
require 'uri'

url = URI("https://gccai.heqingsong.uk/v1/images/generations")

payload = {
  model: "wan2.7-image-pro",
  prompt: "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
}

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = payload.to_json

response = http.request(request)
puts response.body
```

```swift Swift theme={null}
import Foundation

let url = URL(string: "https://gccai.heqingsong.uk/v1/images/generations")!

let payload: [String: Any] = [
    "model": "wan2.7-image-pro",
    "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
]

var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let error = error { print("Error: \(error)"); return }
    if let data = data, let str = String(data: data, encoding: .utf8) { print(str) }
}
task.resume()
```

```csharp C# theme={null}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        var payload = @"{
            ""model"": ""wan2.7-image-pro"",
            ""prompt"": ""A flower shop with exquisite windows, beautiful wooden door, flowers on display""
        }";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");

        var content = new StringContent(payload, Encoding.UTF8, "application/json");
        var response = await client.PostAsync(
            "https://gccai.heqingsong.uk/v1/images/generations", content);
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
```

```json 200 theme={null}
{
  "code": "success",
  "data": [
    {
      "task_id": "task_01HX...",
      "status": "processing"
    }
  ]
}
```

```json 400 theme={null}
{
  "error": {
    "code": 400,
    "message": "Invalid request parameters",
    "type": "invalid_request_error"
  }
}
```

```json 401 theme={null}
{
  "error": {
    "code": 401,
    "message": "Authentication failed. Please check your API key.",
    "type": "authentication_error"
  }
}
```

```json 402 theme={null}
{
  "error": {
    "code": 402,
    "message": "Insufficient balance. Please top up your account.",
    "type": "payment_required"
  }
}
```

```json 429 theme={null}
{
  "error": {
    "code": 429,
    "message": "Too many requests. Please try again later.",
    "type": "rate_limit_error"
  }
}
```

```json 500 theme={null}
{
  "error": {
    "code": 500,
    "message": "Internal server error. Please try again later.",
    "type": "server_error"
  }
}
```

## Otorisasi

**Authorization** `string` *required*

Semua permintaan memerlukan autentikasi Bearer Token.

Kunjungi [halaman Manajemen API Key](https://gccai.heqingsong.uk/keys) untuk memperoleh API Key Anda, lalu tambahkan ke header permintaan:

```
Authorization: Bearer YOUR_API_KEY
```

## Model yang Tersedia

| Model | Deskripsi | Resolusi Maks (Text-to-Image) | Resolusi Maks (Edit / Sekuensial) | Harga |
| - | - | :-: | :-: | - |
| `wan2.7-image-pro` | Edisi profesional, detail lebih baik, mendukung 4K | 4K | 2K | ¥0.50 / gambar |
| `wan2.7-image` | Edisi standar, pembuatan lebih cepat | 2K | 2K | ¥0.20 / gambar |

> [!NOTE]
>
> Penagihan didasarkan pada **gambar yang berhasil dibuat × harga satuan**. Input tidak ditagih. Resolusi dan rasio aspek tidak memengaruhi harga. Permintaan yang gagal tidak dikenakan biaya.

## Body

**model** `string` *required*

Nama model pembuatan gambar.

* `wan2.7-image-pro` — Edisi profesional, hingga 4K untuk text-to-image
* `wan2.7-image` — Edisi standar, lebih cepat, hingga 2K

**nsfw\_check** `boolean` (default: false)

Menentukan apakah moderasi konten dijalankan sebelum tugas gambar dikirim.

* `true`: periksa prompt dan gambar input dengan `omni-moderation-latest`
* `false` atau dihilangkan: tidak mengirim permintaan moderasi, tanpa biaya atau latensi moderasi tambahan (default)

**prompt** `string`

Deskripsi teks untuk pembuatan gambar, hingga 5000 karakter.

* **Text-to-image** (tanpa `image_urls`): wajib
* **Pengeditan gambar** (dengan `image_urls`): opsional tetapi direkomendasikan

Contoh: `"Toko bunga dengan jendela indah, pintu kayu cantik, dan bunga yang dipajang"`

**image\_urls** `array\<string\>`

Array URL gambar input untuk skenario pengeditan dan referensi multi-gambar.

Menyediakan bidang ini akan mengalihkan permintaan ke **mode pengeditan gambar**.

**Format yang didukung:** URL HTTP/HTTPS; `data:image/...;base64,...` Base64

**Batasan:** Hingga 9 gambar; JPEG / PNG / WEBP / BMP; 240–8000 px, rasio aspek 1:8 \~ 8:1; ≤ 20MB per gambar

> [!NOTE]
>
> Rasio aspek output otomatis mengikuti gambar input **terakhir**. Mode pengeditan hanya mendukung hingga 2K — 4K tidak tersedia.

**n** `integer` (default: 1)

Jumlah gambar yang akan dibuat.

* **Mode standar**: 1–4 (default 1)
* **Mode sekuensial** (`enable_sequential: true`): 1–12 (default 1)

> [!NOTE]
>
> Ditagih per gambar yang berhasil dibuat. Dikenakan biaya di muka berdasarkan `n`.

**size** `string`

Resolusi output atau rasio aspek. Mendukung tiga format:

**① Kata kunci resolusi (direkomendasikan):** `1K` / `2K` (default) / `4K` (`wan2.7-image-pro` khusus text-to-image)

**② Rasio aspek:** `1:1` / `16:9` / `9:16` / `4:3` / `3:4` / `3:2` / `2:3` (default ke tier 2K)

**③ Dimensi piksel:** `1024x1024` atau `1024*1024`

**resolution** `string`

Kata kunci tier resolusi: `1K` / `2K` / `4K`. Dapat digabungkan dengan `size` (rasio aspek).

| Model | Skenario | Tier yang Didukung | Rentang Piksel |
| - | - | :-: | - |
| `wan2.7-image-pro` | Text-to-image (non-sekuensial) | 1K / **2K** / 4K | 768×768 \~ 4096×4096 |
| `wan2.7-image-pro` | Pengeditan / sekuensial | 1K / **2K** | 768×768 \~ 2048×2048 |
| `wan2.7-image` | Semua skenario | 1K / **2K** | 768×768 \~ 2048×2048 |

**negative\_prompt** `string`

Prompt negatif yang menjelaskan elemen yang perlu dihindari. Contoh: `"buram, terdistorsi, kualitas rendah"`

**watermark** `boolean` (default: false)

Apakah akan menambahkan watermark "AI Generated" di sudut kanan bawah.

**seed** `integer`

Seed acak, range 0–2147483647. Seed yang sama dengan parameter identik menghasilkan hasil yang konsisten secara visual.

**thinking\_mode** `boolean` (default: true)

Aktifkan mode penalaran yang ditingkatkan untuk memperbaiki kualitas gambar dengan konsekuensi waktu pembuatan lebih lama.

> [!NOTE]
>
> Hanya efektif saat **mode sekuensial dinonaktifkan** dan **tidak ada input gambar** yang diberikan.

**enable\_sequential** `boolean` (default: false)

Aktifkan mode **pembuatan gambar sekuensial** — membuat beberapa gambar yang koheren secara tematik dalam satu permintaan. Ideal untuk storyboard dan seri.

* Maksimum `n` is 12 when enabled
* `thinking_mode` dan `color_palette` diabaikan dalam mode sekuensial
* `wan2.7-image-pro` mendukung hingga 2K dalam mode sekuensial (4K tidak didukung)

**bbox\_list** `array`

Bounding box untuk pengeditan interaktif — menentukan wilayah persis yang akan diedit atau disisipkan konten.

**Structure:** `[[[x1, y1, x2, y2], ...], ...]`

* Panjang array luar harus sama dengan panjang `image_urls`
* Berikan `[]` untuk gambar tanpa bounding box
* Maksimum 2 box per gambar; koordinat adalah nilai piksel absolut, origin (0,0) berada di kiri atas

Contoh: `[[], [[989, 515, 1138, 681]]]`

**color\_palette** `array\<object\>`

Tema warna kustom. **Hanya mode standar** (bukan mode sekuensial).

* 3–10 entri (8 direkomendasikan); setiap entri memerlukan `hex` dan `ratio`
* Semua nilai `ratio` harus berjumlah tepat `100.00%`

```json theme={null}
[
  { "hex": "#C2D1E6", "ratio": "23.51%" },
  { "hex": "#636574", "ratio": "76.49%" }
]
```

## Respons

**code** `string`

Status respons. Mengembalikan `"success"` saat berhasil.

**data** `array`

**Elemen Array**

**task\_id** `string`

Pengidentifikasi unik tugas yang digunakan untuk mengueri hasil pembuatan.

**status** `string`

Status awal tugas, selalu `processing` saat dikirim.

## Contoh

### Teks-ke-Gambar (minimal)

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "A flower shop with exquisite windows, beautiful wooden door, flowers on display"
}
```

### Teks-ke-Gambar (dengan resolusi)

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "Summer beach, blue sky and white clouds, 4K ultra HD",
  "size": "4K",
  "thinking_mode": true
}
```

### Teks-ke-Gambar (palet warna kustom)

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "Minimalist modern living room",
  "size": "2K",
  "color_palette": [
    { "hex": "#C2D1E6", "ratio": "23.51%" },
    { "hex": "#CDD8E9", "ratio": "20.13%" },
    { "hex": "#B5C8DB", "ratio": "15.88%" },
    { "hex": "#C0B5B4", "ratio": "13.27%" },
    { "hex": "#DAE0EC", "ratio": "10.11%" },
    { "hex": "#636574", "ratio": "8.93%" },
    { "hex": "#CACAD2", "ratio": "5.55%" },
    { "hex": "#CBD4E4", "ratio": "2.62%" }
  ]
}
```

### Sequential Pembuatan Gambar

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "Cinematic series: the same stray orange cat, consistent features. First: under cherry blossoms in spring. Second: old street shade in summer. Third: fallen leaves in autumn. Fourth: snow footprints in winter.",
  "enable_sequential": true,
  "n": 4,
  "size": "2K"
}
```

### Pengeditan Satu Gambar

```json theme={null}
{
  "model": "wan2.7-image",
  "prompt": "Replace the background with a sunset scene, warm color tones",
  "image_urls": ["https://example.com/portrait.jpg"],
  "size": "2K"
}
```

### Referensi Multi-Gambar / Fusi Elemen

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "Apply the graffiti from image 2 onto the car in image 1",
  "image_urls": [
    "https://example.com/car.webp",
    "https://example.com/paint.webp"
  ],
  "size": "2K"
}
```

### Pengeditan Interaktif (Bounding Box)

`bbox_list` berkorespondensi 1-ke-1 dengan `image_urls`. Berikan `[]` untuk gambar tanpa pilihan.

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "Place the alarm clock from image 1 into the selected area of image 2, blending naturally",
  "image_urls": [
    "https://example.com/clock.webp",
    "https://example.com/desk.webp"
  ],
  "bbox_list": [
    [],
    [[989, 515, 1138, 681]]
  ],
  "size": "2K"
}
```

> [!NOTE]
>
> **Mengueri Hasil**
>
> Pembuatan gambar bersifat asinkron. Polling endpoint [Status Tugas](https://gccai.heqingsong.uk/id/api-reference/tasks/status.md) menggunakan `task_id` hingga `status == completed`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.