--- id: azure-ai-contentsafety version: "1.0.0" license: MIT License license_treatment: permissive maintenance: active --- # azure-ai-contentsafety — Microsoft Azure AI Content Safety Client Library for Python License: permissive · Maintenance: active · Downloads: 1.1M/mo ## What it is and what it does This package is a Python client for Azure AI Content Safety, a cloud-hosted service that classifies text and images for harmful content. It provides two main clients—ContentSafetyClient for analyzing content and BlocklistClient for managing custom term blocklists—and wraps REST calls to Azure's moderation APIs. The service recognizes four harm categories (hate, sexual, violence, self-harm) and returns severity ratings on a 0–7 scale; text supports full granularity while images return mapped levels (0, 2, 4, 6). You authenticate using either an API key or Microsoft Entra ID credentials, then call analyze methods to scan text or image URLs. The package handles request serialization and response parsing, abstracting away HTTP details. It's designed for applications that need to filter user-generated or AI-generated content at scale—e.g., moderation workflows, safety compliance, or content filtering in multi-tenant platforms. The blocklist APIs let you supplement the default classifiers with domain-specific terms, useful when the built-in categories don't capture your use case. Use it for: - Moderate user-generated comments or posts in social platforms or forums before publishing. - Screen AI-generated text or images for harmful output in chatbot or generative AI applications. - Build compliance workflows that flag content for manual review based on severity thresholds. - Create custom blocklists for industry-specific harmful terms (e.g., medical misinformation, financial scams). - Analyze bulk content archives to identify and categorize harmful material across historical data. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Detects harmful content in text and images by classifying them across categories like sexual content, violence, hate, and self-harm with severity ratings, and manages custom blocklists for domain-specific screening. Yes, if you need content moderation and are already using Azure. The package is stable (1.0.0), actively maintained, has no known vulnerabilities, and integrates cleanly with Azure authentication patterns. However, you must have an Azure subscription and Content Safety resource; the client library alone does not provide moderation—it calls a cloud service. Evaluate Azure's pricing and API quotas for your use case before committing. ## Install pip install azure-ai-contentsafety uv add azure-ai-contentsafety poetry add azure-ai-contentsafety ## Installing azure-ai-contentsafety Before you install: Low install friction with a pure-Python wheel distribution. Actively maintained as of 2026-08-14 with no known vulnerabilities. Depends on three stable, widely-used packages: azure-core, isodate, and typing-extensions. License in practice: MIT License permits unrestricted use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects. Quickstart: pip install azure-ai-contentsafety from azure.core.credentials import AzureKeyCredential from azure.ai.contentsafety import ContentSafetyClient endpoint = "https://.cognitiveservices.azure.com/" credential = AzureKeyCredential("") client = ContentSafetyClient(endpoint, credential) result = client.analyze_text(text="sample text to analyze") Requires an active Azure AI Content Safety resource and API key or Entra ID credentials; the service is cloud-hosted and cannot be used offline. Verify before relying: - Whether the service requires an active Azure subscription and incurs per-request costs beyond the client library itself. - Performance characteristics and latency expectations for text and image analysis at scale. - Whether custom blocklists persist across sessions or require reinitialization. ## Package facts - License: MIT License (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags content moderation api, text and image safety detection, harmful content classification, azure content safety, content blocklist management, hate violence sexual content detection, ai content moderation, content-moderation, azure-sdk, harm-detection [View on SkillFed](https://skillfed.io/packages/azure-ai-contentsafety) · [View on PyPI](https://pypi.org/project/azure-ai-contentsafety/)