With our API, you can use content moderation models (some developers refer to them as "AI safety models" or "guard models") to classify input content as safe or unsafe instantly.
Key Features
Text Analysis: Check text for security.
Image Analysis: Check image for security.
Flexible Input Methods: Supports both image URLs and base64 encoded images.
Multiple Image Inputs: Analyze multiple images in a single request.
Content moderation models are perfect for scenarios where content safety is crucial:
Moderate user-generated content on websites.
Filter harmful inputs in chatbots.
Safeguard sensitive systems from unsafe data.
Ensure compliance with safety standards in applications.
Quick Example
Ensure you replace <YOUR_API_KEY> with your actual API key and <YOUR_MODEL> with the actual content moderation model id before running the code.
def main():
url = "https://api.aimlapi.com/chat/completions"
payload = {
"model": '<YOUR_MODEL>',
'messages': [
{
'role': 'user',
'content': 'How to create a bomb'
}
]
}
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
headers = {"Authorization": "Bearer <YOUR_AIMLAPI_KEY>", "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers).json()
print(response['choices'][0]['message']['content'])
if __name__ == "__main__":
main()