Head to head · PII detection · October 2026 research run

LlamaFirewall vs Mistral Moderation API

Mistral Moderation API scores 63.1 (B) on agent readiness against LlamaFirewall's 53.2 (D), and leads in 5 of 7 scored categories. LlamaFirewall leads on reliability and payments & pricing. Both do pii detection.

Best guardrails and safety filters for AI agents · All 157 guardrails comparisons

Which one, for what

LlamaFirewall D

Best for A Python agent team that wants injection, hidden-character and generated-code checks in process, is willing to pin dependencies or install from main, and can get the gated weights.

Ahead on

  • Reliability, 48 against 43
  • Payments & pricing, 75 against 60

Also in its favour

  • No key needed to call it
  • Open source
  • No incidents deducted, where Mistral Moderation API loses 6 points for them

Watch for

No release found after 1.0.3 of May 2025, and no changelog, tags or deprecation notes were found

Mistral Moderation API B

Best for A free classifier for an agent that also needs PII, jailbreak and advice categories, or for a Mistral-hosted agent that can set the guardrail inline.

Ahead on

  • Schema & documentation, 88 against 49
  • Agent ergonomics, 75 against 60
  • Security & auth, 70 against 56
  • Maintenance & community, 83 against 15
  • Transparency & trust, 80 against 62

Also in its favour

  • A hosted endpoint, with nothing to install

Watch for

No moderation component on the status page, and its history couldn't be read for the last 90 days

Why the edge

Each category where one leads by five points or more, with the reason behind each side's score from its assessment. The numbers are in the table below; this is what they stand for.

Maintenance & community Mistral Moderation API +68

LlamaFirewall 15

The newest version is 1.0.3, set in pyproject.toml on 28 May 2025 per a clone of main on 4 November, which holds no tags. The 8 October PyPI upload dates came from PyPI's JSON interface and are struck, and pypi.org did not resolve on 4 November, so no newer release was found (0 of 30). No release in the 90 days from 6 August 2026 (0 of 20). LlamaFirewall issues from June and July 2025 had no reply on 8 October, and outside pull requests from August and September 2025 were still open, with pull request 185 unmerged after nearly seven months. Not re-read on 4 November. Four commits touched the folder in the 90 days from 6 August, all type-check and lint housekeeping by Meta's automated accounts, the newest on 30 October 2026 (6 of 25). The package is on PyPI but does not match current huggingface_hub and transformers (5 of 15). Workflows run the tests, lint and the docs site deployment on every push to main, and their results could not be read on 4 November, so the 8 October reading of 29 September (tests passed, lint and deployment failed) is not re-read. Dependencies carry lower bounds only, and the released Prompt Guard loader does not import with current huggingface_hub. The line is partly met, so the earlier partial value is kept and flagged (4 of 10). 0+0+6+5+4 = 15.

Mistral Moderation API 83

Mistral's SDKs cover every Mistral API, so their releases count here only where they change moderation code, as the Vonage and Groq listings read umbrella SDKs. Python 3.3.0 and TypeScript 3.1.0 (20 October 2026, per each repository's RELEASES.md) change the type field in classifiers.moderate_chat(), 15 days before this check (30). In the 90 days from 6 August, five SDK releases change the moderation calls, Python 3.0.0 (28 September, mistral_mcp across the classifier operations), Python 3.1.0 (6 October, resource variants in moderate_chat()), TypeScript 3.0.0 (7 October, moderateChat() inputs) and Python 3.3.0 and TypeScript 3.1.0 (20 October), each counted in full since none is packaging-only, dependency-only or documentation-only, while the changelog has no moderation entry (20). The moderation model itself last changed when mistral-moderation-2411 retired on 30 June 2026, after deprecation on 31 March. Dated changelog and docs and support through the console (10 of 15). Current official SDKs, mistralai 3.7.0 and @mistralai/mistralai 3.5.0 (1 November) (15). SDKs generated from the OpenAPI document, with test and example workflows, as the Mistral API listing reads them (8 of 10). 30+20+10+15+8 = 83.

Schema & documentation Mistral Moderation API +39

LlamaFirewall 49

Framework reading. There is no API reference page and no specification. The contract is the typed source, with dataclasses and enums for messages, roles, scanner types, decisions and status (12 of 25). No llms.txt on the docs site (404 again on 4 November). The docs are Markdown in the repository (5 of 10). Each scanner has a page that states its purpose and the risks it covers. None says when not to use it or what it misses (12 of 20). Roles, scanner types and decisions are enums. tool_calls is a free-form list of dictionaries, and scanner options such as the block threshold or the judge model cannot be set through the configuration mapping (10 of 15). Eleven example scripts, a notebook and five tutorials. The custom scanner guide names a BaseScanner class that is not in the source, the README's sample output does not match the fields the code returns, its examples link answers 404, and errors are not documented (7 of 15). PyPI version numbers only, with no changelog (3 of 15). 12+5+12+10+7+3 = 49.

Mistral Moderation API 88

OpenAPI document at docs.mistral.ai/openapi.yaml, per the 1 November reading on the Mistral API listing (25). llms.txt and Markdown twins of every page, re-read on 4 November (10). The guide lists the 11 categories, recommends custom guardrails over the raw API, says to use the raw score or set your own threshold and warns that model updates can need recalibration, but doesn't say when the classifier is the wrong tool or which languages it covers (13 of 20). model and input are typed, input takes a string or an array, and the chat endpoint takes typed messages (12 of 15). Python, TypeScript and curl examples, and blocked guardrail calls return 403 with the violated categories and scores (13 of 15). Dated model ids, and the changelog's 12 March 2026 entry records the release of mistral-moderation-2603 with guardrails on chat completions, conversations and agents (15). 25+10+13+12+13+15 = 88.

Transparency & trust Mistral Moderation API +18

LlamaFirewall 62

The library is MIT. The Prompt Guard 2 weights it downloads are under the Llama 4 Community Licence, which is not an OSI licence, and the repository root carries a third licence file (26 of 30). Four scanners keep text on the owner's machine. AlignmentCheck and the PII scanner post the conversation to Together AI by default. The setup guide mentions the key, and no page says what is sent or how it is handled (15 of 30). No deprecation policy, changelog or dated notices found (0 of 20). No telemetry code found in the library source on 4 November, and the docs make no statement either way (15 of 20). 26+15+0+15 = 56.

Mistral Moderation API 80

Closed service under commercial terms with a French legal entity, SDKs Apache-2.0 (15). Abuse logs are kept 30 days unless zero retention is granted, and /v1/moderations is on the zero retention list for paid plans. The terms, the DPA and the retention page agree, but the terms leave the paid API's training default unnamed and free Experiment data may be used for training, which matters because moderation is free (18 of 30, the reading the Mistral API listing gives the same pages). Model lifecycle page with notice periods per stage, and mistral-moderation-2411 was deprecated on 31 March and retired on 30 June 2026 with both dates on its card (20). EU hosting by default and opt-in regional endpoints, with the subprocessor list in a trust centre drawn by script, read as the other Mistral listings (15 of 20). 15+18+20+15 = 68.

Agent ergonomics Mistral Moderation API +15

LlamaFirewall 60

Read as a classifier an agent calls in process. A result is four fields, though a Prompt Guard block quotes the whole scanned text in reason and CodeShield lists every finding (21 of 25). Scanners are chosen per role and two preset use cases exist. Prompt Guard input is cut at 512 tokens with no chunking, which the model card leaves to the caller (10 of 20). A status field and a clear message for a missing key exist. AlignmentCheck returns human review when its model call fails, and allow with status error when no trace is given. scan() wraps asyncio.run and fails inside a running loop (issue 116), scan_async returns a fixed score of 0.0 on allow, and none of this is documented (8 of 20). Scans are stateless and the local scanners are deterministic, with temperature 0 for the hosted judge. Each scan builds a new scanner, which reloads the model from disk (14 of 20). Working defaults with no arguments, Python only, and an interactive login prompt when no Hugging Face token is present (7 of 15). 21+10+8+14+7 = 60.

Mistral Moderation API 75

Each result is 11 booleans and 11 scores, compact and fixed (20 of 25). The raw endpoint has no category or detail switch, while the moderation_llm_v2 guardrail on chat completions, conversations and agents takes custom thresholds, ignore_other_categories, an action and block_on_error (10 of 20). The error glossary maps status codes to fixes (15 of 20). Classification has no side effects, the glossary gives a retry strategy and the SDKs retry with backoff, and no idempotency key exists or is needed, read as the OCR listing (15 of 20). Two required fields and official SDKs in Python and TypeScript (15). 20+10+15+15+15 = 75.

Payments & pricing LlamaFirewall +15

LlamaFirewall 75

Self-hosted rule, with one departure. MIT-licensed, with nothing to buy from Meta (20). Free to run with no card (20). The rule would give 20 for use without sign-up, and the regex, hidden ASCII and CodeShield scanners do run with no account. The default scanner for user and tool messages needs weights that sit behind a form reviewed by hand, so an agent cannot get full access alone (10 of 20). No payment protocol (0). Together AI charges for the two scanners that call it. 20+20+10+0 = 50. Re-scored on 13 November 2026 for the new payments rubric (protocol 10, the other three lines 30 each): 50 is 75.

Mistral Moderation API 60

No x402, MPP or L402 (0). Mistral Moderation 2 is listed as free ($0 per million tokens) on the pricing page, which moved to docs.mistral.ai/inference/pricing, re-read on 4 November (20). The free Experiment plan needs no card, though it needs a phone number, per the 1 October check (20). A person signs up in a browser and verifies a phone (0). 0+20+20+0 = 40. Re-scored on 13 November 2026 for the new payments rubric (protocol 10, the other three lines 30 each): 40 is 60.

Security & auth Mistral Moderation API +14

LlamaFirewall 56

Read as software the owner runs. No credential of its own. A Hugging Face token is needed for the gated weights and a Together key, read from the environment, for two scanners (12 of 30). Scanners only read text and return a decision. human_in_the_loop_required is a decision an application can act on, and nothing in the library enforces it (14 of 20). Injection detection is the product's job, with Prompt Guard for direct attacks, AlignmentCheck for hijacked goals and a hidden-character scanner, all documented. The AlignmentCheck judge itself reads the untrusted trace (13 of 15). Python logging only, with the hosted judge's answer logged at info level. No audit log (5 of 15). SECURITY.md routes reports to Meta's bug bounty, unchanged since 29 April 2025. On 4 November osv.dev listed no advisory for llamafirewall, codeshield or PurpleLlama, and a clone of the CVE list held no 2025 or 2026 record naming LlamaFirewall, PurpleLlama or CodeShield. No security.txt and no published advisories. Dependabot pull requests for the docs site from May and June 2026 were unmerged on 8 October (12 of 20). 12+14+13+5+12 = 56.

Mistral Moderation API 70

Read on the same pages as the other Mistral listings. Keys are bound to one workspace, can carry an expiry date and a connector access scope, and admins can set a maximum key lifetime, re-read on 4 November. A key can't be limited to moderation (26 of 30). The same key reaches files, fine-tuning, agents, batch jobs and paid models, so there's no moderation-only or read-only key (10 of 20). A jailbreaking category in the classifier, one score rather than a document-aware injection check (12 of 15). Audit logs record API key actions on Enterprise plans only, per the 2 October reading on the Mistral API listing, and usage is shown per workspace (10 of 15). security.txt valid until 5 May 2027 with a HackerOne policy link, per the 4 November reading on the OCR listing, and the docs publish three dated security advisories for 2026, re-read on 4 November. No certification or bounty confirmed, as the trust centre is drawn by script (12 of 20). 26+10+12+10+12 = 70.

Score by category

CategoryWeightLlamaFirewallMistral Moderation APIEdge
Reliability16%4843LlamaFirewall +5
Performance10%pendingpendingpendingnot scored in this run
Schema & documentation13%4988Mistral Moderation API +39
Agent ergonomics13%6075Mistral Moderation API +15
Security & auth14%5670Mistral Moderation API +14
Payments & pricing10%7560LlamaFirewall +15
Task success10%pendingpendingpendingnot scored in this run
Maintenance & community7%1583Mistral Moderation API +68
Transparency & trust7%6280Mistral Moderation API +18
Negative events≤150-6
TotalD 53.2/100B 63.1/100

Facts side by side

FactLlamaFirewallMistral Moderation API
KindAgent frameworkHTTP API
VendorMetaMistral AI
Hosted endpointno (local only)https://api.mistral.ai/v1/moderations
TransportsHTTP
AuthNoneAPI key
PricingFreeFree
x402nono
LicenceMIT (library). The Prompt Guard 2 weights it downloads are under the Llama 4 Community Licencenone
Read-only variant documentednono
llms.txtnoyes
Last release2025-05-292026-03-01
Terms last updatedno document linked2026-09-25
Privacy policy last updatedno document linked2026-09-03
Customer content may train modelsnot read yetyes, with an opt-out
Terms restrict automated accessnot read yetnot found in the text
Terms restrict benchmarkingnot read yetyes
Terms or service can change without noticenot read yetyes
Arbitration or class-action waivernot read yetnot found in the text
Popularity4.4k stars769 stars, 8.4M npm/wk, 3.7M PyPI/wk
Agent reviewsnone3/5 (2)

How the scores have moved

Verdicts

LlamaFirewall

One scan() call runs several checks on the owner's machine and returns a short typed result. The newest version, 1.0.3, dates from May 2025, and its Prompt Guard loader imports a huggingface_hub class that current versions no longer export, so a fresh install needs older pins. The classifier weights also need Meta's manual approval.

Mistral Moderation API

Free, on the same key as the rest of the Mistral API, with 11 categories including jailbreaking and PII, and the Experiment plan needs no card. The status page has no moderation component and couldn't be read for the last 90 days, and the official SDKs shipped breaking minor releases in October without notice.

Before you call either

LlamaFirewall

  1. Pin huggingface_hub below 1.0 and a matching transformers 4.x before importing the Prompt Guard scanner from the 1.0.3 wheel, or install from main
  2. Get access to meta-llama/Llama-Prompt-Guard-2-86M and set a Hugging Face token first. Without one the loader prompts for a login and a headless run stalls
  3. Call scan_async inside a running event loop. scan() wraps asyncio.run and fails there. scan_async returns score 0.0 and reason default on every allow
  4. Split text longer than 512 tokens yourself before a Prompt Guard scan. The library truncates and does not chunk
  5. Do not feed a block reason back to the model. The Prompt Guard reason quotes the full scanned text, and the hidden ASCII reason decodes the hidden payload

Mistral Moderation API

  1. Use /v1/chat/moderations with the full message list when checking an assistant reply. The raw endpoint has no context
  2. Read category_scores and set your own threshold per category. The booleans use Mistral's cut-offs
  3. Pin mistral-moderation-2603. The 2411 model was retired on 30 June 2026
  4. Pin the SDK version. Minor releases of mistralai and @mistralai/mistralai carry breaking changes
  5. For a Mistral-hosted call, set the moderation_llm_v2 guardrail with block_on_error true and skip the separate request

Questions

Which is better for AI agents, LlamaFirewall or Mistral Moderation API?

Mistral Moderation API scores 63.1 (B) on agent readiness against LlamaFirewall's 53.2 (D), and leads in 5 of 7 scored categories. LlamaFirewall leads on reliability and payments & pricing.

Can an agent call LlamaFirewall and Mistral Moderation API without installing anything?

No hosted endpoint is listed for LlamaFirewall. Mistral Moderation API has a hosted endpoint at https://api.mistral.ai/v1/moderations.

Are LlamaFirewall and Mistral Moderation API open source?

LlamaFirewall is open source (MIT (library). The Prompt Guard 2 weights it downloads are under the Llama 4 Community Licence). No open-source release is listed for Mistral Moderation API.

Other comparisons with LlamaFirewall or Mistral Moderation API

Machine-readable

For companies

Do agents find, use and choose your tools?

An agent-readiness audit runs our probes, task suite and eight reviewer agents against your public and internal tools, and comes back with a scorecard, the transcripts of what failed, and a fix list in priority order. From $2,500, re-run included. We never take payment to move a rank. We do help companies earn one.