AI 3D 生成 API 文档#
基础 URL:
https://api.ideal.house
版本: v1
更新于: 2026-03-06
📖 概述#
AI 3D 生成 API 允许你提交基于图片或提示词的 3D 生成任务,并异步获取结果。工作流程分为两步:
- 创建任务 — 提交你的输入(图片 URL 或文本提示词)并接收一个
taskId。 - 轮询结果 — 使用
taskId查询任务状态并获取生成的输出。
🔐 认证#
所有 API 请求必须使用 API Key 进行认证。
在请求头中包含你的 API Key:
| 头部 | 值 |
|---|---|
APIKEY | your_api_key_here |
⚠️ 妥善保管你的 API Key。 切勿在前端代码或公共仓库中泄露。
⚡ 并发限制#
🚦 重要提示: 此 API 每个账户同一时间仅允许 1 个并发请求。
如果同时提交多个请求,后续请求将被放入队列并按顺序处理。
你可以通过任务响应中的waitNumber字段监控你在队列中的位置。
💰 积分扣除#
[!WARNING] 🪙 每个任务成功创建时,会从你的账户扣除 20 积分。
积分在任务创建时扣除。如果任务最终失败,已扣除的积分将自动退还到你的账户。
积分不足将返回错误码9051。📄 请参阅 积分扣除说明。
📌 API 端点#
1. 创建 3D 生成任务#
创建一个新的 AI 3D 生成任务,并返回一个唯一的 taskId 用于轮询。
端点
POST /api/v1/ai3d/generate
请求头
| 头部 | 是否必需 | 说明 |
|---|---|---|
APIKEY | ✅ 是 | 你的 API 认证密钥 |
Content-Type | ✅ 是 | application/json |
请求体
| 字段 | 类型 | 是否必需 | 说明 |
|---|---|---|---|
imageUrl | string | ⚠️ imageUrl 和 prompt 必填其一 | 用于生成 3D 的源图片 URL |
prompt | string | ⚠️ imageUrl 和 prompt 必填其一 | 描述要生成的 3D 内容的文本提示词 |
💡 注意:
imageUrl和prompt互斥 — 每次请求只能提供其中一个。
🖼️ 图片要求: 使用 JPG/JPEG、PNG 或 WebP 格式。每张图片大小不得超过 20 MB,尺寸从 128 × 128 px 到 5,000 × 5,000 px(含边界)。图片 URL 必须可被 API 服务器直接访问。
📥 请求示例#
cURL
# Using imageUrl
curl -X POST "https://api.ideal.house/api/v1/ai3d/generate" \
-H "APIKEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/room.jpg"
}'
# Using prompt
curl -X POST "https://api.ideal.house/api/v1/ai3d/generate" \
-H "APIKEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A modern minimalist living room with wooden floor"
}'
Java (OkHttp)
import okhttp3.*;
import java.io.IOException;
public class Ai3dApiExample {
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/room.jpg"
}
""";
Request request = new Request.Builder()
.url(BASE_URL + "/api/v1/ai3d/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"
}
# Using imageUrl
payload = {
"imageUrl": "https://example.com/room.jpg"
}
# Or using prompt
# payload = {
# "prompt": "A modern minimalist living room with wooden floor"
# }
response = requests.post(
f"{BASE_URL}/api/v1/ai3d/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 createTask() {
try {
const response = await axios.post(
`${BASE_URL}/api/v1/ai3d/generate`,
{
imageUrl: 'https://example.com/room.jpg'
// Or use prompt instead:
// prompt: 'A modern minimalist living room with wooden floor',
},
{
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);
}
}
createTask();
📤 响应#
成功响应
{
"code": 0,
"message": "success",
"data": 1234567890123456789
}
| 字段 | 类型 | 说明 |
|---|---|---|
code | integer | 0 表示成功 |
message | string | 响应消息 |
data | long | 用于轮询结果的唯一任务 ID |
2. 获取任务结果#
获取之前创建的任务的当前状态和输出。
端点
GET /api/v1/ai3d/result
请求头
| 头部 | 是否必需 | 说明 |
|---|---|---|
APIKEY | ✅ 是 | 你的 API 认证密钥 |
查询参数
| 参数 | 类型 | 是否必需 | 说明 |
|---|---|---|---|
taskId | long | ✅ 是 | 创建任务端点返回的任务 ID |
📥 请求示例#
cURL
curl -X GET "https://api.ideal.house/api/v1/ai3d/result?taskId=1234567890123456789" \
-H "APIKEY: your_api_key_here"
Java (OkHttp)
import okhttp3.*;
import java.io.IOException;
public class Ai3dResultExample {
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/ai3d/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
# Poll until task is complete
while True:
response = requests.get(
f"{BASE_URL}/api/v1/ai3d/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":
print("Result URL:", result["output"]["resultUrl"])
else:
print("Task failed or terminated")
Node.js (axios)
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/ai3d/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);
} else {
console.log('Task ended with status:', status);
}
break;
}
// Wait 3 seconds before next poll
await new Promise(resolve => setTimeout(resolve, 3000));
}
}
pollResult(1234567890123456789n);
📤 响应#
成功响应(任务已完成)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Success",
"waitNumber": 0,
"percentage": 100,
"input": {
"imageUrl": "https://example.com/room.jpg"
},
"output": {
"resultUrl": "https://cdn.ideal.house/output/result_3d_model.zip",
"width": 1024,
"height": 1024
}
}
}
响应(任务处理中 / 排队中)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Processing",
"waitNumber": 2,
"percentage": 35,
"input": {
"imageUrl": "https://example.com/room.jpg"
},
"output": null
}
}
响应(任务失败)
{
"code": 0,
"message": "success",
"data": {
"id": 1234567890123456789,
"status": "Failed",
"waitNumber": 0,
"percentage": 0,
"input": {
"imageUrl": "https://example.com/room.jpg"
},
"output": null
}
}
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | long | 任务唯一标识 |
status | string | 当前任务状态(参见任务状态) |
waitNumber | integer | 队列中排在你前面的任务数(0 表示正在处理中) |
percentage | integer | 任务完成百分比(0–100) |
input | object | 任务的原始输入参数 |
input.imageUrl | string | 源图片 URL(如有提供) |
input.prompt | string | 源文本提示词(如有提供) |
input.modelType | string | 使用的模型类型 |
output | object | 生成结果(仅当 status 为 Success 时可获取) |
output.resultUrl | string | 生成完成的 3D 模型文件的 URL |
output.width | integer | 输出宽度(像素) |
output.height | integer | 输出高度(像素) |
📊 任务状态#
| 状态 | 说明 |
|---|---|
Unprocessed | 任务已创建但尚未开始处理 |
Processing | 任务正在处理中 |
Success | 任务成功完成 — 输出已就绪 |
Failed | 任务因错误而失败 |
每 3-5 秒 轮询一次。参见 API 任务限制。
❌ 错误响应#
所有错误响应共享相同的 JSON 结构:
{
"code": 5002,
"message": "Invalid API Key",
"data": null
}
错误码说明#
| 错误码 | 名称 | 说明 | 建议操作 |
|---|---|---|---|
1001 | FAILED | 请求失败(通用错误) | 查看 message 字段获取具体错误信息 |
1003 | INTERNAL_ERROR | 服务器内部错误 | 稍后重试;如持续发生请联系支持团队 |
1011 | PARAM_ERROR | 请求参数错误 | 核实所有必填参数是否已提供且格式正确 |
5002 | API_KEY_INVALID | API Key 无效或缺失 | 确保 APIKEY 头存在且值正确 |
9010 | SCAN_TEXT_ERROR | 文本提示词未通过内容审核 | 修改提示词,删除敏感或禁用内容 |
9038 | PROHIBITED_CONTENT | 生成的输出图像包含禁用内容 | 调整提示词/风格/输入后重试 |
9036 | COVERT_3D_FAILED | 此图片不支持 3D 生成 | 尝试换一张结构更清晰、深度更明确的其他图片 |
9051 | COINS_NOT_ENOUGH | 积分不足 | 充值账户积分后重试 |
错误响应示例#
5002 — 无效的 API Key
{
"code": 5002,
"message": "Invalid API Key",
"data": null
}
1011 — 参数错误
{
"code": 1011,
"message": "Request parameter error: imageUrl is required",
"data": null
}
9036 — 图片不支持 3D 生成
{
"code": 9036,
"message": "This image does not support 3D generation",
"data": null
}
9010 — 文本内容审核未通过
{
"code": 9010,
"message": "Text prompt failed content review, contains prohibited content",
"data": null
}
9051 — 余额不足
{
"code": 9051,
"message": "Insufficient coins",
"data": null
}
📄 完整的常见 API 错误码列表,请参阅 错误码说明。