Create moderation
curl --request POST \
--url https://api.dgrid.ai/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "I want to hug a puppy."
}
'import requests
url = "https://api.dgrid.ai/v1/moderations"
payload = { "input": "I want to hug a puppy." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: 'I want to hug a puppy.'})
};
fetch('https://api.dgrid.ai/v1/moderations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dgrid.ai/v1/moderations"
payload := strings.NewReader("{\n \"input\": \"I want to hug a puppy.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dgrid.ai/v1/moderations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"I want to hug a puppy.\"\n}")
.asString();{
"id": "<string>",
"model": "<string>",
"results": [
{
"flagged": true,
"categories": {},
"category_scores": {}
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}모더레이션
모더레이션 생성
OpenAI-compatible content safety checks for user-generated or model-generated text. Evaluates input against categories such as hate, harassment, self-harm, sexual content, and violence.
POST
/
v1
/
moderations
Create moderation
curl --request POST \
--url https://api.dgrid.ai/v1/moderations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "I want to hug a puppy."
}
'import requests
url = "https://api.dgrid.ai/v1/moderations"
payload = { "input": "I want to hug a puppy." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: 'I want to hug a puppy.'})
};
fetch('https://api.dgrid.ai/v1/moderations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dgrid.ai/v1/moderations"
payload := strings.NewReader("{\n \"input\": \"I want to hug a puppy.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dgrid.ai/v1/moderations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"I want to hug a puppy.\"\n}")
.asString();{
"id": "<string>",
"model": "<string>",
"results": [
{
"flagged": true,
"categories": {},
"category_scores": {}
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}인증
Your DGrid API key. All endpoints use Authorization: Bearer <DGRID_API_KEY>.
본문
application/json
⌘I

