Sam 3 · 3D Objects
集成
模型 id
sam-3/3d-objects
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/sam-3/3d-objects?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/sam-3/3d-objects?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/sam-3/3d-objects", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
# 1. Connect once (Claude Code; Cursor, VS Code, Claude Desktop: https://doitong.com/zh-CN/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.com/v1/mcp \
--header "Authorization: Bearer $DOITONG_API_KEY"
# 2. Your agent calls the "run" tool with:
{
"model_id": "sam-3/3d-objects",
"input": {
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}
}
通过 Doitong API 调用 Sam 3 · 3D Objects 模型(sam-3/3d-objects)。智能体文档:https://doitong.com/zh-CN/developers/models/sam-3/3d-objects.md
POST https://api.doitong.com/v1/run/sam-3/3d-objects?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}
如果响应状态为 "queued" 或 "running",请轮询 GET https://api.doitong.com/v1/requests/REQUEST_ID?wait=20,直到状态变为 "succeeded";文件位于 outputs[].url。使用相同请求体 POST https://api.doitong.com/v1/quote/sam-3/3d-objects,可在运行前返回确切价格。
此请求: ≈$0.02 20 API 积分 在此页面运行
你的新 API 密钥。 它只会在此时显示,并且已填入下方的代码和 API 密钥字段中。请妥善保管:切勿将其放入在浏览器中运行的代码里。
构建请求
控件根据模型架构生成。修改控件时,代码和价格会同步更新。
POST
/run/sam-3/3d-objects?wait=20
报价 → $0.02
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/sam-3/3d-objects?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/sam-3/3d-objects?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/sam-3/3d-objects", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run",
"arguments": {
"model_id": "sam-3/3d-objects",
"input": {
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
},
"wait_seconds": 20
}
}
}
关于 Sam 3 · 3D Objects
将照片中的物体转换为 3D 资产。使用 `mask_urls`、文本 `prompt`、`point_prompts` 或 `box_prompts` 选择物体;多个框会生成独立物体。`detection_threshold` 接受 0.1 到 1,`export_textured_glb` 会烘焙纹理和 UV。输出包括 GLB、Gaussian splat 文件、多物体场景的逐物体文件、元数据和 zip 包。
参数
发送规范名称或原生名称之一,不要同时发送两者。 规范名称
名称类型
默认值允许值
描述
image_url必填
image
类型url · image
用于 3D 重建的图像 URL。
mask_urls可选
类型url[] · image
可选的按对象排列的掩码 URL 列表。没有掩码时,如果提供了 提示词、point_prompts 或 box_prompts,自动分割会使用这些参数;如果既未提供掩码也未提供分割提示词,则使用整个图像。
prompt可选
类型string | null
默认值car
掩码不存在时用于自动分割的文本,例如 'chair' 或 'lamp'。
point_prompts可选
类型object[]
默认值[]
掩码不存在时用于自动分割的基于点的提示词。
point_prompts[].x可选
类型integer | null
提示词在 X 轴上的位置。
point_prompts[].y可选
类型integer | null
提示词在 Y 轴上的位置。
point_prompts[].label可选
类型enum
01
前景/背景标签:1 表示前景;0 表示背景。
point_prompts[].object_id可选
类型integer | null
用于将细化同一对象的提示词分组的可选标识符。如果同时提供文本作为提示词,此标识符将决定这些点细化哪个检测到的对象。
box_prompts可选
类型object[]
默认值[]
通过自动分割为 3D 重建生成独立对象掩码的框提示词,仅在未提供掩码时使用。可以提交多个框。
box_prompts[].x_min可选
类型integer | null
边界框的最小 x 坐标。
box_prompts[].y_min可选
类型integer | null
边界框的最小 y 坐标。
box_prompts[].x_max可选
类型integer | null
框的最大 X 坐标。
box_prompts[].y_max可选
类型integer | null
框的最大 Y 坐标。
box_prompts[].object_id可选
类型integer | null
用于将细化同一对象的框分组的可选标识符。
seed可选
类型integer | null
用于可复现随机生成的种子。
pointmap_url可选
类型string | null
可选 URL,用于通过提供 NPY 或 NPZ 格式的外部 pointmap 或深度数据来改进 3D 重建中的深度估计。
detection_threshold可选
类型number | null
0.1 – 1
检测置信度阈值,省略时使用模型默认值。范围为 0.1 到 1.0,较小的值会牺牲精确度以增加检测数量。
export_textured_glb可选
类型boolean
默认值false
GLB 导出选项:启用后会使用烘焙纹理和 UV 替换顶点颜色。
必填
规范名称,也可接受
文件参数接受公开的 https:// URL、最大 10 MB 的 data: URI,或上传文件的 file_url。 文件
输出
GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "sam-3/3d-objects",
"status": "succeeded",
"created_at": "2026-10-20T12:00:00Z",
"started_at": "2026-10-20T12:00:02Z",
"completed_at": "2026-10-20T12:00:09Z",
"queue_position": null,
"cost": {
"credits": 20,
"usd": "0.02",
"charged": 20,
"refunded": 0
},
"input": {
"image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
},
"output": {
"gaussian_splat": {
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200
},
"model_glb": {
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200
},
"metadata": [
{
"object_index": 1,
"scale": [
[]
],
"rotation": [
[]
],
"translation": [
[]
],
"camera_pose": [
[]
]
}
],
"individual_splats": [
{
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200
}
],
"individual_glbs": [
{
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200
}
],
"artifacts_zip": {
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200
}
},
"outputs": [
{
"type": "file",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_size": 1843200,
"stored": true
}
],
"error": null,
"metrics": {
"inference_seconds": 6.8
},
"urls": {
"self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
}
}
文件由你选择每个 outputs[].url 都是我们存储中的副本:可永久保存(按 GB-月付费),也可免费保存 7 天,由账户设置或 ?storage= 决定。
所有模型的结构一致图像、视频和音频的字段均为 type、url、content_type、width、height 和 duration。output 是模型自身的结果对象。
输出字段
- gaussian_splat
- object {url, content_type, file_name, file_size}包含多个对象时的组合场景 splat,否则为单个 splat;以 .ply 格式的 Gaussian splat 文件提供。
- model_glb
- object {url, content_type, file_name, file_size}保存为 GLB 的 3D 输出:多个对象会组装成一个场景,其他结果包含一个网格。
- metadata
- array of object {object_index, scale, rotation, translation, camera_pose}每个对象的元数据,包括旋转、位移和缩放。
- individual_splats
- array of object {url, content_type, file_name, file_size} | null每个对象对应的独立 Gaussian splat 文件,仅在包含多个对象的场景中提供。
- individual_glbs
- array of object {url, content_type, file_name, file_size} | null每个对象对应的独立 GLB 网格文件,仅在包含多个对象的场景中提供。
- artifacts_zip
- object {url, content_type, file_name, file_size} | null包含所有产物及元数据的 ZIP 压缩包。
其他 Sam3 变体
更多模型:图像生成 3D
对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh-CN/developers/models/sam-3/3d-objects.md. 所有模型和指南: https://doitong.com/developers/llms.txt