Skip to content

Commit dd23cc0

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-377: docs: fix gpt-image-1 /generations api schema
1 parent 3838c70 commit dd23cc0

3 files changed

Lines changed: 137 additions & 7 deletions

File tree

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
* [Image Models](api-references/image-models/README.md)
121121
* [Alibaba Cloud](api-references/image-models/alibaba-cloud/README.md)
122122
* [qwen-image](api-references/image-models/alibaba-cloud/qwen-image.md)
123+
* [qwen-image-edit](api-references/image-models/alibaba-cloud/qwen-image-edit.md)
123124
* [ByteDance](api-references/image-models/bytedance/README.md)
124125
* [Seedream 3.0](api-references/image-models/bytedance/seedream-3.0.md)
125126
* [Seededit 3.0 (Image-to-Image)](api-references/image-models/bytedance/seededit-3.0-image-to-image.md)
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
hidden: true
3+
noIndex: true
4+
---
5+
6+
# qwen-image-edit
7+
8+
{% hint style="info" %}
9+
This documentation is valid for the following list of our models:
10+
11+
* `alibaba/qwen-image-edit`
12+
{% endhint %}
13+
14+
## Model Overview
15+
16+
17+
18+
## Setup your API Key
19+
20+
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).
21+
22+
## API Schema
23+
24+
## Quick Example
25+
26+
Let's generate an image of the specified size using a simple prompt.
27+
28+
{% tabs %}
29+
{% tab title="Python" %}
30+
{% code overflow="wrap" %}
31+
```python
32+
import requests
33+
import json
34+
35+
36+
def main():
37+
response = requests.post(
38+
"https://api.aimlapi.com/v1/images/generations",
39+
headers={
40+
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
41+
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
42+
"Content-Type": "application/json",
43+
},
44+
json={
45+
"model": "alibaba/qwen-image-edit",
46+
"prompt": "A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses."
47+
}
48+
)
49+
50+
# response.raise_for_status()
51+
data = response.json()
52+
53+
print(json.dumps(data, indent=2, ensure_ascii=False))
54+
55+
56+
if __name__ == "__main__":
57+
main()
58+
```
59+
{% endcode %}
60+
{% endtab %}
61+
62+
{% tab title="JS" %}
63+
{% code overflow="wrap" %}
64+
```javascript
65+
async function main() {
66+
try {
67+
const response = await fetch('https://api.aimlapi.com/v1/images/generations', {
68+
method: 'POST',
69+
headers: {
70+
// Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
71+
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
72+
'Content-Type': 'application/json',
73+
},
74+
body: JSON.stringify({
75+
prompt: 'A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.',
76+
model: 'alibaba/qwen-image-edit'
77+
}),
78+
});
79+
80+
if (!response.ok) {
81+
throw new Error(`HTTP error! Status: ${response.status}`);
82+
}
83+
84+
const data = await response.json();
85+
console.log('Generation:', data);
86+
87+
} catch (error) {
88+
console.error('Error:', error);
89+
}
90+
}
91+
92+
main();
93+
```
94+
{% endcode %}
95+
{% endtab %}
96+
{% endtabs %}
97+
98+
<details>
99+
100+
<summary>Response</summary>
101+
102+
{% code overflow="wrap" %}
103+
```json5
104+
{
105+
"images": [
106+
{
107+
"url": "https://cdn.aimlapi.com/eagle/files/kangaroo/0WBwo2ruHEK9vpmtxu04G.jpeg",
108+
"width": 1024,
109+
"height": 768,
110+
"content_type": "image/jpeg"
111+
}
112+
],
113+
"timings": {
114+
"inference": 5.732342581963167
115+
},
116+
"seed": 4128479875,
117+
"has_nsfw_concepts": [
118+
false
119+
],
120+
"prompt": "A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses."
121+
}
122+
```
123+
{% endcode %}
124+
125+
</details>
126+
127+
We obtained the following 1024x768 image by running this code example:
128+
129+
<figure><img src="../../../.gitbook/assets/qwen-image.jpeg" alt=""><figcaption><p><code>'A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.'</code></p></figcaption></figure>

docs/api-references/image-models/openai/gpt-image-1.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ If you don’t have an API key for the AI/ML API yet, feel free to use our [Quic
2020
Note that by default, the `quality` parameter is set to `'medium'`. The output image will still look great, but for even more detailed results, consider setting this parameter to `'high'`.
2121
{% endhint %}
2222

23-
{% hint style="warning" %}
24-
Unfortunately, this model only accepts local files specified by their file paths. \
25-
It does not support image input via URLs or base64 encoding.
26-
{% endhint %}
27-
2823
### Generate image
2924

30-
{% openapi-operation spec="gpt-image-1" path="/v1/images/generations" method="post" %}
31-
[OpenAPI gpt-image-1](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/image-models/OpenAI/gpt-image-1.json)
25+
{% openapi-operation spec="gpt-image-1-gen" path="/v1/images/generations" method="post" %}
26+
[OpenAPI gpt-image-1-gen](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/image-models/OpenAI/gpt-image-1-gen.json)
3227
{% endopenapi-operation %}
3328

3429
### Edit image
3530

31+
{% hint style="warning" %}
32+
Unfortunately, this model only accepts local files specified by their file paths. \
33+
It does not support image input via URLs or base64 encoding.
34+
{% endhint %}
35+
3636
{% openapi-operation spec="gpt-image-1-edit" path="/v1/images/edits" method="post" %}
3737
[OpenAPI gpt-image-1-edit](https://api.aimlapi.com/docs-public-yaml)
3838
{% endopenapi-operation %}

0 commit comments

Comments
 (0)