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-TW/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-TW/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-TW/developers/models/sam-3/3d-objects.md. 所有模型與指南: https://doitong.com/developers/llms.txt