Ideal House
跳转到主要内容

景观美化 API 文档#

基础 URL: https://api.ideal.house
版本: v1
更新时间: 2026-05-21


📖 概述#

景观美化 API 能够从源图像改善或重新设计户外景观区域。它支持可选文本引导、花园风格选项、景观元素和模型模式。

工作流程为异步:

  1. 创建任务 — 提交 imageUrl 和可选参数,然后获得一个 taskId
  2. 轮询结果 — 使用 taskId 获取任务状态和生成的图像。

🔐 认证#

头字段
APIKEYyour_api_key_here

💰 积分扣除#

[!WARNING] 成功创建任务时将扣除积分。如果任务最终失败,扣除的积分将自动退还
积分不足将返回错误代码 9051。参见积分扣除参考

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

若未提供 modelType,则默认使用 Base


🎨 风格选项#

此 API 支持由 API 风格配置 端点返回的可选风格参数。

用法:

纯文本
GET /api/v1/style/landscaping/getStyles
风格分组请求字段描述
gardenStylesceneId花园或景观风格选项
elementssceneElementId景观元素选项。支持多个选项 ID 用逗号分隔,例如 id1,id2

每个选项包含 nameidurl。将选项 id 传入对应请求字段。


📌 API 端点#

1. 创建景观美化任务#

端点

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

请求头

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

请求体

字段类型必填描述
imageUrlstring✅ 是源景观图像的 URL
promptstring❌ 可选期望结果的文本引导
sceneIdstring❌ 可选gardenStyle 风格选项中的花园风格 ID
sceneElementIdstring❌ 可选elements 风格选项中的景观元素 ID。支持多个 ID 用逗号分隔,例如 id1,id2
modelTypestring❌ 可选枚举值:FlashBasePro。默认为 Base

仅需 imageUrl。所有其他字段均为可选。

🖼️ 图像要求: 所有源图像和参考图像必须使用 JPG/JPEG、PNG 或 WebP 格式。每张图片不得超过 20 MB,尺寸范围为 128 × 128 px6,000 × 6,000 px(含端点)。超出最大像素尺寸的图像会在处理前自动按比例缩放以适配 6,000 × 6,000 px。图像 URLs 必须能被 API 服务器直接访问。

📥 请求示例#

cURL
bash
curl -X POST "https://api.ideal.house/api/v1/landscaping/generate" \
  -H "APIKEY: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "imageUrl": "https://example.com/backyard.jpg",
    "prompt": "lush modern garden with clean stone paths",
    "sceneId": "Landscape Design_Landscape Style_Mid-Century Modern Pool",
    "sceneElementId": "Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover",
    "modelType": "Base"
  }'
Java (OkHttp)
java
import okhttp3.*;

import java.io.IOException;

public class LandscapingApiExample {

    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/backyard.jpg",
                    "prompt": "lush modern garden with clean stone paths",
                    "sceneId": "Landscape Design_Landscape Style_Mid-Century Modern Pool",
                    "sceneElementId": "Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover",
                    "modelType": "Base"
                }
                """;

        Request request = new Request.Builder()
                .url(BASE_URL + "/api/v1/landscaping/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/backyard.jpg",
    "prompt": "lush modern garden with clean stone paths",
    "sceneId": "Landscape Design_Landscape Style_Mid-Century Modern Pool",
    "sceneElementId": "Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover",
    "modelType": "Base"
}

response = requests.post(
    f"{BASE_URL}/api/v1/landscaping/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 createLandscapingTask() {
  try {
    const response = await axios.post(
      `${BASE_URL}/api/v1/landscaping/generate`,
      {
        imageUrl: 'https://example.com/backyard.jpg',
        prompt: 'lush modern garden with clean stone paths',
        sceneId: 'Landscape Design_Landscape Style_Mid-Century Modern Pool',
        sceneElementId: 'Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover',
        modelType: 'Base'
      },
      {
        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);
  }
}

createLandscapingTask();

📤 响应#

json
{
  "code": 0,
  "message": "success",
  "data": 1234567890123456789
}

2. 获取任务结果#

端点

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

请求头

头字段必填描述
APIKEY✅ 是您的 API 认证密钥

查询参数

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

📥 请求示例#

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

import java.io.IOException;

public class LandscapingResultExample {

    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/landscaping/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

while True:
    response = requests.get(
        f"{BASE_URL}/api/v1/landscaping/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)

if status == "Success":
    print("Result URL:", result["output"]["resultUrl"])
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 pollLandscapingResult(taskId) {
  const headers = { APIKEY: API_KEY };

  while (true) {
    const response = await axios.get(
      `${BASE_URL}/api/v1/landscaping/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('Size:', result.output.width, 'x', result.output.height);
      } else {
        console.log('Task ended with status:', status);
      }
      break;
    }

    await new Promise(resolve => setTimeout(resolve, 3000));
  }
}

pollLandscapingResult(1234567890123456789n);

📤 响应示例#

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Success",
    "waitNumber": 0,
    "percentage": 100,
    "input": {
      "imageUrl": "https://example.com/backyard.jpg",
      "prompt": "lush modern garden with clean stone paths",
      "sceneId": "Landscape Design_Landscape Style_Mid-Century Modern Pool",
      "sceneElementId": "Landscape Design_Scene Elements_Natural Elements_Flower,Landscape Design_Scene Elements_Natural Elements_Ground Cover",
      "modelType": "Base"
    },
    "output": {
      "resultUrl": "https://cdn.ideal.house/output/landscaping_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/backyard.jpg",
      "modelType": "Base"
    },
    "output": null
  }
}

响应(任务失败)

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Failed",
    "waitNumber": 0,
    "percentage": 0,
    "input": {
      "imageUrl": "https://example.com/backyard.jpg",
      "modelType": "Base"
    },
    "output": null
  }
}

📊 任务状态#

状态描述
Unprocessed任务已创建并在队列中等待
Processing任务正在运行中
Success任务成功完成
Failed任务失败,未产生输出

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


❌ 错误响应#

代码名称描述
1011PARAM_ERROR请求参数错误
5002API_KEY_INVALIDAPI 密钥无效或缺失
9010SCAN_TEXT_ERROR提示词内容审核未通过
9038PROHIBITED_CONTENT生成图像包含禁止内容
9051COINS_NOT_ENOUGH积分不足

有关完整的常见错误定义,参见错误代码参考