Ideal House
跳转到主要内容

AI 3D 生成 API 文档#

基础 URL: https://api.ideal.house
版本: v1
更新于: 2026-03-06


📖 概述#

AI 3D 生成 API 允许你提交基于图片或提示词的 3D 生成任务,并异步获取结果。工作流程分为两步:

  1. 创建任务 — 提交你的输入(图片 URL 或文本提示词)并接收一个 taskId
  2. 轮询结果 — 使用 taskId 查询任务状态并获取生成的输出。

🔐 认证#

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

在请求头中包含你的 API Key:

头部
APIKEYyour_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

请求体

字段类型是否必需说明
imageUrlstring⚠️ imageUrlprompt 必填其一用于生成 3D 的源图片 URL
promptstring⚠️ imageUrlprompt 必填其一描述要生成的 3D 内容的文本提示词

💡 注意: imageUrlprompt 互斥 — 每次请求只能提供其中一个。

🖼️ 图片要求: 使用 JPG/JPEG、PNG 或 WebP 格式。每张图片大小不得超过 20 MB,尺寸从 128 × 128 px5,000 × 5,000 px(含边界)。图片 URL 必须可被 API 服务器直接访问。


📥 请求示例#

cURL
bash
# 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)
java
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)
python
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)
javascript
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();

📤 响应#

成功响应

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

2. 获取任务结果#

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

端点

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

请求头

头部是否必需说明
APIKEY✅ 是你的 API 认证密钥

查询参数

参数类型是否必需说明
taskIdlong✅ 是创建任务端点返回的任务 ID

📥 请求示例#

cURL
bash
curl -X GET "https://api.ideal.house/api/v1/ai3d/result?taskId=1234567890123456789" \
  -H "APIKEY: your_api_key_here"
Java (OkHttp)
java
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)
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/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)
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/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);

📤 响应#

成功响应(任务已完成)

json
{
  "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
    }
  }
}

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

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 1234567890123456789,
    "status": "Processing",
    "waitNumber": 2,
    "percentage": 35,
    "input": {
      "imageUrl": "https://example.com/room.jpg"
    },
    "output": null
  }
}

响应(任务失败)

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

响应字段

字段类型说明
idlong任务唯一标识
statusstring当前任务状态(参见任务状态
waitNumberinteger队列中排在你前面的任务数(0 表示正在处理中)
percentageinteger任务完成百分比(0–100
inputobject任务的原始输入参数
input.imageUrlstring源图片 URL(如有提供)
input.promptstring源文本提示词(如有提供)
input.modelTypestring使用的模型类型
outputobject生成结果(仅当 statusSuccess 时可获取)
output.resultUrlstring生成完成的 3D 模型文件的 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请求参数错误核实所有必填参数是否已提供且格式正确
5002API_KEY_INVALIDAPI Key 无效或缺失确保 APIKEY 头存在且值正确
9010SCAN_TEXT_ERROR文本提示词未通过内容审核修改提示词,删除敏感或禁用内容
9038PROHIBITED_CONTENT生成的输出图像包含禁用内容调整提示词/风格/输入后重试
9036COVERT_3D_FAILED此图片不支持 3D 生成尝试换一张结构更清晰、深度更明确的其他图片
9051COINS_NOT_ENOUGH积分不足充值账户积分后重试

错误响应示例#

5002 — 无效的 API Key
json
{
  "code": 5002,
  "message": "Invalid API Key",
  "data": null
}
1011 — 参数错误
json
{
  "code": 1011,
  "message": "Request parameter error: imageUrl is required",
  "data": null
}
9036 — 图片不支持 3D 生成
json
{
  "code": 9036,
  "message": "This image does not support 3D generation",
  "data": null
}
9010 — 文本内容审核未通过
json
{
  "code": 9010,
  "message": "Text prompt failed content review, contains prohibited content",
  "data": null
}
9051 — 余额不足
json
{
  "code": 9051,
  "message": "Insufficient coins",
  "data": null
}

📄 完整的常见 API 错误码列表,请参阅 错误码说明