# AI 攝影棚

# 概述 (Overview)
享受 AI 攝影棚如實體攝影棚般的體驗。一張自拍，瞬間變成攝影棚級質感的人像照。
* 不用跑攝影棚：不必找攝影師、不必約棚拍，隨時隨地都能產出攝影棚級的設計感照片
* 快速換裝出片：處理速度快，高品質設計感照片立刻到手，適合想快速更新形象的時候
* 高品質設計感輸出：細節清晰、光線到位，專業級設計感照片，就像真的在攝影棚拍的一樣

使用案例：
![AI Studio Generator](https://bcw-media.s3.ap-northeast-1.amazonaws.com/yce_web_AI_studio_S1_img_19b627b6af.jpg)
![AI Studio Generator](https://bcw-media.s3.ap-northeast-1.amazonaws.com/yce_web_AI_studio_S2_img_01_2e318817e9.jpg)
拍攝建議：
![Suggestions for How to Shoot](https://bcw-media.s3.ap-northeast-1.amazonaws.com/AI_Hair_Extension_recommendation_ba24bd5d92.png)


---

## 整合指南 (Integration Guide)
* AI 攝影棚使用指南

本指南說明如何準備來源圖片、挑選範本，以及執行 AI 攝影棚任務。


---

* 步驟 1. 列出預設範本

用**範本 API**（`/s2s/v2.0/task/template/ai-studio`）列出預設範本，並將範本的 `id` 作為 `template_id` 使用。


---

* 步驟 2. 準備來源圖片

用 **File API**（`/s2s/v2.0/file/ai-studio`）上傳來源圖片，並將回應中的 `file_id` 作為 `src_file_id` 使用。您也可以直接傳公開可取的圖片 URL 作為 `src_file_url`，跳過 File API。


---

* 步驟 3. 建立 AI 任務

用 **AI 任務 API**（`/s2s/v2.0/task/ai-studio`），傳入範本 ID、來源圖片與要生成的照片張數：

```bash
curl --request POST \
  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/ai-studio \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'content-type: application/json' \
  --data '{"template_id":"YOUR_TEMPLATE_ID","src_file_url":"https://example.com/selfie.jpg","output_count":10}'
```
> 單張輸出任務：`/s2s/v2.0/task/ai-studio-single` 每個任務恰好輸出一張照片，與上述端點並存。請求欄位相同但不含 `output_count`——傳入 `output_count` 會回傳 `InvalidParameters`。輸出的 `data.results` 是帶有 `url` 欄位的單一物件，不是陣列。



---

* 步驟 4. 輪詢任務結果

用建立任務回應裡的 `task_id` 查詢狀態。單張輸出任務則改查 `/s2s/v2.0/task/ai-studio-single/{task_id}`。

```bash
curl --request GET \
  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/ai-studio/YOUR_TASK_ID \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'content-type: application/json'
```


---

* 步驟 5. 取得結果

成功的回應會包含結果照片的下載 URL。單張輸出任務的 `data.results` 以帶有 `url` 欄位的單一物件回傳，而非陣列。

```json
{
  "status": 200,
  "data": {
    "error": null,
    "results": {
      "output": [
        { "url": "https://example.com/sample-result-url" }
      ]
    },
    "task_status": "success"
  }
}
```


---

## 檔案規格與錯誤 (File Specs & Errors)
* 支援格式與尺寸

| AI 功能 | 支援尺寸 | 支援檔案大小 | 支援格式 |
|  --- | --- | --- | --- |
| AI 攝影棚 | 請確認輸入圖片有一張臉、短邊至少 200 像素、長邊不超過 1920 像素；若偵測到多張臉，引擎會選用最大的那張，輸出解析度不超過 960×1280（W×H） | < 10MB | jpg/jpeg/png |

* 錯誤碼

| Error Code | Description |
|  --- | --- |
| error_below_min_image_size | 輸入圖片解析度過小 |
| error_exceed_max_image_size | 輸入圖片解析度過大 |



---

## 點數消耗 (Unit Consumption)
| AI 功能 | 消耗點數 |
|  --- | --- |
| AI 攝影棚 V3.0 | 2 張 1 點 * |
|  | 1 張 0.5 點 |

> *若圖片張數或影片長度無法整除，點數無條件進位。



---

License: Privacy policy

## Servers

```
https://yce-api-01.makeupar.com
```

## Security

### BearerAuthenticationV2

使用標準的 'Bearer authentication'。請在標頭中放入您的 'API Key'：`Authorization:Bearer YOUR_API_KEY`。請注意 'Bearer' 與 'YOUR_API_KEY' 之間有一個空格。

Type: http
Scheme: bearer

## Download OpenAPI description

 - [AI 攝影棚](https://docs.perfectcorp.com/_bundle/@l10n/zh-TW/reference/ai_studio_generator.yaml)

## V3.0

 - [GET /s2s/v2.0/task/template/ai-studio](https://docs.perfectcorp.com/zh-tw/reference/ai_studio_generator/v3.0/paths/~1s2s~1v2.0~1task~1template~1ai-studio/get.md)
 - [POST /s2s/v2.0/task/ai-studio](https://docs.perfectcorp.com/zh-tw/reference/ai_studio_generator/v3.0/paths/~1s2s~1v2.0~1task~1ai-studio/post.md): 查詢任務狀態請參考輪詢指南。需要來源照片、範本 ID 與輸出數量設定。
 - [GET /s2s/v2.0/task/ai-studio/{task_id}](https://docs.perfectcorp.com/zh-tw/reference/ai_studio_generator/v3.0/paths/~1s2s~1v2.0~1task~1ai-studio~1%7Btask_id%7D/get.md)
 - [POST /s2s/v2.0/task/ai-studio-single](https://docs.perfectcorp.com/zh-tw/reference/ai_studio_generator/v3.0/paths/~1s2s~1v2.0~1task~1ai-studio-single/post.md): Please refer to the polling guide for checking task status. Requires a source image and a template ID. This endpoint always outputs exactly one photo, so `output_count` is not accepted: sending it ret
