OpenAI format
POST
/v1/moderations
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.mirapi.ai/v1/moderations"
payload := strings.NewReader("{ \"input\": [ \"example\" ], \"model\": \"text-moderation-latest\" }")
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(res) fmt.Println(string(body))
}const url = 'https://api.mirapi.ai/v1/moderations';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"input":["example"],"model":"text-moderation-latest"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.mirapi.ai/v1/moderations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "input": [ "example" ], "model": "text-moderation-latest" }'Checks whether the text violates the usage policy
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
input
required
One of:
string
Array<string>
model
string
Example
text-moderation-latestResponses
Section titled “Responses”Moderation result returned
Media typeapplication/json
object
id
string
model
string
results
Array<object>
object
flagged
boolean
categories
object
category_scores
object
Examplegenerated
{ "id": "example", "model": "example", "results": [ { "flagged": true, "categories": {}, "category_scores": {} } ]}