curl --request POST \
--url https://api.apimart.ai/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "この画像が違反していないかモデレーションしてください"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}'
import requests
url = "https://api.apimart.ai/v1/moderations"
payload = {
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "この画像が違反していないかモデレーションしてください"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/moderations";
const payload = {
model: "omni-moderation-latest",
input: [
{
type: "text",
text: "この画像が違反していないかモデレーションしてください",
},
{
type: "image_url",
image_url: {
url: "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg",
},
},
],
stream: false,
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
omni-moderation-latest
omni-moderation-latest コンテンツモデレーション
- テキスト・画像・テキスト+画像の混合コンテンツのモデレーションに対応
- 単一テキスト、テキスト配列、コンテンツブロック配列の入力に対応
- 画像は公開 URL と base64 Data URI に対応
POST
/
v1
/
moderations
curl --request POST \
--url https://api.apimart.ai/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "この画像が違反していないかモデレーションしてください"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}'
import requests
url = "https://api.apimart.ai/v1/moderations"
payload = {
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "この画像が違反していないかモデレーションしてください"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/moderations";
const payload = {
model: "omni-moderation-latest",
input: [
{
type: "text",
text: "この画像が違反していないかモデレーションしてください",
},
{
type: "image_url",
image_url: {
url: "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg",
},
},
],
stream: false,
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
omni-moderation-latest を使って入力コンテンツの安全モデレーションを行います。本モデルはモデレーションシリーズに属し、画像・動画・音声生成シリーズには含まれません。
curl --request POST \
--url https://api.apimart.ai/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "この画像が違反していないかモデレーションしてください"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}'
import requests
url = "https://api.apimart.ai/v1/moderations"
payload = {
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "この画像が違反していないかモデレーションしてください"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/moderations";
const payload = {
model: "omni-moderation-latest",
input: [
{
type: "text",
text: "この画像が違反していないかモデレーションしてください",
},
{
type: "image_url",
image_url: {
url: "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg",
},
},
],
stream: false,
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
対応モデル
| モデル名 | 説明 | 対応入力 |
|---|---|---|
omni-moderation-latest | 汎用コンテンツモデレーションモデル | テキスト・画像・テキスト+画像の混合 |
Authorizations
string
必須
すべてのエンドポイントは Bearer Token による認証が必要です。API Key の取得:API Key 管理ページ にアクセスして API Key を取得してください。リクエストヘッダーに以下を追加します:
Authorization: Bearer YOUR_API_KEY
Body
string
必須
モデレーションモデル名。
omni-moderation-latest- 汎用コンテンツモデレーションモデル
string | string[] | object[]
必須
モデレーション対象のコンテンツ。プレーンテキスト、テキスト配列、コンテンツブロック配列に対応します。コンテンツブロックには以下を含めることができます:
text- テキストコンテンツブロックimage_url- 画像 URL コンテンツブロック
boolean
デフォルト:"false"
ストリーミングで返すかどうか。
false:非ストリーミング応答(デフォルト。現在この値のみサポート、trueは非対応)
input のリクエスト方式
テキスト+画像の混合
{
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "この画像が違反していないかモデレーションしてください"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}
プレーンテキスト(単一)
{
"model": "omni-moderation-latest",
"input": "I want to kill someone",
"stream": false
}
プレーンテキスト(配列)
{
"model": "omni-moderation-latest",
"input": [
"hello",
"I hate you"
],
"stream": false
}
画像のみ(画像 URL)
{
"model": "omni-moderation-latest",
"input": [
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}
画像のみ(base64 Data URI)
{
"model": "omni-moderation-latest",
"input": [
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
}
],
"stream": false
}
注意事項
inputがコンテンツブロック配列の場合、各要素はtypeでコンテンツ種別を区別します。- 画像モデレーションは公開アクセス可能な URL を推奨します。base64 を使う場合は標準 Data URI 形式
data:image/{format};base64,{data}に従ってください。 - 特別な要件がない限り、
stream: falseで統一することを推奨します。