Production analyze endpoint: deterministic rules + Galvanize 2 neural engine

Changed on

A request is evaluated by deterministic regex & AST rules (<0.1 ms) and scored by the Galvanize 2 neural engine (fine-tuned from Horizon-Labs/prompt-injection-guard-small, Apache-2.0; scores 512 tokens at a time, and inputs of more than 2,000 characters in windows; full-precision ONNX on CPU). The verdict is block when the rules engine matches or the model score reaches the applied threshold (0.662); allow otherwise. If Galvanize 2 is unavailable, the previous model, Galvanize-60M, scores the request at its own threshold (0.95). Response bodies carry the model version (zn-galvanize2-fp32-s512, or zn-galvanize60m-int8-s512 when the fallback decided), the applied threshold and which signal decided the outcome. Self-hosted deterministic rules run in <0.1 ms. Held-out results for Galvanize 2 at 0.662: 83.4% recall, 0.81% false positive rate.

post/v30/analyze

Request

  • Base URL: https://api.usezn.com
  • URL: https://api.usezn.com/v30/analyze
  • Auth: one of:
    • HTTP bearer
    • OAuth 2 (client credentials, token URL https://dev-hpfq4tffrj4acggc.us.auth0.com/oauth/token, scopes: write:analyze)

Request body

inputstring required

The exact text you intend to pass to your tool. Analyze it BEFORE executing the tool call.

textstring

Alias of input. Send either input or text; input wins when both are present.

long_input'windows'

Score an input of 2,000 characters or fewer in overlapping 512-token windows too. Inputs of more than 2,000 characters are always scored in windows (up to 20). Window scoring answers within about 7 seconds; set a client timeout of at least 10 seconds.

Response

Combined verdict for the submitted input. Includes model observability headers whenever the model ran.

verdict'allow' | 'block' required

Block on "block" before executing the tool call.

confidencenumber float required

Confidence score of the decision.

rulestring required

Identifier of the deterministic rule that matched; "none" when allowed.

reasonstring nullable required

Human-readable explanation of the match, or null.

rules_versionstring required

Version of the rules engine that produced this verdict (for reproducible audits).

evidence_idstring required

ID of the stored evidence record for this decision.

latency_msinteger required

End-to-end processing time in milliseconds.

scorenumber float nullable

Model probability in [0,1] (Galvanize 2, or Galvanize-60M on fallback). null when the model mode is off or the engine was unavailable.

thresholdnumber float

Decision threshold applied to score when combining the model verdict: 0.662 (0.661988004118821) for Galvanize 2, 0.95 when Galvanize-60M decides on fallback.

decided_by'rules' | 'ml' | 'deep' | 'ml-error-rules-fallback' | 'deep-failopen'

Which signal produced the final verdict: deterministic rules, the neural model, or a fallback after a neural-engine error.

ml_versionstring nullable

Identifier of the model whose score was used (zn-galvanize2-fp32-s512, or zn-galvanize60m-int8-s512 on fallback); null when the model did not run.

ml_thresholdnumber float

Threshold reported alongside ml_version for reproducibility (0.661988004118821 for Galvanize 2, 0.95 for Galvanize-60M).

mode'shadow' | 'active' | 'off'

ML integration mode of this deployment: active (rules OR the neural model decides; current default), shadow (observed only), off (pure rules).

input_charsinteger

Characters of input, counted as Unicode code points.

billed_callsinteger

Calls billed: 1 up to 2,000 characters, one more for each extra 1,000 characters or part of them.

router_level'rules' | 'advanced' | 'deep'

Which path decided: rules, advanced (neural model) or deep. Same value as the X-ZN-Router-Level header.

deep_scorenumber float

Present only when the deep engine scored the input.

deep_modestring

Deep-engine integration mode of this deployment.

tier'free' | 'pro' | 'scale' | 'team' | 'internal'

Plan tier the call was served under.

Changes

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      endpoint added