Segment Anything Model 3
統合
モデルID
sam-3/image
# 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/image?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/image?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/image", 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/ja/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/image",
"input": {
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
}
}
Doitong APIを通じてSegment Anything Model 3モデル(sam-3/image)を呼び出します。エージェント向けドキュメント: https://doitong.com/ja/developers/models/sam-3/image.md
POST https://api.doitong.com/v1/run/sam-3/image?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"の場合、"succeeded"になるまでGET https://api.doitong.com/v1/requests/REQUEST_ID?wait=20をポーリングしてください。ファイルはoutputs[].urlにあります。同じボディでPOST https://api.doitong.com/v1/quote/sam-3/imageを実行すると、実行前の正確な価格が返されます。
このリクエスト: ≈$0.005 5 APIクレジット このページで実行
新しいAPIキーです。 これは今だけ表示され、コードと下記のAPIキー欄にすでに入力されています。秘密にしてください。ブラウザで実行されるコードに決して含めないでください。
リクエストを作成
コントロールはモデルスキーマから生成されます。値を変更するとコードと価格が更新されます。
POST
/run/sam-3/image?wait=20
見積もり → $0.005
# 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/image?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/image?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/image", 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/image",
"input": {
"image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
},
"wait_seconds": 20
}
}
}
Segment Anything Model 3について
テキスト `prompt`、`point_prompts`、`box_prompts` を使って SAM 3 で画像をセグメンテーションします。`return_multiple_masks` を有効にすると、最大 `max_masks` 枚(1 から 32)のマスクを返します。信頼度スコアとバウンディングボックスも任意で含められます。出力形式は jpeg、png、webp です。
パラメータ
正式名称またはネイティブ名のいずれか一方を送信してください。両方は送信しないでください。 正式名称
名前型
デフォルト許可される値
説明
image_url必須
image
型url · image
セグメンテーション対象の画像を指すURL。
prompt任意
型string
デフォルトwheel
セグメンテーションを誘導するテキスト指示。
text_prompt任意
型string | null
[DEPRECATED] 後方互換性のために残されている従来の入力。代わりに 'prompt' を使用してください。
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
単一オブジェクトを改良するプロンプトをグループ化する任意の識別子。テキストもプロンプトとして指定した場合、この識別子により、点が改良する検出オブジェクトを決定します。
point_prompts[].frame_index任意
型integer | null
インタラクション対象のフレームを識別するインデックス。
box_prompts任意
型object[]
デフォルト[]
object_idでグループ化を決めるボックスプロンプト。一致するIDはボックスを1つのオブジェクトに関連付け、空のIDは別々のオブジェクトを表します。複数のボックスを指定でき、それぞれに座標 (x_min, y_min, x_max, y_max) を使用します。
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
単一オブジェクトを改良するボックスをグループ化する任意の識別子。
box_prompts[].frame_index任意
型integer | null
インタラクション対象のフレームを識別するインデックス。
apply_mask任意
型boolean
デフォルトtrue
画像にマスクを適用するかどうかを制御します。
output_format任意
型enum
デフォルトpng
jpegpngwebp
結果の画像のファイル形式。
return_multiple_masks任意
型boolean
デフォルトfalse
複数マスクの返却オプション。有効にすると、`max_masks` でアップロードしてレスポンスに含める生成マスク数を決定します。
max_masks任意
型integer
デフォルト3
1 – 32
`return_multiple_masks` が有効な場合に返すマスク数の上限。
include_scores任意
型boolean
デフォルトfalse
マスクの信頼度スコアを含めるかどうかを制御します。
include_boxes任意
型boolean
デフォルトfalse
利用可能な場合、各マスクのバウンディングボックスを含めるかどうかを制御します。
必須
正式名称(こちらも使用可能)
ファイルパラメータには、公開されたhttps:// URL、10 MBまでのdata: URI、またはアップロードしたファイルのfile_urlを指定します。 ファイル
出力
GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "sam-3/image",
"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": 5,
"usd": "0.005",
"charged": 5,
"refunded": 0
},
"input": {
"image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
},
"output": {
"image": {
"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,
"width": 1024,
"height": 768
},
"masks": [
{
"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,
"width": 1024,
"height": 768
}
],
"metadata": [
{
"index": 1,
"score": 1.0,
"box": [
1.0
]
}
],
"scores": [
1.0
],
"boxes": [
[
1.0
]
]
},
"outputs": [
{
"type": "image",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768,
"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はストレージ上のコピーです。アカウント設定または?storage=により、永久保存(GB・月単位で有料)または無料で7日保存できます。
すべてのモデルで同じ形式画像、動画、音声のいずれでも、type、url、content_type、width、height、durationが含まれます。outputはモデル独自の結果オブジェクトです。
出力フィールド
- image
- object {url, content_type, file_name, file_size, width, height} | null主要なセグメンテーションマスクを示すプレビュー。
- masks
- array of object {url, content_type, file_name, file_size, width, height}セグメンテーションマスクを含む画像。
- metadata
- array of object {index, score, box} | nullスコアとボックスを含む各マスクのメタデータ。
- scores
- array of number | null要求時に提供される各マスクの信頼度スコア。
- boxes
- array of array of number | null要求時に、[cx, cy, w, h] として表される各マスクの正規化ボックス。
その他のSam3バリアント
その他のモデル: 画像編集
AIエージェント向け:このページのMarkdown版はこちらです: https://doitong.com/ja/developers/models/sam-3/image.md. すべてのモデルとガイド: https://doitong.com/developers/llms.txt






