|
| 1 | +# wan-2-6-image |
| 2 | + |
| 3 | +{% columns %} |
| 4 | +{% column width="66.66666666666666%" %} |
| 5 | +{% hint style="info" %} |
| 6 | +This documentation is valid for the following list of our models: |
| 7 | + |
| 8 | +* `alibaba/wan-2-6-image` |
| 9 | +{% endhint %} |
| 10 | +{% endcolumn %} |
| 11 | + |
| 12 | +{% column width="33.33333333333334%" %} |
| 13 | +<a href="https://aimlapi.com/app/alibaba/wan-2-6-image" class="button primary">Try in Playground</a> |
| 14 | +{% endcolumn %} |
| 15 | +{% endcolumns %} |
| 16 | + |
| 17 | +## Model Overview |
| 18 | + |
| 19 | +Text-to-Image and Image-to-Image generator in a single model, providing artists and creators with complete creative freedom. |
| 20 | + |
| 21 | +## Setup your API Key |
| 22 | + |
| 23 | +If you don’t have an API key for the AI/ML API yet, feel free to use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up). |
| 24 | + |
| 25 | +## API Schema |
| 26 | + |
| 27 | +{% openapi-operation spec="wan-2-6-image" path="/v1/images/generations" method="post" %} |
| 28 | +[OpenAPI wan-2-6-image](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/image-models/Alibaba-Cloud/wan-2-6-image.json) |
| 29 | +{% endopenapi-operation %} |
| 30 | + |
| 31 | +## Quick Example |
| 32 | + |
| 33 | +Let's generate an image using two input images and a prompt that defines how they should be edited. |
| 34 | + |
| 35 | +{% tabs %} |
| 36 | +{% tab title="Python" %} |
| 37 | +{% code overflow="wrap" %} |
| 38 | +```python |
| 39 | +import requests |
| 40 | +import json # for getting a structured output with indentation |
| 41 | + |
| 42 | +def main(): |
| 43 | + response = requests.post( |
| 44 | + "https://api.aimlapi.com/v1/images/generations", |
| 45 | + headers={ |
| 46 | + # Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>: |
| 47 | + "Authorization": "Bearer <YOUR_AIMLAPI_KEY>", |
| 48 | + "Content-Type": "application/json", |
| 49 | + }, |
| 50 | + json={ |
| 51 | + "model": "alibaba/wan-2-6-image", |
| 52 | + "prompt": "Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.", |
| 53 | + "image_urls": [ |
| 54 | + "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png", |
| 55 | + "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg" |
| 56 | + ] |
| 57 | + } |
| 58 | + ) |
| 59 | + |
| 60 | + data = response.json() |
| 61 | + print(json.dumps(data, indent=2, ensure_ascii=False)) |
| 62 | + |
| 63 | +if __name__ == "__main__": |
| 64 | + main() |
| 65 | +``` |
| 66 | +{% endcode %} |
| 67 | +{% endtab %} |
| 68 | + |
| 69 | +{% tab title="JS" %} |
| 70 | +{% code overflow="wrap" %} |
| 71 | +```javascript |
| 72 | +async function main() { |
| 73 | + const response = await fetch('https://api.aimlapi.com/v1/images/generations', { |
| 74 | + method: 'POST', |
| 75 | + headers: { |
| 76 | + // Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>: |
| 77 | + 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>', |
| 78 | + 'Content-Type': 'application/json', |
| 79 | + }, |
| 80 | + body: JSON.stringify({ |
| 81 | + model: 'alibaba/wan-2-6-image', |
| 82 | + prompt: 'Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.', |
| 83 | + image_urls: [ |
| 84 | + "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png", |
| 85 | + "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg" |
| 86 | + ] |
| 87 | + }), |
| 88 | + }); |
| 89 | + |
| 90 | + const data = await response.json(); |
| 91 | + console.log(data); |
| 92 | +} |
| 93 | + |
| 94 | +main(); |
| 95 | +``` |
| 96 | +{% endcode %} |
| 97 | +{% endtab %} |
| 98 | +{% endtabs %} |
| 99 | + |
| 100 | +<details> |
| 101 | + |
| 102 | +<summary>Response</summary> |
| 103 | + |
| 104 | +{% code overflow="wrap" %} |
| 105 | +```json5 |
| 106 | +``` |
| 107 | +{% endcode %} |
| 108 | + |
| 109 | +</details> |
| 110 | + |
| 111 | +<table data-full-width="true"><thead><tr><th width="442.0667724609375" valign="top">Reference Images</th><th valign="top">Generated Image</th></tr></thead><tbody><tr><td valign="top"><div><figure><img src="../../../.gitbook/assets/t rex (3).png" alt=""><figcaption><p>Image #1</p></figcaption></figure></div></td><td valign="top"><div><figure><img src="../../../.gitbook/assets/alibaba-wan-2-6-image_output.png" alt=""><figcaption><p><kbd><code>"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect."</code></kbd></p></figcaption></figure></div></td></tr><tr><td valign="top"><div><figure><img src="../../../.gitbook/assets/blue mug (2).jpg" alt=""><figcaption><p>Image #2</p></figcaption></figure></div></td><td valign="top"></td></tr></tbody></table> |
0 commit comments