Source: https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/
Canonical: https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/
Language: vi

# GPT Image 2.5 Sunburst

[Markdown](https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/index.md) · [JSON](https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/facts.json)

## [GPT Image 2.5 Sunburst](https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/)

GPT Image 2.5 Sunburst tạo ảnh từ yêu cầu văn bản. Hỗ trợ kích thước tùy chỉnh, mức chất lượng mở rộng và nền trong suốt; nhà sản xuất còn nhấn mạnh độ chính xác chỉnh sửa.

- [**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/#method-0)
- [**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image`](https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/#method-1)
- [**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image-2.5`](https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/#method-2)
- [**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image-2.5-latest`](https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/#method-3)
- [**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image-latest`](https://ailoot.ai/models/vi/gpt-image-2-5-sunburst/#method-4)

Về mô hình

Mô tả này trình bày khả năng của mô hình. Đầu vào, đầu ra và tùy chọn có trên Ailoot được liệt kê bên dưới cho phương thức đã chọn.

#### Tạo và xử lý ảnh

GPT Image 2.5 Sunburst là mô hình của OpenAI để tạo ảnh. Nhà sản xuất đặc biệt chú trọng độ chính xác khi chỉnh sửa tư liệu nguồn. Mô hình hỗ trợ yêu cầu văn bản và, trong những thao tác được cung cấp riêng, tư liệu nguồn hình ảnh.

Thẻ Ailoot hiện tại giới thiệu chế độ tạo ảnh từ văn bản. Có thể đặt cảnh, bố cục, phong cách và chi tiết của kết quả sắp tạo. Những cách dùng ảnh tham chiếu, chỉnh sửa và thay đổi vùng bằng mặt nạ do OpenAI mô tả cần hỗ trợ ảnh đầu vào riêng; có tạo ảnh từ văn bản không xác nhận hỗ trợ đó.

#### Chất lượng và hình dạng khung hình

Có `low`, `medium`, `high`, `xhigh`, `max` và `auto`. Chọn chất lượng điều khiển chế độ tạo ảnh. Nó khác với kích thước bố cục và mức nén tệp nhận được.

Kích thước có thể vuông, ngang, dọc, được chọn tự động hoặc đặt thủ công. Với kích thước tùy chỉnh, mỗi cạnh là bội số của 16 pixel và không vượt 3840 pixel. Diện tích phải nằm giữa 655 360 và 8 294 400 pixel, còn tỷ lệ cạnh dài với cạnh ngắn không vượt 3:1. Tất cả điều kiện được áp dụng đồng thời.

Nhà sản xuất đánh dấu độ phân giải trên `2560x1440` là thử nghiệm. Khung lớn cho phép chọn không gian bố cục phù hợp, nhưng không loại bỏ việc kiểm tra chữ và vị trí đối tượng.

#### Định dạng kết quả và nền

PNG được dùng mặc định; còn có JPEG và WebP. JPEG và WebP cho phép điều chỉnh nén. Nền trong suốt cần PNG hoặc WebP vì JPEG không giữ kênh alpha. Bên cạnh tính trong suốt còn có nền đục và lựa chọn tự động.

Kích thước, chất lượng, định dạng và nền chịu trách nhiệm cho các mặt khác nhau của kết quả. Phong cách ảnh được đặt bằng mô tả văn bản cùng nội dung cảnh. Cần xét hỗ trợ từng cài đặt riêng với khả năng chung của nhà sản xuất.

#### Độ chính xác chỉnh sửa và kiểm soát ảnh

Theo OpenAI, xử lý yêu cầu phức tạp có thể mất tới hai phút. Đây là mô tả tạo ảnh ở phía nhà sản xuất, không bảo đảm tổng thời gian nhận kết quả trong từng ứng dụng.

Trong thao tác chỉnh sửa được hỗ trợ riêng, mặt nạ định hướng thay đổi vùng đã chọn. Nó không bảo đảm kết quả khớp chặt với ranh giới, nên hứa hẹn chỉnh sửa cục bộ chính xác sẽ quá mạnh. Sử dụng chế độ đó cần cách truyền tư liệu nguồn tương ứng.

Khi tạo ảnh, mô hình cũng có thể đặt sai chữ, chi tiết hoặc thay đổi diện mạo nhân vật giữa các ảnh riêng. Kiểm soát chữ, bố cục và tính lặp lại thuộc bước kiểm tra tệp thành phẩm. Ngay cả yêu cầu chi tiết cũng không khiến những đặc tính này được bảo đảm.

**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image-2.5-sunburst`

[`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images)

OpenAI /`gpt-image-2.5-sunburst`

ID mô hình

- `gpt-image-2.5-sunburst`
- `gpt-image`
- `gpt-image-2.5`
- `gpt-image-2.5-latest`
- `gpt-image-latest`

### Bắt đầu

GPT Image 2.5 Sunburst tạo ảnh từ yêu cầu văn bản. Hỗ trợ kích thước tùy chỉnh, mức chất lượng mở rộng và nền trong suốt; nhà sản xuất còn nhấn mạnh độ chính xác chỉnh sửa.

Đầu vào được chấp nhận

Văn bản

Kết quả

Ảnh

### Có trên Ailoot · đầu vào & phương thức

**Ailoot · Ảnh** `POST /v1/images/generations`

Đầu vào

`text`

Đầu ra

`image`

Định dạng đầu ra

Tệp ảnh

| Trường | Loại | Yêu cầu | Giá trị & giới hạn | Mặc định |
| --- | --- | --- | --- | --- |
| Trường`model` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn gpt-image-2.5-sunburst | Mặc định— |
| Trường`prompt` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn Độ dài tối thiểu: 1 | Mặc định— |
| Trường`n` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tối thiểu: 1 | Mặc định1 |
| Trường`response_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn url, b64\_json | Mặc định— |
| Trường`stream` | Loại`boolean` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn | Mặc địnhfalse |
| Trường`size` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`quality` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`background` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_compression` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`moderation` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`input_fidelity` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`style` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`partial_images` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |

Tổ hợp tư liệu đầu vào

**Văn bản thành ảnh** · Bắt buộc: prompt

Tham số phương thức và vòng đời

| Tham số | Hợp đồng |
| --- | --- |
| Tham số`material_types` | Hợp đồngtext |
| Tham số`required` | Hợp đồngmodel, prompt |
| Tham số`optional_controls` | Hợp đồngnull |
| Tham số`content_type` | Hợp đồngapplication/json |

Vòng đời: `synchronous_result_then_owned_library`

`GET /v1/media/tasks/{task_id}` · Giá trị task\_id thực tế đã trả về hoặc bản ghi trong thư viện nội dung đa phương tiện

`GET /v1/media/assets/{asset_id}/content`

`GET /v1/media/assets`

`GET /v1/media/assets/{asset_id}`

Cấu trúc phương thức và ID là chính xác; khả năng của nhà cung cấp tách biệt với việc cho phép tiếp nhận yêu cầu.

### Bảng giá

#### Mức phí phương thức Ailoot

Đầu vào văn bản

0,005 US$ */ 1K*

Đầu vào, hình ảnh

0,008 US$ */ 1K tokens*

Đầu ra, hình ảnh

0,03 US$ */ 1K tokens*

Ailoot tạm giữ một khoản ước tính trước yêu cầu. Sau khi có kết quả, phí cuối cùng được quyết toán theo mức sử dụng đo được. Việc quyết toán khi truyền luồng dùng bản ghi mức sử dụng cuối cùng. [Cách hoạt động của cơ chế tạm giữ và quyết toán →](https://ailoot.ai/docs/vi/billing/reserve/)

### Ví dụ yêu cầu

#### Ailoot · Ảnh

curlPython SDKNode.js SDK

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image-2.5-sunburst", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
```

```python
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")

f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image-2.5-sunburst', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
```

```js
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image-2.5-sunburst", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
  const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
  if(!encoded && uri.startsWith("data:image/")) {
    const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
    encoded=uri.slice(comma+1);
  }
  if(encoded) {
    if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
    raw=Buffer.from(encoded,"base64");
  } else if(uri) {
    const u=new URL(uri,"https://api.ailoot.ai");
    if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
    const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
    const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
    if(!response.ok) throw new Error("Image content download failed: "+response.status);
    raw=Buffer.from(await response.arrayBuffer());
  } else throw new Error("Image has neither bytes nor URL");
  if(!raw.length) throw new Error("Empty image result");
  const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
  writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
```

### Nhận và lưu kết quả

#### Ailoot · Ảnh

Tải xuống từng ảnh trả về hoặc lưu nội dung Base64 của ảnh

- `GET /v1/media/tasks/{task_id}`
- `GET /v1/media/assets/{asset_id}/content`
- `GET /v1/media/assets`
- `GET /v1/media/assets/{asset_id}`

##### Lưu tất cả kết quả đã hoàn tất

Lưu mọi ảnh đã hoàn tất; truy xuất từng URL trả về hoặc giải mã nội dung Base64 của ảnh.

Lưu mọi phần tử dữ liệu. Giải mã từng b64\_json hoặc tải xuống từ mọi URL có chữ ký đã trả về. Chọn phần mở rộng tệp dựa trên MIME/nội dung byte thực tế.

##### Nếu cần kiểm tra phản hồi gốc

Nếu kết quả tạo hoặc chỉnh sửa ảnh cần được kiểm tra, giữ lại operation\_id/X-Client-Request-ID gốc và thông tin kết quả đã trả về. Khôi phục các kết quả hiện có thuộc quyền sở hữu của bạn qua thư viện nội dung đa phương tiện bằng các giá trị task\_id hoặc asset\_id thực tế. Không gửi lại yêu cầu tạo/chỉnh sửa ảnh hoặc tạo URL truy vấn trạng thái từ operation\_id.

Trường phản hồi

| Trường | Loại |
| --- | --- |
| Trường`created` | Loạiinteger |
| Trường`data[].url` | Loạistring |
| Trường`data[].b64_json` | Loạibase64 string |
| Trường`usage` | Loạiobject |

Lỗi và bước tiếp theo

| Phản hồi | Điều kiện | Bước tiếp theo |
| --- | --- | --- |
| Phản hồi400 · `invalid_request_error` | Điều kiệnTrường bắt buộc, cách biểu diễn tài liệu hoặc giá trị tham số không hợp lệ | Bước tiếp theoSửa các trường được chỉ ra trước khi gửi yêu cầu tạo mới. |
| Phản hồi`server_error` | Điều kiệnPhản hồi trả về cho biết thao tác hoặc kết quả cần được kiểm tra | Bước tiếp theoGiữ lại ID thao tác/tác vụ gốc đã trả về, các header của yêu cầu và toàn bộ phản hồi; tiếp tục truy xuất thao tác gốc đó bằng các phương thức được hỗ trợ. Không gửi lại yêu cầu tạo. |

### Bí danh

#### Bí danh mô hình

**Ailoot** [`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

#### Bí danh đường dẫn phương thức

Dùng các đường dẫn phương thức hiển thị ở trên.

#### ID gọi liên quan

[`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image`

[`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images)

OpenAI /`gpt-image`

ID mô hình

- `gpt-image-2.5-sunburst`
- `gpt-image`
- `gpt-image-2.5`
- `gpt-image-2.5-latest`
- `gpt-image-latest`

### Bắt đầu

GPT Image 2.5 Sunburst tạo ảnh từ yêu cầu văn bản. Hỗ trợ kích thước tùy chỉnh, mức chất lượng mở rộng và nền trong suốt; nhà sản xuất còn nhấn mạnh độ chính xác chỉnh sửa.

Đầu vào được chấp nhận

Văn bản

Kết quả

Ảnh

### Có trên Ailoot · đầu vào & phương thức

**Ailoot · Ảnh** `POST /v1/images/generations`

Đầu vào

`text`

Đầu ra

`image`

Định dạng đầu ra

Tệp ảnh

| Trường | Loại | Yêu cầu | Giá trị & giới hạn | Mặc định |
| --- | --- | --- | --- | --- |
| Trường`model` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn gpt-image | Mặc định— |
| Trường`prompt` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn Độ dài tối thiểu: 1 | Mặc định— |
| Trường`n` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tối thiểu: 1 | Mặc định1 |
| Trường`response_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn url, b64\_json | Mặc định— |
| Trường`stream` | Loại`boolean` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn | Mặc địnhfalse |
| Trường`size` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`quality` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`background` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_compression` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`moderation` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`input_fidelity` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`style` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`partial_images` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |

Tổ hợp tư liệu đầu vào

**Văn bản thành ảnh** · Bắt buộc: prompt

Tham số phương thức và vòng đời

| Tham số | Hợp đồng |
| --- | --- |
| Tham số`material_types` | Hợp đồngtext |
| Tham số`required` | Hợp đồngmodel, prompt |
| Tham số`optional_controls` | Hợp đồngnull |
| Tham số`content_type` | Hợp đồngapplication/json |

Vòng đời: `synchronous_result_then_owned_library`

`GET /v1/media/tasks/{task_id}` · Giá trị task\_id thực tế đã trả về hoặc bản ghi trong thư viện nội dung đa phương tiện

`GET /v1/media/assets/{asset_id}/content`

`GET /v1/media/assets`

`GET /v1/media/assets/{asset_id}`

Cấu trúc phương thức và ID là chính xác; khả năng của nhà cung cấp tách biệt với việc cho phép tiếp nhận yêu cầu.

### Bảng giá

#### Mức phí phương thức Ailoot

Đầu vào văn bản

0,005 US$ */ 1K*

Đầu vào, hình ảnh

0,008 US$ */ 1K tokens*

Đầu ra, hình ảnh

0,03 US$ */ 1K tokens*

Ailoot tạm giữ một khoản ước tính trước yêu cầu. Sau khi có kết quả, phí cuối cùng được quyết toán theo mức sử dụng đo được. Việc quyết toán khi truyền luồng dùng bản ghi mức sử dụng cuối cùng. [Cách hoạt động của cơ chế tạm giữ và quyết toán →](https://ailoot.ai/docs/vi/billing/reserve/)

### Ví dụ yêu cầu

#### Ailoot · Ảnh

curlPython SDKNode.js SDK

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
```

```python
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")

f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
```

```js
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
  const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
  if(!encoded && uri.startsWith("data:image/")) {
    const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
    encoded=uri.slice(comma+1);
  }
  if(encoded) {
    if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
    raw=Buffer.from(encoded,"base64");
  } else if(uri) {
    const u=new URL(uri,"https://api.ailoot.ai");
    if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
    const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
    const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
    if(!response.ok) throw new Error("Image content download failed: "+response.status);
    raw=Buffer.from(await response.arrayBuffer());
  } else throw new Error("Image has neither bytes nor URL");
  if(!raw.length) throw new Error("Empty image result");
  const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
  writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
```

### Nhận và lưu kết quả

#### Ailoot · Ảnh

Tải xuống từng ảnh trả về hoặc lưu nội dung Base64 của ảnh

- `GET /v1/media/tasks/{task_id}`
- `GET /v1/media/assets/{asset_id}/content`
- `GET /v1/media/assets`
- `GET /v1/media/assets/{asset_id}`

##### Lưu tất cả kết quả đã hoàn tất

Lưu mọi ảnh đã hoàn tất; truy xuất từng URL trả về hoặc giải mã nội dung Base64 của ảnh.

Lưu mọi phần tử dữ liệu. Giải mã từng b64\_json hoặc tải xuống từ mọi URL có chữ ký đã trả về. Chọn phần mở rộng tệp dựa trên MIME/nội dung byte thực tế.

##### Nếu cần kiểm tra phản hồi gốc

Nếu kết quả tạo hoặc chỉnh sửa ảnh cần được kiểm tra, giữ lại operation\_id/X-Client-Request-ID gốc và thông tin kết quả đã trả về. Khôi phục các kết quả hiện có thuộc quyền sở hữu của bạn qua thư viện nội dung đa phương tiện bằng các giá trị task\_id hoặc asset\_id thực tế. Không gửi lại yêu cầu tạo/chỉnh sửa ảnh hoặc tạo URL truy vấn trạng thái từ operation\_id.

Trường phản hồi

| Trường | Loại |
| --- | --- |
| Trường`created` | Loạiinteger |
| Trường`data[].url` | Loạistring |
| Trường`data[].b64_json` | Loạibase64 string |
| Trường`usage` | Loạiobject |

Lỗi và bước tiếp theo

| Phản hồi | Điều kiện | Bước tiếp theo |
| --- | --- | --- |
| Phản hồi400 · `invalid_request_error` | Điều kiệnTrường bắt buộc, cách biểu diễn tài liệu hoặc giá trị tham số không hợp lệ | Bước tiếp theoSửa các trường được chỉ ra trước khi gửi yêu cầu tạo mới. |
| Phản hồi`server_error` | Điều kiệnPhản hồi trả về cho biết thao tác hoặc kết quả cần được kiểm tra | Bước tiếp theoGiữ lại ID thao tác/tác vụ gốc đã trả về, các header của yêu cầu và toàn bộ phản hồi; tiếp tục truy xuất thao tác gốc đó bằng các phương thức được hỗ trợ. Không gửi lại yêu cầu tạo. |

### Bí danh

#### Bí danh mô hình

**Ailoot** [`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

#### Bí danh đường dẫn phương thức

Dùng các đường dẫn phương thức hiển thị ở trên.

#### ID gọi liên quan

[`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image-2.5`

[`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images)

OpenAI /`gpt-image-2.5`

ID mô hình

- `gpt-image-2.5-sunburst`
- `gpt-image`
- `gpt-image-2.5`
- `gpt-image-2.5-latest`
- `gpt-image-latest`

### Bắt đầu

GPT Image 2.5 Sunburst tạo ảnh từ yêu cầu văn bản. Hỗ trợ kích thước tùy chỉnh, mức chất lượng mở rộng và nền trong suốt; nhà sản xuất còn nhấn mạnh độ chính xác chỉnh sửa.

Đầu vào được chấp nhận

Văn bản

Kết quả

Ảnh

### Có trên Ailoot · đầu vào & phương thức

**Ailoot · Ảnh** `POST /v1/images/generations`

Đầu vào

`text`

Đầu ra

`image`

Định dạng đầu ra

Tệp ảnh

| Trường | Loại | Yêu cầu | Giá trị & giới hạn | Mặc định |
| --- | --- | --- | --- | --- |
| Trường`model` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn gpt-image-2.5 | Mặc định— |
| Trường`prompt` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn Độ dài tối thiểu: 1 | Mặc định— |
| Trường`n` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tối thiểu: 1 | Mặc định1 |
| Trường`response_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn url, b64\_json | Mặc định— |
| Trường`stream` | Loại`boolean` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn | Mặc địnhfalse |
| Trường`size` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`quality` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`background` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_compression` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`moderation` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`input_fidelity` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`style` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`partial_images` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |

Tổ hợp tư liệu đầu vào

**Văn bản thành ảnh** · Bắt buộc: prompt

Tham số phương thức và vòng đời

| Tham số | Hợp đồng |
| --- | --- |
| Tham số`material_types` | Hợp đồngtext |
| Tham số`required` | Hợp đồngmodel, prompt |
| Tham số`optional_controls` | Hợp đồngnull |
| Tham số`content_type` | Hợp đồngapplication/json |

Vòng đời: `synchronous_result_then_owned_library`

`GET /v1/media/tasks/{task_id}` · Giá trị task\_id thực tế đã trả về hoặc bản ghi trong thư viện nội dung đa phương tiện

`GET /v1/media/assets/{asset_id}/content`

`GET /v1/media/assets`

`GET /v1/media/assets/{asset_id}`

Cấu trúc phương thức và ID là chính xác; khả năng của nhà cung cấp tách biệt với việc cho phép tiếp nhận yêu cầu.

### Bảng giá

#### Mức phí phương thức Ailoot

Đầu vào văn bản

0,005 US$ */ 1K*

Đầu vào, hình ảnh

0,008 US$ */ 1K tokens*

Đầu ra, hình ảnh

0,03 US$ */ 1K tokens*

Ailoot tạm giữ một khoản ước tính trước yêu cầu. Sau khi có kết quả, phí cuối cùng được quyết toán theo mức sử dụng đo được. Việc quyết toán khi truyền luồng dùng bản ghi mức sử dụng cuối cùng. [Cách hoạt động của cơ chế tạm giữ và quyết toán →](https://ailoot.ai/docs/vi/billing/reserve/)

### Ví dụ yêu cầu

#### Ailoot · Ảnh

curlPython SDKNode.js SDK

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image-2.5", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
```

```python
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")

f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image-2.5', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
```

```js
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image-2.5", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
  const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
  if(!encoded && uri.startsWith("data:image/")) {
    const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
    encoded=uri.slice(comma+1);
  }
  if(encoded) {
    if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
    raw=Buffer.from(encoded,"base64");
  } else if(uri) {
    const u=new URL(uri,"https://api.ailoot.ai");
    if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
    const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
    const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
    if(!response.ok) throw new Error("Image content download failed: "+response.status);
    raw=Buffer.from(await response.arrayBuffer());
  } else throw new Error("Image has neither bytes nor URL");
  if(!raw.length) throw new Error("Empty image result");
  const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
  writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
```

### Nhận và lưu kết quả

#### Ailoot · Ảnh

Tải xuống từng ảnh trả về hoặc lưu nội dung Base64 của ảnh

- `GET /v1/media/tasks/{task_id}`
- `GET /v1/media/assets/{asset_id}/content`
- `GET /v1/media/assets`
- `GET /v1/media/assets/{asset_id}`

##### Lưu tất cả kết quả đã hoàn tất

Lưu mọi ảnh đã hoàn tất; truy xuất từng URL trả về hoặc giải mã nội dung Base64 của ảnh.

Lưu mọi phần tử dữ liệu. Giải mã từng b64\_json hoặc tải xuống từ mọi URL có chữ ký đã trả về. Chọn phần mở rộng tệp dựa trên MIME/nội dung byte thực tế.

##### Nếu cần kiểm tra phản hồi gốc

Nếu kết quả tạo hoặc chỉnh sửa ảnh cần được kiểm tra, giữ lại operation\_id/X-Client-Request-ID gốc và thông tin kết quả đã trả về. Khôi phục các kết quả hiện có thuộc quyền sở hữu của bạn qua thư viện nội dung đa phương tiện bằng các giá trị task\_id hoặc asset\_id thực tế. Không gửi lại yêu cầu tạo/chỉnh sửa ảnh hoặc tạo URL truy vấn trạng thái từ operation\_id.

Trường phản hồi

| Trường | Loại |
| --- | --- |
| Trường`created` | Loạiinteger |
| Trường`data[].url` | Loạistring |
| Trường`data[].b64_json` | Loạibase64 string |
| Trường`usage` | Loạiobject |

Lỗi và bước tiếp theo

| Phản hồi | Điều kiện | Bước tiếp theo |
| --- | --- | --- |
| Phản hồi400 · `invalid_request_error` | Điều kiệnTrường bắt buộc, cách biểu diễn tài liệu hoặc giá trị tham số không hợp lệ | Bước tiếp theoSửa các trường được chỉ ra trước khi gửi yêu cầu tạo mới. |
| Phản hồi`server_error` | Điều kiệnPhản hồi trả về cho biết thao tác hoặc kết quả cần được kiểm tra | Bước tiếp theoGiữ lại ID thao tác/tác vụ gốc đã trả về, các header của yêu cầu và toàn bộ phản hồi; tiếp tục truy xuất thao tác gốc đó bằng các phương thức được hỗ trợ. Không gửi lại yêu cầu tạo. |

### Bí danh

#### Bí danh mô hình

**Ailoot** [`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

#### Bí danh đường dẫn phương thức

Dùng các đường dẫn phương thức hiển thị ở trên.

#### ID gọi liên quan

[`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image-2.5-latest`

[`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images)

OpenAI /`gpt-image-2.5-latest`

ID mô hình

- `gpt-image-2.5-sunburst`
- `gpt-image`
- `gpt-image-2.5`
- `gpt-image-2.5-latest`
- `gpt-image-latest`

### Bắt đầu

GPT Image 2.5 Sunburst tạo ảnh từ yêu cầu văn bản. Hỗ trợ kích thước tùy chỉnh, mức chất lượng mở rộng và nền trong suốt; nhà sản xuất còn nhấn mạnh độ chính xác chỉnh sửa.

Đầu vào được chấp nhận

Văn bản

Kết quả

Ảnh

### Có trên Ailoot · đầu vào & phương thức

**Ailoot · Ảnh** `POST /v1/images/generations`

Đầu vào

`text`

Đầu ra

`image`

Định dạng đầu ra

Tệp ảnh

| Trường | Loại | Yêu cầu | Giá trị & giới hạn | Mặc định |
| --- | --- | --- | --- | --- |
| Trường`model` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn gpt-image-2.5-latest | Mặc định— |
| Trường`prompt` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn Độ dài tối thiểu: 1 | Mặc định— |
| Trường`n` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tối thiểu: 1 | Mặc định1 |
| Trường`response_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn url, b64\_json | Mặc định— |
| Trường`stream` | Loại`boolean` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn | Mặc địnhfalse |
| Trường`size` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`quality` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`background` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_compression` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`moderation` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`input_fidelity` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`style` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`partial_images` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |

Tổ hợp tư liệu đầu vào

**Văn bản thành ảnh** · Bắt buộc: prompt

Tham số phương thức và vòng đời

| Tham số | Hợp đồng |
| --- | --- |
| Tham số`material_types` | Hợp đồngtext |
| Tham số`required` | Hợp đồngmodel, prompt |
| Tham số`optional_controls` | Hợp đồngnull |
| Tham số`content_type` | Hợp đồngapplication/json |

Vòng đời: `synchronous_result_then_owned_library`

`GET /v1/media/tasks/{task_id}` · Giá trị task\_id thực tế đã trả về hoặc bản ghi trong thư viện nội dung đa phương tiện

`GET /v1/media/assets/{asset_id}/content`

`GET /v1/media/assets`

`GET /v1/media/assets/{asset_id}`

Cấu trúc phương thức và ID là chính xác; khả năng của nhà cung cấp tách biệt với việc cho phép tiếp nhận yêu cầu.

### Bảng giá

#### Mức phí phương thức Ailoot

Đầu vào văn bản

0,005 US$ */ 1K*

Đầu vào, hình ảnh

0,008 US$ */ 1K tokens*

Đầu ra, hình ảnh

0,03 US$ */ 1K tokens*

Ailoot tạm giữ một khoản ước tính trước yêu cầu. Sau khi có kết quả, phí cuối cùng được quyết toán theo mức sử dụng đo được. Việc quyết toán khi truyền luồng dùng bản ghi mức sử dụng cuối cùng. [Cách hoạt động của cơ chế tạm giữ và quyết toán →](https://ailoot.ai/docs/vi/billing/reserve/)

### Ví dụ yêu cầu

#### Ailoot · Ảnh

curlPython SDKNode.js SDK

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image-2.5-latest", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
```

```python
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")

f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image-2.5-latest', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
```

```js
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image-2.5-latest", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
  const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
  if(!encoded && uri.startsWith("data:image/")) {
    const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
    encoded=uri.slice(comma+1);
  }
  if(encoded) {
    if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
    raw=Buffer.from(encoded,"base64");
  } else if(uri) {
    const u=new URL(uri,"https://api.ailoot.ai");
    if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
    const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
    const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
    if(!response.ok) throw new Error("Image content download failed: "+response.status);
    raw=Buffer.from(await response.arrayBuffer());
  } else throw new Error("Image has neither bytes nor URL");
  if(!raw.length) throw new Error("Empty image result");
  const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
  writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
```

### Nhận và lưu kết quả

#### Ailoot · Ảnh

Tải xuống từng ảnh trả về hoặc lưu nội dung Base64 của ảnh

- `GET /v1/media/tasks/{task_id}`
- `GET /v1/media/assets/{asset_id}/content`
- `GET /v1/media/assets`
- `GET /v1/media/assets/{asset_id}`

##### Lưu tất cả kết quả đã hoàn tất

Lưu mọi ảnh đã hoàn tất; truy xuất từng URL trả về hoặc giải mã nội dung Base64 của ảnh.

Lưu mọi phần tử dữ liệu. Giải mã từng b64\_json hoặc tải xuống từ mọi URL có chữ ký đã trả về. Chọn phần mở rộng tệp dựa trên MIME/nội dung byte thực tế.

##### Nếu cần kiểm tra phản hồi gốc

Nếu kết quả tạo hoặc chỉnh sửa ảnh cần được kiểm tra, giữ lại operation\_id/X-Client-Request-ID gốc và thông tin kết quả đã trả về. Khôi phục các kết quả hiện có thuộc quyền sở hữu của bạn qua thư viện nội dung đa phương tiện bằng các giá trị task\_id hoặc asset\_id thực tế. Không gửi lại yêu cầu tạo/chỉnh sửa ảnh hoặc tạo URL truy vấn trạng thái từ operation\_id.

Trường phản hồi

| Trường | Loại |
| --- | --- |
| Trường`created` | Loạiinteger |
| Trường`data[].url` | Loạistring |
| Trường`data[].b64_json` | Loạibase64 string |
| Trường`usage` | Loạiobject |

Lỗi và bước tiếp theo

| Phản hồi | Điều kiện | Bước tiếp theo |
| --- | --- | --- |
| Phản hồi400 · `invalid_request_error` | Điều kiệnTrường bắt buộc, cách biểu diễn tài liệu hoặc giá trị tham số không hợp lệ | Bước tiếp theoSửa các trường được chỉ ra trước khi gửi yêu cầu tạo mới. |
| Phản hồi`server_error` | Điều kiệnPhản hồi trả về cho biết thao tác hoặc kết quả cần được kiểm tra | Bước tiếp theoGiữ lại ID thao tác/tác vụ gốc đã trả về, các header của yêu cầu và toàn bộ phản hồi; tiếp tục truy xuất thao tác gốc đó bằng các phương thức được hỗ trợ. Không gửi lại yêu cầu tạo. |

### Bí danh

#### Bí danh mô hình

**Ailoot** [`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

#### Bí danh đường dẫn phương thức

Dùng các đường dẫn phương thức hiển thị ở trên.

#### ID gọi liên quan

[`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

**Ailoot · Ảnh** `POST /v1/images/generations` `gpt-image-latest`

[`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

OpenAI /`gpt-image-latest`

ID mô hình

- `gpt-image-2.5-sunburst`
- `gpt-image`
- `gpt-image-2.5`
- `gpt-image-2.5-latest`
- `gpt-image-latest`

### Bắt đầu

GPT Image 2.5 Sunburst tạo ảnh từ yêu cầu văn bản. Hỗ trợ kích thước tùy chỉnh, mức chất lượng mở rộng và nền trong suốt; nhà sản xuất còn nhấn mạnh độ chính xác chỉnh sửa.

Đầu vào được chấp nhận

Văn bản

Kết quả

Ảnh

### Có trên Ailoot · đầu vào & phương thức

**Ailoot · Ảnh** `POST /v1/images/generations`

Đầu vào

`text`

Đầu ra

`image`

Định dạng đầu ra

Tệp ảnh

| Trường | Loại | Yêu cầu | Giá trị & giới hạn | Mặc định |
| --- | --- | --- | --- | --- |
| Trường`model` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn gpt-image-latest | Mặc định— |
| Trường`prompt` | Loại`string` | Yêu cầuBắt buộc | Giá trị & giới hạn Độ dài tối thiểu: 1 | Mặc định— |
| Trường`n` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tối thiểu: 1 | Mặc định1 |
| Trường`response_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn url, b64\_json | Mặc định— |
| Trường`stream` | Loại`boolean` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn | Mặc địnhfalse |
| Trường`size` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`quality` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`background` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_format` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`output_compression` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`moderation` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`input_fidelity` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`style` | Loại`string` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |
| Trường`partial_images` | Loại`integer` | Yêu cầuKhông bắt buộc | Giá trị & giới hạn Tùy thuộc vào mô hình | Mặc định— |

Tổ hợp tư liệu đầu vào

**Văn bản thành ảnh** · Bắt buộc: prompt

Tham số phương thức và vòng đời

| Tham số | Hợp đồng |
| --- | --- |
| Tham số`material_types` | Hợp đồngtext |
| Tham số`required` | Hợp đồngmodel, prompt |
| Tham số`optional_controls` | Hợp đồngnull |
| Tham số`content_type` | Hợp đồngapplication/json |

Vòng đời: `synchronous_result_then_owned_library`

`GET /v1/media/tasks/{task_id}` · Giá trị task\_id thực tế đã trả về hoặc bản ghi trong thư viện nội dung đa phương tiện

`GET /v1/media/assets/{asset_id}/content`

`GET /v1/media/assets`

`GET /v1/media/assets/{asset_id}`

Cấu trúc phương thức và ID là chính xác; khả năng của nhà cung cấp tách biệt với việc cho phép tiếp nhận yêu cầu.

### Bảng giá

#### Mức phí phương thức Ailoot

Đầu vào văn bản

0,005 US$ */ 1K*

Đầu vào, hình ảnh

0,008 US$ */ 1K tokens*

Đầu ra, hình ảnh

0,03 US$ */ 1K tokens*

Ailoot tạm giữ một khoản ước tính trước yêu cầu. Sau khi có kết quả, phí cuối cùng được quyết toán theo mức sử dụng đo được. Việc quyết toán khi truyền luồng dùng bản ghi mức sử dụng cuối cùng. [Cách hoạt động của cơ chế tạm giữ và quyết toán →](https://ailoot.ai/docs/vi/billing/reserve/)

### Ví dụ yêu cầu

#### Ailoot · Ảnh

curlPython SDKNode.js SDK

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
export AILOOT_API_KEY
: "${AILOOT_PROMPT_FILE:?Set your actual UTF-8 image brief}"
export AILOOT_PROMPT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "gpt-image-latest", "prompt": ""}')
f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 brief")
p['prompt']=f.read_text(encoding="utf-8")
if not p['prompt'].strip():raise SystemExit("Brief must contain text")
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
```

```python
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin

def save_images(items):
    if not items: raise SystemExit("No completed images; retain the full response")
    for index, item in enumerate(items):
        encoded=item.get("b64_json")
        uri=item.get("url", "")
        if not encoded and uri.startswith("data:image/"):
            header, separator, encoded=uri.partition(",")
            if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
        if encoded:
            raw=base64.b64decode(encoded,validate=True)
        elif uri:
            uri=urljoin("https://api.ailoot.ai",uri)
            parsed=urlsplit(uri)
            if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
                raise SystemExit("Invalid returned image URL")
            owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
            args=["curl","--fail-with-body","--silent","--show-error",uri]
            if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
            temporary=Path(f"image-{index}.bin")
            subprocess.run(args+["-o",str(temporary)],check=True)
            raw=temporary.read_bytes()
            temporary.unlink()
        else: raise SystemExit("Image has neither bytes nor URL")
        if not raw: raise SystemExit("Empty image result")
        ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
        Path(f"image-{index}.{ext}").write_bytes(raw)
    print("Every returned image saved; complete response metadata retained")

f=Path(os.environ["AILOOT_PROMPT_FILE"])
if not f.is_file():raise SystemExit("Set your actual UTF-8 image brief file")
request={'model': 'gpt-image-latest', 'prompt': ''}
request["prompt"]=f.read_text(encoding="utf-8")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
```

```js
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "gpt-image-latest", "prompt": ""};
if(!process.env.AILOOT_PROMPT_FILE)throw new Error("Set your actual UTF-8 image brief file");
request.prompt=readFileSync(process.env.AILOOT_PROMPT_FILE,"utf8");
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
  const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
  if(!encoded && uri.startsWith("data:image/")) {
    const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
    encoded=uri.slice(comma+1);
  }
  if(encoded) {
    if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
    raw=Buffer.from(encoded,"base64");
  } else if(uri) {
    const u=new URL(uri,"https://api.ailoot.ai");
    if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
    const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
    const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
    if(!response.ok) throw new Error("Image content download failed: "+response.status);
    raw=Buffer.from(await response.arrayBuffer());
  } else throw new Error("Image has neither bytes nor URL");
  if(!raw.length) throw new Error("Empty image result");
  const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
  writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
```

### Nhận và lưu kết quả

#### Ailoot · Ảnh

Tải xuống từng ảnh trả về hoặc lưu nội dung Base64 của ảnh

- `GET /v1/media/tasks/{task_id}`
- `GET /v1/media/assets/{asset_id}/content`
- `GET /v1/media/assets`
- `GET /v1/media/assets/{asset_id}`

##### Lưu tất cả kết quả đã hoàn tất

Lưu mọi ảnh đã hoàn tất; truy xuất từng URL trả về hoặc giải mã nội dung Base64 của ảnh.

Lưu mọi phần tử dữ liệu. Giải mã từng b64\_json hoặc tải xuống từ mọi URL có chữ ký đã trả về. Chọn phần mở rộng tệp dựa trên MIME/nội dung byte thực tế.

##### Nếu cần kiểm tra phản hồi gốc

Nếu kết quả tạo hoặc chỉnh sửa ảnh cần được kiểm tra, giữ lại operation\_id/X-Client-Request-ID gốc và thông tin kết quả đã trả về. Khôi phục các kết quả hiện có thuộc quyền sở hữu của bạn qua thư viện nội dung đa phương tiện bằng các giá trị task\_id hoặc asset\_id thực tế. Không gửi lại yêu cầu tạo/chỉnh sửa ảnh hoặc tạo URL truy vấn trạng thái từ operation\_id.

Trường phản hồi

| Trường | Loại |
| --- | --- |
| Trường`created` | Loạiinteger |
| Trường`data[].url` | Loạistring |
| Trường`data[].b64_json` | Loạibase64 string |
| Trường`usage` | Loạiobject |

Lỗi và bước tiếp theo

| Phản hồi | Điều kiện | Bước tiếp theo |
| --- | --- | --- |
| Phản hồi400 · `invalid_request_error` | Điều kiệnTrường bắt buộc, cách biểu diễn tài liệu hoặc giá trị tham số không hợp lệ | Bước tiếp theoSửa các trường được chỉ ra trước khi gửi yêu cầu tạo mới. |
| Phản hồi`server_error` | Điều kiệnPhản hồi trả về cho biết thao tác hoặc kết quả cần được kiểm tra | Bước tiếp theoGiữ lại ID thao tác/tác vụ gốc đã trả về, các header của yêu cầu và toàn bộ phản hồi; tiếp tục truy xuất thao tác gốc đó bằng các phương thức được hỗ trợ. Không gửi lại yêu cầu tạo. |

### Bí danh

#### Bí danh mô hình

**Ailoot** [`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

#### Bí danh đường dẫn phương thức

Dùng các đường dẫn phương thức hiển thị ở trên.

#### ID gọi liên quan

[`gpt-image-2.5-sunburst`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-sunburst&fmt=images), [`gpt-image`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image&fmt=images), [`gpt-image-2.5`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5&fmt=images), [`gpt-image-2.5-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-2.5-latest&fmt=images), [`gpt-image-latest`](https://ailoot.ai/models/vi/#m=gpt-image-2.5-sunburst&route=Core&caller=gpt-image-latest&fmt=images)

FAQ · GPT Image 2.5 Sunburst

Có những đầu vào và kết quả nào?

`POST /v1/images/generations` · `gpt-image-2.5-sunburst`: `text` → `image` `POST /v1/images/generations` · `gpt-image`: `text` → `image` `POST /v1/images/generations` · `gpt-image-2.5`: `text` → `image` `POST /v1/images/generations` · `gpt-image-2.5-latest`: `text` → `image` `POST /v1/images/generations` · `gpt-image-latest`: `text` → `image`

Yêu cầu sử dụng những trường nào?

`POST /v1/images/generations` · `gpt-image-2.5-sunburst`: `model`, `prompt`, `n`, `response_format`, `stream` `POST /v1/images/generations` · `gpt-image`: `model`, `prompt`, `n`, `response_format`, `stream` `POST /v1/images/generations` · `gpt-image-2.5`: `model`, `prompt`, `n`, `response_format`, `stream` `POST /v1/images/generations` · `gpt-image-2.5-latest`: `model`, `prompt`, `n`, `response_format`, `stream` `POST /v1/images/generations` · `gpt-image-latest`: `model`, `prompt`, `n`, `response_format`, `stream`

Áp dụng những giới hạn nào?

`POST /v1/images/generations` · `gpt-image-2.5-sunburst`: `n.minimum`: `1` `POST /v1/images/generations` · `gpt-image`: `n.minimum`: `1` `POST /v1/images/generations` · `gpt-image-2.5`: `n.minimum`: `1` `POST /v1/images/generations` · `gpt-image-2.5-latest`: `n.minimum`: `1` `POST /v1/images/generations` · `gpt-image-latest`: `n.minimum`: `1`

Kết nối Ailoot với Claude Code, OpenCode, Hermes hoặc ứng dụng của bạn.

## Công ty và danh mục dự án của công ty

Công ty và danh mục dự án của công ty: hàng triệu khách hàng; doanh số hàng tỷ mỗi tháng.

## Mua token với giá ưu đãi.

Ưu đãi thuê bao cho nhu cầu thường xuyên. Mã khuyến mãi giảm đến 50% khi mua token.

Thuê bao

Chọn gói ưu đãi cho các yêu cầu thường xuyên của bạn.

Mã giảm đến 50%

Nhập mã khi mua. Giá được tính lại theo chương trình đang áp dụng.

Chi phí trong lịch sử

Mô hình, token và số tiền được lưu cho mỗi yêu cầu.

[Chọn gói thuê bao](https://ailoot.ai/docs/vi/billing/subscriptions/) · [Xem giá mô hình](https://ailoot.ai/models/vi/)

## Kết nối API vào sản phẩm bạn đang bán.

SaaS, ứng dụng và bot — theo đề nghị giao kết chính thức và thỏa thuận cấp phép Ailoot. Muốn bán lại, hãy yêu cầu giấy phép bán lại.

Ứng dụng thương mại

Tích hợp tạo văn bản, ảnh, video và âm thanh vào các tính năng trả phí của dịch vụ.

Giấy phép bán lại

Gửi mô tả dự án và cách cung cấp quyền truy cập. Yêu cầu điều khoản sử dụng và bán lại bằng văn bản.

Tài liệu trên website

Đề nghị giao kết, thỏa thuận cấp phép và chính sách xử lý dữ liệu có sẵn trước khi kết nối.

[Yêu cầu giấy phép bán lại](mailto:support@ailoot.ai) · [Đề nghị giao kết và thỏa thuận cấp phép](https://ailoot.ai/legal/offer?lang=vi)

## Ailoot · Công ty và danh mục dự án của công ty





Ailoot dựa trên kinh nghiệm vận hành tích lũy, cơ sở khách hàng lớn, dịch vụ ổn định và việc kiểm soát KPI liên tục.





Công ty và danh mục dự án của công ty: hàng triệu khách hàng; doanh số hàng tỷ mỗi tháng.





Ailoot áp dụng kinh nghiệm vận hành này để cung cấp quyền truy cập API vào các tính năng AI trong sản phẩm của khách hàng, tác tử, ứng dụng và quy trình tự động hóa.
