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.
Python
v0.1.0Sync and async clients, typed results, automatic retries and typed errors.
pip install maskena
Node.js / TypeScript
v0.1.0TypeScript types, ESM and CommonJS, no dependencies: uses the built-in fetch.
npm install maskena
LangChain
v0.1.0Blocks dangerous input before the prompt, filters retrieved documents and loads files already cleaned.
pip install langchain-maskena
LlamaIndex
v0.1.0A reader that returns only safe content and a postprocessor that filters nodes before the LLM.
pip install llama-index-maskena
REST API
v1For any other language: HTTPS and JSON, with an OpenAPI 3.1 specification to generate clients.
curl -X POST https://maskena.com/api/v1/check
Which one to use
| You want to | Use |
|---|---|
| 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 platform | The 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
| Package | Registry | Version | Requirements |
|---|---|---|---|
maskena | PyPI | 0.1.0 | Python 3.9+ |
maskena | npm | 0.1.0 | Node.js 18+ |
langchain-maskena | PyPI | 0.1.0 | Python 3.11+, langchain-core 1.x |
llama-index-maskena | PyPI | 0.1.0 | Python 3.11+, llama-index-core 0.14 |
Versioning and compatibility
- The API is at version 1 (
/api/v1). Breaking changes only ship in a new path version, with advance notice; the current version keeps working. - Error codes (
code) and the values ofverdictandseveritydo not change. New fields may appear in responses: the libraries preserve them. - The libraries follow semantic versioning: patch and feature releases do not break your code.
- All of them retry automatically on rate limits (respecting
Retry-After) and server errors, without resending requests that may have been charged.
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.