Skip to content

LLM endpoint protection ​

Symptoms of LLM endpoint protection: prompt injection checks, the classifier helper, token and cost budgets, output scanning of answers (including streamed ones) and the endpoint list.

A normal chat message is flagged as prompt injection (llm.injection.heuristic) ​

  • Symptom: the event lists the patterns and weights (for example override 70, override_demand 40) for a message that users send on purpose.
  • Cause: the message combines phrases that also start attacks, such as a support script pasted into the chat, a template with role headers, or a long base64 attachment pasted as text.
  • Check: the matched value and the pattern list in the event; waap events list -app APP shows how often it happens and on which path.
  • Fix: keep on_injection: log on that endpoint, or add an exception that ignores llm.injection.heuristic on its path (or classify_roles without the role that carries the pasted text). Report the text so the patterns can be improved.

The classifier flags normal messages (llm.injection.classifier) ​

  • Cause: the model scores some ordinary text high, such as corrections like "ignore my previous message", code, or other languages.
  • Check: the score in the event against classifier.threshold.
  • Fix: raise the threshold (95 to 99), keep on_injection: log, or rely on the heuristics.

llm.classifier_unavailable once a minute ​

  • Symptom: the classifier cannot answer, and the event's matched value says why.
  • Cause and check, by matched value:
    • "not set up on this node" or "not installed": helpers.promptcheck.enabled is off, or waap-promptcheck is not next to waap (or at helpers.promptcheck.binary).
    • "starting" or "restarting": the helper is loading the model, or it crashed. Check System, Helpers (or GET /v1/system/helpers); the node's log has the helper's own messages, for example a model directory without model.onnx, tokenizer.json or config.json, a file that does not match its manifest, or ONNX Runtime not found.
    • "busy": every worker is classifying. Raise helpers.promptcheck.workers if the cores allow.
    • "over its time budget": the texts are long for the CPU (see waap_helper_duration_seconds).
  • Fix: install the add-on and the model (waap llm model fetch); set helpers.promptcheck.runtime to the ONNX Runtime library if it is not found; raise classifier.budget; or use a smaller model. Meanwhile on_unavailable: heuristics keeps the heuristics working.

Clients get 429 from a chat endpoint (llm.budget.tokens, llm.budget.cost) ​

  • Cause: the client identity used its tokens or cost for the minute or the last 24 hours. Many users behind one address share a budget when no identity source applies.
  • Check: the event's message (used and limit), the identity, and the usage table.
  • Fix: raise the limits, set 0 for no limit, or configure client identity (see Client identity) so users are counted apart.

A streamed answer arrives in bursts or a little late ​

  • Cause: events are held until output.hold_back characters of answer text follow them. The longest system prompt marker raises that value.
  • Fix: lower output.hold_back (values longer than it may then pass partly), or shorten the markers.

A streamed answer ends with event: error ​

  • Cause: output.action: refuse is set in block mode and a leak was found. The event reference is in the error event.
  • Fix: use mask to keep the answer and hide only the value.

Leaks pass in a streamed answer (llm.output.unscanned) ​

  • Cause: an event over 64 KiB, an answer over 16 MiB, or a compressed answer; the rest passed unchecked.
  • Check: the event's message names the limit.
  • Fix: none is needed for most chats. For huge answers, use the JSON (non-streamed) mode.

The prompt test says the classifier is unavailable ​

  • Symptom: Test a prompt (or waap api llm check) shows classifier: unavailable with a message.
  • Cause: the application has the classifier off ("disabled"); the process answering the request does not run waap-promptcheck (a control-only node: the message says so); or the helper is stopped, starting (the model takes a few seconds to load), busy, or over the budget.
  • Check: waap api llm helper (or System, Helpers): installed, enabled, state, restarts and last error; waap api get -app APP llm.classifier.enabled.
  • Fix: see "llm.classifier_unavailable once a minute" above, and run the test on an inspection node.

The usage table is empty or "this process has no usage store" ​

  • Cause: nothing was counted that day (check the day, in UTC); the endpoint path is not listed; the protection is off for the application; or the request was refused before counting. Usage is stored every few seconds, so a call may take a moment to show.
  • Check: waap api llm usage -app APP -day D; waap api llm endpoints -app APP; events for llm.endpoint.unlisted.
  • Fix: list the path. Run the CLI or open the console on a node with the management database.

Saving the endpoints is refused ​

  • Cause: a generic endpoint without prompt; a path not starting with /; a name used twice; a model price that is not name=input/output in the form; a system prompt phrase under 8 or over 256 bytes; more than 32 endpoints; or a limit below zero.
  • Check: the message names the endpoint and the field.
  • Fix: correct it and apply again.

Answers on an LLM path are not scanned at all ​

  • Cause: the path is not in endpoints[].paths (look for llm.endpoint.unlisted); the request was not a JSON POST of a known format; or the answer is neither JSON nor text/event-stream.
  • Fix: list the path, set the format, or set output (for generic answers).