景观美化 API 文档#
基础 URL:
https://api.ideal.house
版本: v1
更新时间: 2026-05-21
📖 概述#
景观美化 API 能够从源图像改善或重新设计户外景观区域。它支持可选文本引导、花园风格选项、景观元素和模型模式。
工作流程为异步:
- 创建任务 — 提交
imageUrl和可选参数,然后获得一个taskId。 - 轮询结果 — 使用
taskId获取任务状态和生成的图像。
🔐 认证#
| 头字段 | 值 |
|---|---|
APIKEY | your_api_key_here |
💰 积分扣除#
[!WARNING] 成功创建任务时将扣除积分。如果任务最终失败,扣除的积分将自动退还。
积分不足将返回错误代码9051。参见积分扣除参考。
模型(modelType) | 扣除积分 |
|---|---|
Flash | 1 积分 |
Base | 3 积分 |
Pro | 10 积分 |
若未提供 modelType,则默认使用 Base。
🎨 风格选项#
此 API 支持由 API 风格配置 端点返回的可选风格参数。
用法:
GET /api/v1/style/landscaping/getStyles
| 风格分组 | 请求字段 | 描述 |
|---|---|---|
gardenStyle | sceneId | 花园或景观风格选项 |
elements | sceneElementId | 景观元素选项。支持多个选项 ID 用逗号分隔,例如 id1,id2 |
每个选项包含 name、id 和 url。将选项 id 传入对应请求字段。
📌 API 端点#
1. 创建景观美化任务#
端点
POST /api/v1/landscaping/generate
请求头
| 头字段 | 必填 | 描述 |
|---|---|---|
APIKEY | ✅ 是 | 您的 API 认证密钥 |
Content-Type | ✅ 是 | application/json |
请求体
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
imageUrl | string | ✅ 是 | 源景观图像的 URL |
prompt | string | ❌ 可选 | 期望结果的文本引导 |
sceneId | string | ❌ 可选 | gardenStyle 风格选项中的花园风格 ID |
sceneElementId | string | ❌ 可选 | elements 风格选项中的景观元素 ID。支持多个 ID 用逗号分隔,例如 id1,id2 |
modelType | string | ❌ 可选 | 枚举值:Flash、Base、Pro。默认为 Base |
仅需
imageUrl。所有其他字段均为可选。
🖼️ 图像要求: 所有源图像和参考图像必须使用 JPG/JPEG、PNG 或 WebP 格式。每张图片不得超过 20 MB,尺寸范围为 128 × 128 px 至 6,000 × 6,000 px(含端点)。超出最大像素尺寸的图像会在处理前自动按比例缩放以适配 6,000 × 6,000 px。图像 URLs 必须能被 API 服务器直接访问。
📥 请求示例#
cURL
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)
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)
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)
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();
📤 响应#
{
"code": 0,
"message": "success",
"data": 1234567890123456789
}
2. 获取任务结果#
端点
GET /api/v1/landscaping/result
请求头
| 头字段 | 必填 | 描述 |
|---|---|---|
APIKEY | ✅ 是 | 您的 API 认证密钥 |
查询参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
taskId | long | ✅ 是 | 由创建端点返回的任务 ID |
📥 请求示例#
cURL
curl -X GET "https://api.ideal.house/api/v1/landscaping/result?taskId=1234567890123456789" \
-H "APIKEY: your_api_key_here"
Java (OkHttp)
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)
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)
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);
📤 响应示例#
{
"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
}
}
}
响应(任务处理中/排队中)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Processing",
"waitNumber": 1,
"percentage": 45,
"input": {
"imageUrl": "https://example.com/backyard.jpg",
"modelType": "Base"
},
"output": null
}
}
响应(任务失败)
{
"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 任务限制。
❌ 错误响应#
| 代码 | 名称 | 描述 |
|---|---|---|
1011 | PARAM_ERROR | 请求参数错误 |
5002 | API_KEY_INVALID | API 密钥无效或缺失 |
9010 | SCAN_TEXT_ERROR | 提示词内容审核未通过 |
9038 | PROHIBITED_CONTENT | 生成图像包含禁止内容 |
9051 | COINS_NOT_ENOUGH | 积分不足 |
有关完整的常见错误定义,参见错误代码参考。