Skip to content

Commit 69fcc8d

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-592: docs: add hints and separate example for z-image lora
1 parent cecaa75 commit 69fcc8d

31 files changed

Lines changed: 832 additions & 77 deletions
943 KB
Loading
1.02 MB
Loading

docs/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@
291291
* [v5/text-to-video](api-references/video-models/pixverse/v5-text-to-video.md)
292292
* [v5/image-to-video](api-references/video-models/pixverse/v5-image-to-video.md)
293293
* [v5/transition](api-references/video-models/pixverse/v5-transition.md)
294+
* [v5.5/text-to-video](api-references/video-models/pixverse/v5-5-text-to-video.md)
295+
* [v5.5/image-to-video](api-references/video-models/pixverse/v5-5-image-to-video.md)
294296
* [Runway](api-references/video-models/runway/README.md)
295297
* [gen3a\_turbo](api-references/video-models/runway/gen3a_turbo.md)
296298
* [gen4\_turbo](api-references/video-models/runway/gen4_turbo.md)

docs/api-references/image-models/alibaba-cloud/z-image-turbo-lora.md

Lines changed: 148 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ This documentation is valid for the following list of our models:
1616

1717
## Model Overview
1818

19-
An ultra-fast 6B-parameter text-to-image model with LoRA[^1] support.
19+
An ultra-fast 6B-parameter text-to-image model with LoRA[^1] support \
20+
(see [a separate example](z-image-turbo-lora.md#example-2-text-to-image-with-lora-fine-tuning) of how to use it).
2021

2122
## Setup your API Key
2223

@@ -28,7 +29,7 @@ If you don’t have an API key for the AI/ML API yet, feel free to use our [Quic
2829
[OpenAPI z-image-turbo-lora](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/image-models/Alibaba-Cloud/z-image-turbo-lora.json)
2930
{% endopenapi-operation %}
3031

31-
## Quick Example
32+
## Example #1: Standard Text-to-Image
3233

3334
Let's generate an image of the specified size using a simple prompt.
3435

@@ -53,7 +54,7 @@ def main():
5354
"image_size": {
5455
"width": 1440,
5556
"height": 512
56-
},
57+
}
5758
}
5859
)
5960

@@ -124,4 +125,148 @@ We obtained the following 1440x512 image by running this code example:
124125

125126
<figure><img src="../../../.gitbook/assets/-IaUBYEQiYqRaeT7oZvus.png" alt=""><figcaption></figcaption></figure>
126127

128+
***
129+
130+
## Example #2: Text-to-Image with LoRA Fine-Tuning
131+
132+
The `alibaba/z-image-turbo-lora` model supports applying up to three LoRA adapters to modify the style or behavior of the base model.
133+
134+
The `loras` parameter is an **array of objects**, not strings. Each object describes a single LoRA:
135+
136+
* `path` — where to load the LoRA from (Hugging Face repo ID, direct URL to the weights file, or local path).
137+
* `scale` — how strongly this LoRA should influence the result (typically between `0.6` and `1.0`).
138+
139+
<details>
140+
141+
<summary>Community LoRAs on Hugging Face that are compatible with Z-Image Turbo</summary>
142+
143+
**Style LoRAs**
144+
145+
* `renderartist/Classic-Painting-Z-Image-Turbo-LoRA` – classic oil painting / “old masters” look, museum-like style.
146+
* `renderartist/Coloring-Book-Z-Image-Turbo-LoRA` – “coloring book” style with clear outlines and flat fills, good for children’s illustrations and icons.
147+
* `ostris/z_image_turbo_childrens_drawings` — a stylish LoRA adaptation for generating artistic children's drawings.&#x20;
148+
* `renderartist/Technically-Color-Z-Image-Turbo` – vivid, cinematic Technicolor-style colors and dramatic lighting.
149+
* `suayptalha/Z-Image-Turbo-Realism-LoRA` – boosts photorealism; includes the trigger word `Realism`.
150+
* `AlekseyCalvin/HistoricColor_Z-image-Turbo-LoRA` – historical early-1900s color photography inspired by three-color processes.
151+
* `MGRI/Z-Image-Turbo-Panyue-Lora` – character LoRA for the digital persona **Panyue** (triggers: `Panyue`, `潘悦`).
152+
153+
**Technical / utility LoRAs**
154+
155+
* `GuangyuanSD/Z-Image-Re-Turbo-LoRA` – Re-Turbo adapter that restores Turbo-level speed while behaving like a de-turbo model for training and advanced workflows.
156+
* `ostris/zimage_turbo_training_adapter` – training adapter / de-distill LoRA used as a base for building new LoRAs on top of Z-Image Turbo.
157+
158+
</details>
159+
160+
***
161+
162+
Let's generate an image using a LoRA to influence the visual style.
163+
164+
{% tabs %}
165+
{% tab title="Python" %}
166+
{% code overflow="wrap" %}
167+
```python
168+
import requests
169+
import json # for getting a structured output with indentation
170+
171+
def main():
172+
response = requests.post(
173+
"https://api.aimlapi.com/v1/images/generations",
174+
headers={
175+
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
176+
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
177+
"Content-Type": "application/json",
178+
},
179+
json={
180+
"model": "alibaba/z-image-turbo-lora",
181+
"prompt": "A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.",
182+
"image_size": {
183+
"width": 1440,
184+
"height": 512
185+
},
186+
"loras":[
187+
{
188+
"path": "ostris/z_image_turbo_childrens_drawings",
189+
"scale": 0.85
190+
}
191+
]
192+
}
193+
)
194+
195+
data = response.json()
196+
print(json.dumps(data, indent=2, ensure_ascii=False))
197+
198+
if __name__ == "__main__":
199+
main()
200+
```
201+
{% endcode %}
202+
{% endtab %}
203+
204+
{% tab title="JS" %}
205+
{% code overflow="wrap" %}
206+
```javascript
207+
async function main() {
208+
const response = await fetch('https://api.aimlapi.com/v1/images/generations', {
209+
method: 'POST',
210+
headers: {
211+
// Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
212+
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
213+
'Content-Type': 'application/json',
214+
},
215+
body: JSON.stringify({
216+
model: 'alibaba/z-image-turbo-lora',
217+
prompt: 'A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.',
218+
image_size: {
219+
width: 1440,
220+
height: 512
221+
},
222+
loras:[
223+
{
224+
path: 'ostris/z_image_turbo_childrens_drawings',
225+
scale: 0.85
226+
}
227+
]
228+
}),
229+
});
230+
231+
const data = await response.json();
232+
console.log('Generation:', data);
233+
}
234+
235+
main();
236+
```
237+
{% endcode %}
238+
{% endtab %}
239+
{% endtabs %}
240+
241+
<details>
242+
243+
<summary>Response</summary>
244+
245+
{% code overflow="wrap" %}
246+
```json5
247+
{
248+
"data": [
249+
{
250+
"url": "https://cdn.aimlapi.com/flamingo/files/b/0a85ed1b/j-z8clom9AqL_2ZTsGygk.png"
251+
}
252+
],
253+
"meta": {
254+
"usage": {
255+
"credits_used": 17850
256+
}
257+
}
258+
}
259+
```
260+
{% endcode %}
261+
262+
</details>
263+
264+
We obtained the following 1440x512 image by running this code example:
265+
266+
<figure><img src="../../../.gitbook/assets/j-z8clom9AqL_2ZTsGygk.png" alt=""><figcaption></figcaption></figure>
267+
268+
The scale parameter significantly affects the output. The previous example was generated with `scale` = `0.85`, and here’s what happens when we increase it to `1.0`:
269+
270+
<figure><img src="../../../.gitbook/assets/yYDEEEN5bzcsn-6MeiHHM.png" alt=""><figcaption></figcaption></figure>
271+
127272
[^1]: The **LoRA algorithm** (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique used to adapt large language models (LLMs) and stable diffusion models to new tasks or domains without retraining the entire model. This process is faster and requires significantly less memory and computational resources than full fine-tuning.

docs/api-references/image-models/tencent/hunyuan-part.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ noIndex: true
66
# Hunyuan Part
77

88
{% columns %}
9-
{% column width="66.66666666666666%" %}
9+
{% column %}
1010
{% hint style="info" %}
1111
This documentation is valid for the following list of our models:
1212

1313
* `tencent/hunyuan-part`
1414
{% endhint %}
1515
{% endcolumn %}
1616

17-
{% column width="33.33333333333334%" %}
17+
{% column %}
1818
<a href="https://aimlapi.com/app/hunyuan/hunyuan-image-v3-text-to-image" class="button primary">Try in Playground</a>
1919
{% endcolumn %}
2020
{% endcolumns %}

docs/api-references/text-models-llm/Alibaba-Cloud/qwen-max.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# qwen-max
22

33
{% columns %}
4-
{% column %}
4+
{% column width="66.66666666666666%" %}
55
{% hint style="info" %}
66
This documentation is valid for the following list of our models:
77

@@ -10,7 +10,7 @@ This documentation is valid for the following list of our models:
1010
{% endhint %}
1111
{% endcolumn %}
1212

13-
{% column %}
13+
{% column width="33.33333333333334%" %}
1414
<a href="https://aimlapi.com/app/alibaba/qwen-max" class="button primary">Try in Playground</a>
1515
{% endcolumn %}
1616
{% endcolumns %}
@@ -25,25 +25,25 @@ The large-scale Mixture-of-Experts (MoE) language model. Excels in language unde
2525

2626
<summary>Step-by-Step Instructions</summary>
2727

28-
#### :digit\_one: Setup You Can’t Skip
28+
:digit\_one: **Setup You Can’t Skip**
2929

3030
:black\_small\_square: [**Create an Account**](https://aimlapi.com/app/sign-up): Visit the AI/ML API website and create an account (if you don’t have one yet).\
3131
:black\_small\_square: [**Generate an API Key**](https://aimlapi.com/app/keys): After logging in, navigate to your account dashboard and generate your API key. Ensure that key is enabled on UI.
3232

33-
#### :digit\_two: Copy the code example
33+
:digit\_two: **Copy the code example**
3434

3535
At the bottom of this page, you'll find [a code example](qwen-max.md#code-example) that shows how to structure the request. Choose the code snippet in your preferred programming language and copy it into your development environment.
3636

37-
#### :digit\_three: Modify the code example
37+
:digit\_three: **Modify the code example**
3838

3939
:black\_small\_square: Replace `<YOUR_AIMLAPI_KEY>` with your actual AI/ML API key from your account.\
4040
:black\_small\_square: Insert your question or request into the `content` field—this is what the model will respond to.
4141

42-
#### :digit\_four: <sup><sub><mark style="background-color:yellow;">(Optional)<mark style="background-color:yellow;"><sub></sup> Adjust other optional parameters if needed
42+
:digit\_four: <sup><sub><mark style="background-color:yellow;">**(Optional)**<mark style="background-color:yellow;"><sub></sup>**&#x20;Adjust other optional parameters if needed**
4343

4444
Only `model` and `messages` are required parameters for this model (and we’ve already filled them in for you in the example), but you can include optional parameters if needed to adjust the model’s behavior. Below, you can find the corresponding [API schema](qwen-max.md#api-schema), which lists all available parameters along with notes on how to use them.
4545

46-
#### :digit\_five: Run your modified code
46+
:digit\_five: **Run your modified code**
4747

4848
Run your modified code in your development environment. Response time depends on various factors, but for simple prompts it rarely exceeds a few seconds.
4949

docs/api-references/text-models-llm/Alibaba-Cloud/qwen-turbo.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# qwen-turbo
22

33
{% columns %}
4-
{% column %}
4+
{% column width="66.66666666666666%" %}
55
{% hint style="info" %}
66
This documentation is valid for the following list of our models:
77

88
* `qwen-turbo`
99
{% endhint %}
1010
{% endcolumn %}
1111

12-
{% column %}
12+
{% column width="33.33333333333334%" %}
1313
<a href="https://aimlapi.com/app/alibaba/qwen-turbo" class="button primary">Try in Playground</a>
1414
{% endcolumn %}
1515
{% endcolumns %}
@@ -25,25 +25,25 @@ Large context window (<kbd>1,000,000</kbd> tokens).
2525

2626
<summary>Step-by-Step Instructions</summary>
2727

28-
#### :digit\_one: Setup You Can’t Skip
28+
:digit\_one: **Setup You Can’t Skip**
2929

3030
:black\_small\_square: [**Create an Account**](https://aimlapi.com/app/sign-up): Visit the AI/ML API website and create an account (if you don’t have one yet).\
3131
:black\_small\_square: [**Generate an API Key**](https://aimlapi.com/app/keys): After logging in, navigate to your account dashboard and generate your API key. Ensure that key is enabled on UI.
3232

33-
#### :digit\_two: Copy the code example
33+
:digit\_two: **Copy the code example**
3434

3535
Below, you'll find [a code example](qwen-turbo.md#code-example) that shows how to structure the request. Choose the code snippet in your preferred programming language and copy it into your development environment.
3636

37-
#### :digit\_three: Modify the code example
37+
:digit\_three: **Modify the code example**
3838

3939
:black\_small\_square: Replace `<YOUR_AIMLAPI_KEY>` with your actual AI/ML API key from your account.\
4040
:black\_small\_square: Insert your question or request into the `content` field—this is what the model will respond to.
4141

42-
#### :digit\_four: <sup><sub><mark style="background-color:yellow;">(Optional)<mark style="background-color:yellow;"><sub></sup> Adjust other optional parameters if needed
42+
:digit\_four: <sup><sub><mark style="background-color:yellow;">**(Optional)**<mark style="background-color:yellow;"><sub></sup>**&#x20;Adjust other optional parameters if needed**
4343

4444
Only `model` and `messages` are required parameters for this model (and we’ve already filled them in for you in the example), but you can include optional parameters if needed to adjust the model’s behavior. Below, you can find the corresponding [API schema](qwen-turbo.md#api-schema), which lists all available parameters along with notes on how to use them.
4545

46-
#### :digit\_five: Run your modified code
46+
:digit\_five: **Run your modified code**
4747

4848
Run your modified code in your development environment. Response time depends on various factors, but for simple prompts it rarely exceeds a few seconds.
4949

docs/api-references/text-models-llm/Anthropic/claude-3-haiku.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Claude 3 Haiku
22

33
{% columns %}
4-
{% column %}
4+
{% column width="66.66666666666666%" %}
55
{% hint style="info" %}
66
This documentation is valid for the following list of our models:
77

@@ -12,7 +12,7 @@ This documentation is valid for the following list of our models:
1212
{% endhint %}
1313
{% endcolumn %}
1414

15-
{% column %}
15+
{% column width="33.33333333333334%" %}
1616
<a href="https://aimlapi.com/app/claude-3-haiku-20240307" class="button primary">Try in Playground</a>
1717
{% endcolumn %}
1818
{% endcolumns %}

docs/api-references/text-models-llm/alibaba-cloud/qwen3-235b-a22b.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Qwen3-235B-A22B
22

33
{% columns %}
4-
{% column %}
4+
{% column width="66.66666666666666%" %}
55
{% hint style="info" %}
66
This documentation is valid for the following model:
77

88
* `Qwen/Qwen3-235B-A22B-fp8-tput`
99
{% endhint %}
1010
{% endcolumn %}
1111

12-
{% column %}
12+
{% column width="33.33333333333334%" %}
1313
<a href="https://aimlapi.com/app/qwen/qwen3-235b-a22b-fp8-tput" class="button primary">Try in Playground</a>
1414
{% endcolumn %}
1515
{% endcolumns %}
@@ -24,25 +24,25 @@ A hybrid instruct-and-reasoning text model.
2424

2525
<summary>Step-by-Step Instructions</summary>
2626

27-
#### :digit\_one: Setup You Can’t Skip
27+
:digit\_one: **Setup You Can’t Skip**
2828

2929
:black\_small\_square: [**Create an Account**](https://aimlapi.com/app/sign-up): Visit the AI/ML API website and create an account (if you don’t have one yet).\
3030
:black\_small\_square: [**Generate an API Key**](https://aimlapi.com/app/keys): After logging in, navigate to your account dashboard and generate your API key. Ensure that key is enabled on UI.
3131

32-
#### :digit\_two: Copy the code example
32+
:digit\_two: **Copy the code example**
3333

3434
At the bottom of this page, you'll find [a code example](qwen3-235b-a22b.md#code-example) that shows how to structure the request. Choose the code snippet in your preferred programming language and copy it into your development environment.
3535

36-
#### :digit\_three: Modify the code example
36+
:digit\_three: **Modify the code example**
3737

3838
:black\_small\_square: Replace `<YOUR_AIMLAPI_KEY>` with your actual AI/ML API key from your account.\
3939
:black\_small\_square: Insert your question or request into the `content` field—this is what the model will respond to.
4040

41-
#### :digit\_four: <sup><sub><mark style="background-color:yellow;">(Optional)<mark style="background-color:yellow;"><sub></sup> Adjust other optional parameters if needed
41+
:digit\_four: <sup><sub><mark style="background-color:yellow;">**(Optional)**<mark style="background-color:yellow;"><sub></sup>**&#x20;Adjust other optional parameters if needed**
4242

4343
Only `model` and `messages` are required parameters for this model (and we’ve already filled them in for you in the example), but you can include optional parameters if needed to adjust the model’s behavior. Below, you can find the corresponding [API schema](qwen3-235b-a22b.md#api-schema), which lists all available parameters along with notes on how to use them.
4444

45-
#### :digit\_five: Run your modified code
45+
:digit\_five: **Run your modified code**
4646

4747
Run your modified code in your development environment. Response time depends on various factors, but for simple prompts it rarely exceeds a few seconds.
4848

docs/api-references/video-models/Kling-AI/v1-pro-image-to-video.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Below, you can find both corresponding API schemas.
3939

4040
### Create a video generation task and send it to the server
4141

42-
{% hint style="warning" %}
43-
The ratio/aspect\_ratio parameter is deprecated. The aspect ratio of the generated video is solely determined by the aspect ratio of the input reference image.
42+
{% hint style="info" %}
43+
The aspect ratio of the generated video is solely determined by the aspect ratio of the input reference image.
4444
{% endhint %}
4545

4646
{% openapi src="../../../.gitbook/assets/v1-pro-image-to-video.json" path="/v2/generate/video/kling/generation" method="post" %}

0 commit comments

Comments
 (0)