Skip to main content

Tuteliq

Tuteliq Python SDK

Official Python SDK for the Tuteliq API
AI-powered child safety analysis

PyPI version Python versions build status license

API Docs • Dashboard • Trust • Discord


Installation

pip install tuteliq

Requirements

  • Python 3.10+

Quick Start

import asyncio
from tuteliq import Tuteliq

async def main():
    client = Tuteliq(api_key="your-api-key")

    # Quick safety analysis
    result = await client.analyze("Message to check")

    if result.risk_level != RiskLevel.SAFE:
        print(f"Risk: {result.risk_level}")
        print(f"Summary: {result.summary}")

    await client.close()

asyncio.run(main())

Or use as a context manager:

async with Tuteliq(api_key="your-api-key") as client:
    result = await client.analyze("Message to check")

API Reference

Initialization

from tuteliq import Tuteliq

# Simple
client = Tuteliq(api_key="your-api-key")

# With options
client = Tuteliq(
    api_key="your-api-key",
    timeout=30.0,      # Request timeout in seconds
    max_retries=3,     # Retry attempts
    retry_delay=1.0,   # Initial retry delay in seconds
)

Bullying Detection

result = await client.detect_bullying("Nobody likes you, just leave")

if result.is_bullying:
    print(f"Severity: {result.severity}")       # Severity.MEDIUM
    print(f"Types: {result.bullying_type}")     # ["exclusion", "verbal_abuse"]
    print(f"Confidence: {result.confidence}")   # 0.92
    print(f"Rationale: {result.rationale}")

Grooming Detection

from tuteliq import DetectGroomingInput, GroomingMessage, MessageRole

result = await client.detect_grooming(
    DetectGroomingInput(
        messages=[
            GroomingMessage(role=MessageRole.ADULT, content="This is our secret"),
            GroomingMessage(role=MessageRole.CHILD, content="Ok I won't tell"),
        ],
        child_age=12,
    )
)

if result.grooming_risk == GroomingRisk.HIGH:
    print(f"Flags: {result.flags}")  # ["secrecy", "isolation"]

# Per-message breakdown (optional, returned on conversation-aware endpoints)
if result.message_analysis:
    for m in result.message_analysis:
        print(f"Message {m.message_index}: risk={m.risk_score}, flags={m.flags}, summary={m.summary}")

Unsafe Content Detection

result = await client.detect_unsafe("I don't want to be here anymore")

if result.unsafe:
    print(f"Categories: {result.categories}")  # ["self_harm", "crisis"]
    print(f"Severity: {result.severity}")      # Severity.CRITICAL

Quick Analysis

Runs bullying and unsafe detection in parallel:

result = await client.analyze("Message to check")

print(f"Risk Level: {result.risk_level}")   # RiskLevel.SAFE/LOW/MEDIUM/HIGH/CRITICAL
print(f"Risk Score: {result.risk_score}")   # 0.0 - 1.0
print(f"Summary: {result.summary}")
print(f"Action: {result.recommended_action}")

Emotion Analysis

result = await client.analyze_emotions("I'm so stressed about everything")

print(f"Emotions: {result.dominant_emotions}")  # ["anxiety", "sadness"]
print(f"Trend: {result.trend}")                 # EmotionTrend.WORSENING
print(f"Followup: {result.recommended_followup}")

Action Plan

from tuteliq import GetActionPlanInput, Audience, Severity

plan = await client.get_action_plan(
    GetActionPlanInput(
        situation="Someone is spreading rumors about me",
        child_age=12,
        audience=Audience.CHILD,
        severity=Severity.MEDIUM,
    )
)

print(f"Steps: {plan.steps}")
print(f"Tone: {plan.tone}")

Incident Report

from tuteliq import GenerateReportInput, ReportMessage

report = await client.generate_report(
    GenerateReportInput(
        messages=[
            ReportMessage(sender="user1", content="Threatening message"),
            ReportMessage(sender="child", content="Please stop"),
        ],
        child_age=14,
    )
)

print(f"Summary: {report.summary}")
print(f"Risk: {report.risk_level}")
print(f"Next Steps: {report.recommended_next_steps}")

Verification

Session-based age and identity verification. You create a session on your server, the user completes document capture, liveness and selfie in Tuteliq's hosted flow, and you read the result. See Verification for plans and credits.

from tuteliq import ChipPolicy, CreateVerificationSessionInput, DocumentType, VerificationMode, VerificationSessionStatus

session = await client.create_verification_session(
    CreateVerificationSessionInput(
        mode=VerificationMode.AGE,              # AGE or IDENTITY
        document_type=DocumentType.PASSPORT,    # optional: PASSPORT, NATIONAL_ID or DRIVERS_LICENSE
        chip_policy=ChipPolicy.OPTIONAL,        # optional: OPTIONAL, REQUIRED or INSTEAD_OF_PHOTO
        auto_capture=True,                      # optional: False makes the user tap Capture
    )
)
print(session.url)          # open this for the user; it carries a single-use token
print(session.expires_at)   # epoch milliseconds

# Later: poll until the session is completed or failed (or use webhooks)
status = await client.get_verification_session(session.session_id)
if status.status == VerificationSessionStatus.COMPLETED and status.result:
    print(status.result["status"])                    # "verified", "failed" or "needs_review"
    print(status.result["face_match"]["match_score"]) # 0.94: 0.5 at the match decision

The extracted document fields are only included on the first poll after completion. face_match.match_score (0 to 1) reads 0.5 at the match decision, high for a clear match and near 0 for different people; prefer it to confidence, which reads only about 0.55 on a clear match. Keep the link between a session and your own user by the session_id: the API has no external_id for sessions.

Voice Streaming

Real-time voice streaming with live safety analysis over WebSocket. Requires websockets:

pip install tuteliq[voice]
from tuteliq import VoiceStreamConfig, VoiceStreamHandlers

session = client.voice_stream(
    config=VoiceStreamConfig(
        interval_seconds=10,
        analysis_types=["bullying", "unsafe"],
    ),
    handlers=VoiceStreamHandlers(
        on_transcription=lambda e: print(f"Transcript: {e.text}"),
        on_alert=lambda e: print(f"Alert: {e.category} ({e.severity})"),
    ),
)

await session.connect()

# Send audio chunks as they arrive
await session.send_audio(audio_bytes)

# End session and get summary
summary = await session.end()
print(f"Risk: {summary.overall_risk}")
print(f"Score: {summary.overall_risk_score}")
print(f"Full transcript: {summary.transcript}")

Credits Tracking

Each response includes the number of credits consumed:

result = await client.detect_bullying("Test message")
print(f"Credits used: {result.credits_used}")  # 1
Method Credits Notes
detect_bullying() 1 Single text analysis
detect_unsafe() 1 Single text analysis
detect_grooming() 1 per 10 msgs ceil(messages / 10), min 1
analyze_emotions() 1 per 10 msgs ceil(messages / 10), min 1
get_action_plan() 2 Longer generation
generate_report() 3 Structured output
analyze_voice() 5 Transcription + analysis
analyze_image() 3 Vision + OCR + analysis
create_verification_session() see docs Charged when the session completes

Tracking Fields

All methods support external_id and metadata for correlating requests:

result = await client.detect_bullying(
    "Test message",
    external_id="msg_12345",
    metadata={"user_id": "usr_abc", "session": "sess_xyz"},
)

# Echoed back in response
print(result.external_id)  # "msg_12345"
print(result.metadata)     # {"user_id": "usr_abc", ...}

Usage Tracking

result = await client.detect_bullying("test")

# Access usage stats after any request
if client.usage:
    print(f"Limit: {client.usage.limit}")
    print(f"Used: {client.usage.used}")
    print(f"Remaining: {client.usage.remaining}")

# Request metadata
print(f"Request ID: {client.last_request_id}")

Error Handling

from tuteliq import (
    Tuteliq,
    TuteliqError,
    AuthenticationError,
    RateLimitError,
    ValidationError,
    NotFoundError,
    ServerError,
    TimeoutError,
    NetworkError,
)

try:
    result = await client.detect_bullying("test")
except AuthenticationError as e:
    print(f"Auth error: {e.message}")
except RateLimitError as e:
    print(f"Rate limited: {e.message}")
except ValidationError as e:
    print(f"Invalid input: {e.message}, details: {e.details}")
except ServerError as e:
    print(f"Server error {e.status_code}: {e.message}")
except TimeoutError as e:
    print(f"Timeout: {e.message}")
except NetworkError as e:
    print(f"Network error: {e.message}")
except TuteliqError as e:
    print(f"Error: {e.message}")

Type Hints

The SDK is fully typed. All models are dataclasses with type hints:

from tuteliq import (
    # Enums
    Severity,
    GroomingRisk,
    RiskLevel,
    EmotionTrend,
    Audience,
    MessageRole,
    # Input types
    AnalysisContext,
    DetectBullyingInput,
    DetectGroomingInput,
    DetectUnsafeInput,
    AnalyzeInput,
    AnalyzeEmotionsInput,
    GetActionPlanInput,
    GenerateReportInput,
    # Message types
    GroomingMessage,
    EmotionMessage,
    ReportMessage,
    # Result types
    BullyingResult,
    GroomingResult,
    UnsafeResult,
    AnalyzeResult,
    EmotionsResult,
    ActionPlanResult,
    ReportResult,
    Usage,
)

FastAPI Example

from fastapi import FastAPI, HTTPException
from tuteliq import Tuteliq, RateLimitError

app = FastAPI()
client = Tuteliq(api_key="your-api-key")

@app.post("/check-message")
async def check_message(message: str):
    try:
        result = await client.analyze(message)

        if result.risk_level.value in ["high", "critical"]:
            raise HTTPException(
                status_code=400,
                detail={"error": "Message blocked", "reason": result.summary}
            )

        return {"safe": True, "risk_level": result.risk_level.value}

    except RateLimitError:
        raise HTTPException(status_code=429, detail="Too many requests")

Best Practices

Message Batching

The bullying and unsafe content methods analyze a single text field per request. If your platform receives messages one at a time (e.g., a chat app), concatenate a sliding window of recent messages into one string before calling the API. Single words or short fragments lack context for accurate detection and can be exploited to bypass safety filters.

# Bad — each message analyzed in isolation, easily evaded
for msg in messages:
    client.detect_bullying(text=msg)

# Good — recent messages analyzed together
window = " ".join(recent_messages[-10:])
client.detect_bullying(text=window)

The grooming method already accepts a messages list and analyzes the full conversation in context.

PII Redaction

Enable PII_REDACTION_ENABLED=true on your Tuteliq API to automatically strip emails, phone numbers, URLs, social handles, IPs, and other PII from detection summaries and webhook payloads. The original text is still analyzed in full — only stored outputs are scrubbed.


Supported Languages

Tuteliq supports 32 languages with automatic detection, no configuration required.

English (stable) and 31 beta languages: Spanish, Portuguese, Ukrainian, Swedish, Norwegian, Danish, Finnish, German, French, Dutch, Polish, Italian, Turkish, Romanian, Greek, Czech, Hungarian, Bulgarian, Croatian, Slovak, Lithuanian, Latvian, Estonian, Slovenian, Maltese, Irish, Chinese, Japanese, Korean, Arabic and Russian.

All 24 EU official languages, plus Ukrainian, Norwegian, Turkish, Chinese, Japanese, Korean, Arabic and Russian. Each language includes culture-specific safety guidelines covering local slang, grooming patterns, self-harm coded vocabulary, and filter evasion techniques.

See the Language Support docs for details.


Support


License

MIT License - see LICENSE for details.


Get Certified — Free

Tuteliq offers a free certification program for anyone who wants to deepen their understanding of online child safety. Complete a track, pass the quiz, and earn your official Tuteliq certificate — verified and shareable.

Three tracks available:

Track Who it's for Duration
Parents & Caregivers Parents, guardians, grandparents, teachers, coaches ~90 min
Young People (10–16) Young people who want to learn to spot manipulation ~60 min
Companies & Platforms Product managers, trust & safety teams, CTOs, compliance officers ~120 min

Start here → tuteliq.ai/certify

  • 100% Free — no login required
  • Verifiable certificate on completion
  • Covers grooming recognition, sextortion, cyberbullying, regulatory obligations (KOSA, EU DSA), and more

The Mission: Why This Matters

Before you decide to contribute or sponsor, read these numbers. They are not projections. They are not estimates from a pitch deck. They are verified statistics from the University of Edinburgh, UNICEF, NCMEC, and Interpol.

  • 302 million children are victims of online sexual exploitation and abuse every year. That is 10 children every second. (Childlight / University of Edinburgh, 2024)
  • 1 in 8 children globally have been victims of non-consensual sexual imagery in the past year. (Childlight, 2024)
  • 370 million girls and women alive today experienced rape or sexual assault in childhood. An estimated 240–310 million boys and men experienced the same. (UNICEF, 2024)
  • 29.2 million incidents of suspected child sexual exploitation were reported to NCMEC's CyberTipline in 2024 alone — containing 62.9 million files (images, videos). (NCMEC, 2025)
  • 546,000 reports of online enticement (adults grooming children) in 2024 — a 192% increase from the year before. (NCMEC, 2025)
  • 1,325% increase in AI-generated child sexual abuse material reports between 2023 and 2024. The technology that should protect children is being weaponized against them. (NCMEC, 2025)
  • 100 sextortion reports per day to NCMEC. Since 2021, at least 36 teenage boys have taken their own lives because they were victimized by sextortion. (NCMEC, 2025)
  • 84% of reports resolve outside the United States. This is not an American problem. This is a global emergency. (NCMEC, 2025)

End-to-end encryption is making platforms blind. In 2024, platforms reported 7 million fewer incidents than the year before — not because abuse stopped, but because they can no longer see it. The tools that catch known images are failing. The systems that rely on human moderators are overwhelmed. The technology to detect behavior — grooming patterns, escalation, manipulation — in real-time text conversations exists right now. It is running at api.tuteliq.ai.

The question is not whether this technology is possible. The question is whether we build the company to put it everywhere it needs to be.

Every second we wait, another child is harmed.

We have the technology. We need the support.

If this mission matters to you, consider sponsoring our open-source work so we can keep building the tools that protect children — and keep them free and accessible for everyone.


Built with care for child safety by the Tuteliq team

Metadata

Release files for tuteliq 2.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tuteliq 2.5.0
File Size Uploaded Provenance Actions
tuteliq-2.5.0.tar.gz 525.6 kB Without provenance Details for tuteliq-2.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tuteliq 2.5.0
File Interpreter ABI Platform Actions
tuteliq-2.5.0-py3-none-any.whl Python 3 none any Details for tuteliq-2.5.0-py3-none-any.whl

Total release size: 556.9 kB

Release files / tuteliq-2.5.0.tar.gz

Download URL tuteliq-2.5.0.tar.gz
Size 525.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d3f7e5a33b94fd5ab2f7a730571df973856fe06d1f22665e4e0fcc68aa382e86
BLAKE2b-256 checksum
How to use checksums
f2a149d16bfd62856025df9f374b43f360c8006b73d1dde4c83098ba08cbf5ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tuteliq-2.5.0-py3-none-any.whl

Download URL tuteliq-2.5.0-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82612013e395466490c8321f68b4b4cdbd8da80a19a2c489fb8a499dcd4df81a
BLAKE2b-256 checksum
How to use checksums
404e66befc670ae7392bc88a6e5ee9fda009192c05595afd5fee77a5aa375eb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for tuteliq 2.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page