Developers
From zero to governed in under an hour.
A versioned REST API (/api/v1/), native MCP support, and token-based auth. Async training via Celery + Redis. pgvector-native knowledge base.
POST · /API/V1/AI/INFER
Governed LLM inference
Runs input filter + classifiers, calls the configuration's model, screens output. Returns flags and the six validation scores.
POST /api/v1/ai/infer
Authorization: Token <key>
{
"config_id": "<uuid>",
"messages": [
{"role":"user","content":"Summarize Q3..."}
],
"image_urls": []
}
→ { "message_id": "...",
"content": "...",
"flags": { "attack": false,
"impersonation": false,
"disallowed": false,
"sensitive": false },
"validation_scores": {
"religion":0.01, "politics":0.04,
"gender":0.00, "race":0.01,
"violence":0.02, "sensitive":0.06 },
"tokens_used": { "prompt":120,"completion":88 } } KNOWLEDGE BASE
Search & train DocumentCollections
Semantic + full-text hybrid retrieval over pgvector. Training is async — poll a job ID or subscribe via webhook.
POST /api/v1/kb/search
{ "collection_id": "<uuid>",
"query": "revenue recognition policy",
"top_k": 5 }
POST /api/v1/kb/train
{ "collection_id": "<uuid>",
"document_id": "<uuid>" }
→ { "job_id": "<uuid>" }
GET /api/v1/jobs/<job_id>/status
→ { "status": "succeeded" } MODERATION · AS-A-SERVICE
Moderate or redact arbitrary text
Standalone endpoints. Use before storing user-generated content downstream, or as a governance pass on legacy pipelines.
POST /api/v1/moderation/moderate
{ "text": "..." }
POST /api/v1/moderation/redact
{ "text": "..." }
→ { "flags": { "sensitive": true },
"scores": { "religion":0.02, ... },
"redacted": "Please contact me at [EMAIL]." } MCP · SERVICE ACCOUNTS
Governed tool calls from external MCP servers
Org-scoped service accounts. Tokens shown once, hashed at rest, instant-revoke. Every MCP-initiated message is filtered, scored, and audit-logged.
// External MCP server calls 2Trust on org's behalf:
fetch("/api/v1/ai/infer", {
headers: {
"Authorization": "Token mcp_sa_4f2a...",
"Content-Type": "application/json"
},
body: JSON.stringify({
config_id: "<uuid>",
messages: [...],
meta: { mcp_tool: "crm.sync" }
})
}); Quickstart/api/v1/ai/infer/api/v1/kb/search/api/v1/kb/train/api/v1/moderation/*/api/v1/jobs/*MCP service accountsWebhooksAuth0 SSOSelf-hosted installDocker + CodeDeploypgvector setup
Stack
Open, inspectable, deployable in your VPC.
Backend
Django 4.2 + DRF · Python 3.10+
Data
PostgreSQL + pgvector
Async
Redis + Celery 5.3
ML
PyTorch 2.1 · HF Transformers · FP16/INT8
Frontend
Django templates · Tailwind 3.4
Deploy
Docker · CodePipeline · CodeDeploy · ECR
Identity
Auth0 OAuth2 · Django Allauth
Observability
ErrorLog · simple-history · perf dash