layahost

LLM guardrails

Guardrails
without a GPU.

Check what goes into your LLM and what comes out: prompt injection hidden in web pages and emails, personal data, toxic text, risky agent actions. Each check is one HTTPS call that answers in a fraction of a second with a probability you can set a threshold on. We publish how often each one is right.

The checks

CheckWhere to put itMeasured (held out)
prompt_injectionOn web pages, emails, documents and tool output before the agent reads them; on user messagesAUC 0.93: catches 87% of injections, flags 11% of harmless texts (136 texts, Laya). Indirect injections hidden in pages and emails (20 texts, half of them injections): Laya caught 100% but flagged 30% of the harmless ones; Clef and Clef-flash got all 20 right.
piiBefore text goes to a third-party model, into logs, or back to a userEntity F1 0.92 on Nemotron-PII, 0.68 on a harder financial set. See PII redaction.
moderation and /v1/moderationsOn user input and on model outputSee the comparison with OpenAI’s moderation endpoint
Your own questionAnywhere: “Does this reply promise a refund?”, “Is the user asking for medical advice?”Measure it on your own examples with a test set

Prompt injection: deepset/prompt-injections test split plus hand-written indirect injections, wording chosen on a separate tuning split; Laya at threshold 0.30, Clef at the default 0.5 (see models). AUC 1.0 means the check separates the two perfectly, 0.5 is a coin toss. Small sets: measure on your own data.

One call per check

python
import os, requests

def check(text, template, model=None):
    r = requests.post(
        "https://layahost.com/v1/decide",
        headers={"Authorization": f"Bearer {os.environ['LAYAHOST_API_KEY']}"},
        json={"text": text, "template": template, **({"model": model} if model else {})},
        timeout=5,
    )
    r.raise_for_status()
    return r.json()

def chunks(text, size=3000):
    # Laya reads about 1,000 tokens and the API takes up to 32,000 characters:
    # check long pages piece by piece so nothing at the end goes unread.
    return [text[i:i + size] for i in range(0, len(text), size)] or [""]

page = fetch_page(url)  # whatever your agent just read
if any(check(c, "prompt_injection")["probabilities"]["injection"] > 0.3 for c in chunks(page)):
    page = "[removed: this page tried to give the assistant instructions]"

reply = check(llm_answer, "pii")
llm_answer = reply["redacted"] if reply["decision"] else llm_answer

To run several checks with one call, put the templates in a decision flow and call it as one endpoint; only the questions on the path are billed. Your own questions can also go together in one /v1/systemone request. Agents can call the same checks as tools through the layahost MCP server.

Pick the model per check

The pii check runs its own detector. The others run on Laya by default: about 0.1 s on our EU servers, $15 per million checks. For the hard ones, add "model": "clef-flash" or "clef": Cloudflare’s larger open decision models, 0.4 to 1 s, billed by input tokens. On our held-out indirect injections, Laya caught them all but also flagged three harmless texts in ten; Clef made no mistakes. Run your own examples through both in a test set and keep the cheaper one if it is good enough.

Llama Guard, NeMo Guardrails, LLM Guard?

They solve neighbouring problems, and you can combine them with layahost.

Honest limits

What it costs

Each check is one decision on Laya ($15 per million, less on a plan), or billed by input tokens on Clef. $1 of free credit after email verification, no card. See pricing.