Ideal House
跳转到主要内容

家具试摆 API 文档#

基础 URL: https://api.ideal.house
版本: v1
更新日期: 2026-03-09


📖 概述#

家具试摆 API 允许您使用 AI 将家具虚拟放置到房间场景中。您提供一张房间图片和一份家具列表(每件包含图片和产品 ID),AI 会将家具无缝合成到场景之中。该工作流程为异步模式,包含两个步骤:

  1. 创建任务 — 提交您的房间图片和家具列表,然后获取一个 taskId
  2. 轮询结果 — 使用 taskId 查询任务状态并获取生成的图片。

📌 注意: 目前仅支持 creative 模式。


🔐 认证#

所有 API 请求必须使用 API Key 进行认证。

将您的 API Key 包含在请求头中:

请求头
APIKEYyour_api_key_here

⚠️ 请妥善保管您的 API Key。 请勿将其暴露在客户端代码或公开仓库中。


💰 积分扣除#

[!WARNING] 🪙 任务创建成功后,将根据所选的 modelType 扣除积分。如果任务最终失败,所扣除的积分将自动退还至您的账户。
积分不足将返回错误码 9051。📄 请参阅 积分扣除参考

模型(modelType扣除积分
Base3 积分
Pro10 积分

📌 API 端点#


1. 创建家具试摆任务#

创建一个新的 AI 家具试摆任务,并返回一个用于轮询的唯一 taskId

端点

纯文本
POST /api/v1/furnitureTryOn/generate

请求头

请求头是否必填描述
APIKEY✅ 是您的 API 认证密钥
Content-Type✅ 是application/json

请求体

字段类型是否必填描述
imageUrlstring✅ 是将被放置家具的房间场景图片的 URL
furnitureListarray✅ 是要放置到场景中的家具列表。最多 6 件物品。 参见 家具商品对象
promptstring❌ 可选自定义文本提示,用于进一步引导摆放和样式
modelTypestring❌ 可选模型质量类型。枚举值:BasePro。默认为 Base

🛋️ 家具商品对象#

furnitureList 中的每一项必须是包含以下字段的对象:

字段类型是否必填描述
imageUrlstring✅ 是家具商品图片的 URL(建议使用透明或干净背景的图片)

⚠️ furnitureList 最多可包含 6 件物品。

🖼️ 图片要求: 房间图片和每件家具图片必须使用 JPG/JPEG、PNG 或 WebP 格式。每张大小不超过 20 MB,尺寸范围为 128 × 128 px6,000 × 6,000 px(含边界值)。超出最大像素尺寸的图片将按比例缩小以适配 6,000 × 6,000 px 后再进行处理。图片 URLs 必须能被 API 服务器直接访问。

示例

json
"furnitureList": [
  {
    "imageUrl": "https://example.com/sofa.png"
  },
  {
    "imageUrl": "https://example.com/table.png"
  }
]

模型类型

描述
Base默认值。 速度与质量均衡
Pro更高质量的输出,处理速度较慢

📥 请求示例#

cURL
bash
# Basic request (Base model)
curl -X POST "https://api.ideal.house/api/v1/furnitureTryOn/generate" \
  -H "APIKEY: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "imageUrl": "https://example.com/living-room.jpg",
    "furnitureList": [
      {
        "imageUrl": "https://example.com/sofa.png"
      },
      {
        "imageUrl": "https://example.com/coffee-table.png"
      }
    ],
    "prompt": "modern minimalist style"
  }'

# Pro model
curl -X POST "https://api.ideal.house/api/v1/furnitureTryOn/generate" \
  -H "APIKEY: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "imageUrl": "https://example.com/living-room.jpg",
    "furnitureList": [
      {
        "imageUrl": "https://example.com/sofa.png"
      }
    ],
    "prompt": "Scandinavian interior with warm lighting",
    "modelType": "Pro"
  }'
Java (OkHttp)
java
import okhttp3.*;
import java.io.IOException;

public class FurnitureTryOnApiExample {

    private static final String BASE_URL = "https://api.ideal.house";
    private static final String API_KEY  = "your_api_key_here";

    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        String requestBody = """
            {
                "imageUrl": "https://example.com/living-room.jpg",
                "furnitureList": [
                    {
                        "imageUrl": "https://example.com/sofa.png"
                    },
                    {
                        "imageUrl": "https://example.com/coffee-table.png"
                    }
                ],
                "prompt": "modern minimalist style",
                "modelType": "Base"
            }
            """;

        Request request = new Request.Builder()
            .url(BASE_URL + "/api/v1/furnitureTryOn/generate")
            .addHeader("APIKEY", API_KEY)
            .addHeader("Content-Type", "application/json")
            .post(RequestBody.create(requestBody, MediaType.parse("application/json")))
            .build();

        try (Response response = client.newCall(request).execute()) {
            System.out.println("Response: " + response.body().string());
        }
    }
}
Python (requests)
python
import requests

BASE_URL = "https://api.ideal.house"
API_KEY  = "your_api_key_here"

headers = {
    "APIKEY": API_KEY,
    "Content-Type": "application/json"
}

payload = {
    "imageUrl": "https://example.com/living-room.jpg",
    "furnitureList": [
        {
            "imageUrl": "https://example.com/sofa.png"
        },
        {
            "imageUrl": "https://example.com/coffee-table.png"
        }
    ],
    "prompt": "modern minimalist style",
    "modelType": "Base"
}

# Pro model example:
# payload = {
#     "imageUrl": "https://example.com/living-room.jpg",
#     "furnitureList": [
#         {
#             "imageUrl": "https://example.com/sofa.png"
#         }
#     ],
#     "prompt": "Scandinavian interior with warm lighting",
#     "modelType": "Pro"
# }

response = requests.post(
    f"{BASE_URL}/api/v1/furnitureTryOn/generate",
    headers=headers,
    json=payload
)

data = response.json()
task_id = data.get("data")
print(f"Task ID: {task_id}")
Node.js (axios)
javascript
const axios = require('axios');

const BASE_URL = 'https://api.ideal.house';
const API_KEY  = 'your_api_key_here';

async function createFurnitureTryOnTask() {
  try {
    const response = await axios.post(
      `${BASE_URL}/api/v1/furnitureTryOn/generate`,
      {
        imageUrl: 'https://example.com/living-room.jpg',
        furnitureList: [
          {
            imageUrl: 'https://example.com/sofa.png'
          },
          {
            imageUrl: 'https://example.com/coffee-table.png'
          }
        ],
        prompt: 'modern minimalist style',
        modelType: 'Base'

        // Pro model:
        // modelType: 'Pro'
      },
      {
        headers: {
          'APIKEY': API_KEY,
          'Content-Type': 'application/json'
        }
      }
    );

    const taskId = response.data.data;
    console.log('Task ID:', taskId);
    return taskId;
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}

createFurnitureTryOnTask();

📤 响应#

成功响应

json
{
  "code": 0,
  "message": "success",
  "data": 1234567890123456789
}
字段类型描述
codeinteger0 表示成功
messagestring响应消息
datalong用于轮询结果的唯一任务 ID

2. 获取任务结果#

获取之前创建的家具试摆任务的当前状态和输出。

端点

纯文本
GET /api/v1/furnitureTryOn/result

请求头

请求头是否必填描述
APIKEY✅ 是您的 API 认证密钥

查询参数

参数类型是否必填描述
taskIdlong✅ 是从创建任务端点返回的任务 ID

📥 请求示例#

cURL
bash
curl -X GET "https://api.ideal.house/api/v1/furnitureTryOn/result?taskId=1234567890123456789" \
  -H "APIKEY: your_api_key_here"
Java (OkHttp)
java
import okhttp3.*;
import java.io.IOException;

public class FurnitureTryOnResultExample {

    private static final String BASE_URL = "https://api.ideal.house";
    private static final String API_KEY  = "your_api_key_here";

    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();
        long taskId = 1234567890123456789L;

        Request request = new Request.Builder()
            .url(BASE_URL + "/api/v1/furnitureTryOn/result?taskId=" + taskId)
            .addHeader("APIKEY", API_KEY)
            .get()
            .build();

        try (Response response = client.newCall(request).execute()) {
            System.out.println("Response: " + response.body().string());
        }
    }
}
Python (requests)
python
import requests
import time

BASE_URL = "https://api.ideal.house"
API_KEY  = "your_api_key_here"

headers = {
    "APIKEY": API_KEY
}

task_id = 1234567890123456789

# Poll until task is complete
while True:
    response = requests.get(
        f"{BASE_URL}/api/v1/furnitureTryOn/result",
        headers=headers,
        params={"taskId": task_id}
    )

    data = response.json()
    result = data.get("data", {})
    status = result.get("status")

    print(f"Status: {status}, Progress: {result.get('percentage')}%, Queue: {result.get('waitNumber')}")

    if status in ("Success", "Failed"):
        break

    time.sleep(3)  # Poll every 3 seconds

if status == "Success":
    output = result["output"]
    print("Result URL:", output["resultUrl"])
    print("Matched Items:", output.get("items", []))
else:
    print("Task ended with status:", status)
Node.js (axios)
javascript
const axios = require('axios');

const BASE_URL = 'https://api.ideal.house';
const API_KEY  = 'your_api_key_here';

async function pollResult(taskId) {
  const headers = { 'APIKEY': API_KEY };

  while (true) {
    const response = await axios.get(
      `${BASE_URL}/api/v1/furnitureTryOn/result`,
      {
        headers,
        params: { taskId }
      }
    );

    const result = response.data.data;
    const { status, percentage, waitNumber } = result;

    console.log(`Status: ${status} | Progress: ${percentage}% | Queue: ${waitNumber}`);

    if (['Success', 'Failed'].includes(status)) {
      if (status === 'Success') {
        console.log('Result URL:', result.output.resultUrl);
        console.log('Matched Items:', result.output.items);
      } else {
        console.log('Task ended with status:', status);
      }
      break;
    }

    // Wait 3 seconds before next poll
    await new Promise(resolve => setTimeout(resolve, 3000));
  }
}

pollResult(1234567890123456789n);

📤 响应#

成功响应(任务已完成)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Success",
    "waitNumber": 0,
    "percentage": 100,
    "input": {
      "imageUrl": "https://example.com/living-room.jpg",
      "furnitureList": [
        {
          "imageUrl": "https://example.com/sofa.png"
        },
        {
          "imageUrl": "https://example.com/coffee-table.png"
        }
      ],
      "prompt": "modern minimalist style",
      "modelType": "Base"
    },
    "output": {
      "resultUrl": "https://cdn.ideal.house/output/furniture_try_on_result.jpg",
      "width": 1024,
      "height": 1024
    }
  }
}

响应(任务处理中 / 队列中)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Processing",
    "waitNumber": 1,
    "percentage": 45,
    "input": {
      "imageUrl": "https://example.com/living-room.jpg",
      "furnitureList": [
        {
          "imageUrl": "https://example.com/sofa.png"
        }
      ],
      "prompt": "modern minimalist style",
      "modelType": "Base"
    },
    "output": null
  }
}

响应(任务失败)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Failed",
    "waitNumber": 0,
    "percentage": 0,
    "input": {
      "imageUrl": "https://example.com/living-room.jpg",
      "furnitureList": [
        {
          "imageUrl": "https://example.com/sofa.png"
        }
      ],
      "modelType": "Base"
    },
    "output": null
  }
}

响应字段

字段类型描述
idlong任务唯一标识符
statusstring当前任务状态(参见 任务状态
waitNumberinteger队列中排在任务前面的数量(0 表示正在处理中)
percentageinteger任务完成百分比(0–100
inputobject任务的原始输入参数
input.imageUrlstring房间场景图片 URL
input.furnitureListarray提交的家具列表(最多 6 件物品)
input.furnitureList[].imageUrlstring家具商品图片 URL
input.promptstring自定义文本提示(如有提供)
input.modelTypestring使用的模型类型
outputobject生成结果(仅在 statusSuccess 时可用)
output.resultUrlstring放置好家具后的生成房间图片的 URL
output.widthinteger输出宽度(像素)
output.heightinteger输出高度(像素)

📊 任务状态#

状态描述
Unprocessed任务已创建但尚未开始
Processing任务正在处理中
Success任务已成功完成 — 输出可用
Failed任务因错误而失败

请每隔 3-5 秒 轮询一次。参见 API 任务限制


❌ 错误响应#

所有错误响应共享相同的 JSON 结构:

json
{
  "code": 5002,
  "message": "Invalid API Key",
  "data": null
}

错误码参考#

错误码名称描述建议操作
1001FAILED请求失败(通用错误)检查 message 字段以获取具体错误详情
1003INTERNAL_ERROR内部服务器错误稍作延迟后重试;如持续出现请联系支持团队
1011PARAM_ERROR请求参数错误 — e.g.、imageUrlfurnitureList 缺失,或 furnitureList 超过 6 件物品确保同时提供 imageUrlfurnitureList,且均非空,包含不超过 6 件物品
5002API_KEY_INVALID无效或缺失的 API Key确保 APIKEY 请求头存在且值正确
9010SCAN_TEXT_ERROR文本提示未通过内容审核修改提示词,移除任何敏感或违规内容
9038PROHIBITED_CONTENT生成输出图片包含禁止内容调整提示词/风格/输入后重试
9051COINS_NOT_ENOUGH积分/余额不足充值账户积分后重试

📄 如需完整通用 API 错误码列表,请参阅 错误码参考