Maskena
SDKs and integrations

Integrations

Official libraries to protect chatbots, agents and RAG pipelines. All of them use the same API, with the same verdicts, limits and error codes, and are MIT licensed.

API documentation · OpenAPI specification · Detection accuracy · Versão em português

Python

v0.1.0

Sync and async clients, typed results, automatic retries and typed errors.

pip install maskena

Python 3.9+ · maskena on PyPI

Node.js / TypeScript

v0.1.0

TypeScript types, ESM and CommonJS, no dependencies: uses the built-in fetch.

npm install maskena

Node.js 18+ · maskena on npm

LangChain

v0.1.0

Blocks dangerous input before the prompt, filters retrieved documents and loads files already cleaned.

pip install langchain-maskena

Python 3.11+, langchain-core 1.x · langchain-maskena on PyPI

LlamaIndex

v0.1.0

A reader that returns only safe content and a postprocessor that filters nodes before the LLM.

pip install llama-index-maskena

Python 3.11+, llama-index-core 0.14 · llama-index-maskena on PyPI

REST API

v1

For any other language: HTTPS and JSON, with an OpenAPI 3.1 specification to generate clients.

curl -X POST https://maskena.com/api/v1/check

Reference · openapi.json

Which one to use

You want toUse
Check a user message before sending it to the model check() in the SDK, or MaskenaGuard in a LangChain chain
Check files uploaded by users (résumés, contracts, attachments) scan() in the Python or Node.js SDK
Index documents in a RAG pipeline with only safe content MaskenaLoader (LangChain), MaskenaReader (LlamaIndex) or sanitize() in the SDK
Stop a passage retrieved from the index from giving orders to the model MaskenaDocumentCompressor (LangChain) or MaskenaNodePostprocessor (LlamaIndex)
Another language or platformThe REST API, with the OpenAPI specification

Python

from maskena import Maskena

client = Maskena()                        # reads MASKENA_API_KEY
result = client.check(user_message, clean=True)

if result.flagged:
    text = result.clean_text              # or block / send to review

Node.js and TypeScript

import { Maskena } from "maskena";

const client = new Maskena();             // reads MASKENA_API_KEY
const result = await client.check(userMessage, { clean: true });

if (result.flagged) {
  // block, send to review, or continue with result.clean_text
}

LangChain

from langchain_classic.retrievers import ContextualCompressionRetriever
from langchain_maskena import MaskenaDocumentCompressor, MaskenaGuard, MaskenaLoader

docs = MaskenaLoader("manual.pdf").load()                    # only safe content, in chunks
vector_store.add_documents(docs)

retriever = ContextualCompressionRetriever(
    base_compressor=MaskenaDocumentCompressor(),             # drops dangerous retrieved passages
    base_retriever=vector_store.as_retriever(),
)
chain = {"question": MaskenaGuard()} | prompt | llm          # blocks dangerous input

LlamaIndex

from llama_index.core import VectorStoreIndex
from llama_index_maskena import MaskenaNodePostprocessor, MaskenaReader

documents = MaskenaReader().load_data(["contract.pdf", "manual.docx"])
index = VectorStoreIndex.from_documents(documents)

engine = index.as_query_engine(node_postprocessors=[MaskenaNodePostprocessor()])
response = engine.query("How long do refunds take?")

By default, the integrations drop dangerous content and continue with the clean version of suspicious content. Both are configurable (block_on and use_clean_text).

Packages and versions

PackageRegistryVersionRequirements
maskenaPyPI 0.1.0Python 3.9+
maskenanpm 0.1.0Node.js 18+
langchain-maskenaPyPI 0.1.0Python 3.11+, langchain-core 1.x
llama-index-maskenaPyPI 0.1.0Python 3.11+, llama-index-core 0.14

Versioning and compatibility

Costs

Each checked text or passage uses one text check from the monthly quota; each page sent for sanitization uses one page from the RAG quota. The Free plan includes 1,000 text checks and 30 pages per month. See plans.

Start in a few minutes

Create an account, generate a key under API and install the package for your language.

Create a free account