Request a demo
All articles Product

The secure inference gateway: every model call checked, routed and recorded

How InsightDLM's OpenAI-compatible gateway authenticates each caller, applies access policy and data classification, redacts PII, blocks prompt injection, routes across model tiers and writes a tamper-evident audit record, so sensitive data never leaves your network.

November 19, 2026 · 7 min read

Fine-tuning a model on your data is only safe if the way it is used is controlled too. A model that has learnt from claims files will answer anyone who can reach it; an application can paste a customer's details into a prompt; a clever input can try to make the model ignore its instructions. InsightDLM puts one service in front of every model it serves, the secure inference gateway, and nothing reaches a model server except through it.

One endpoint, six stages

The gateway speaks the OpenAI chat completions API, so existing SDKs and agent frameworks work unchanged. The model field names a route (for example claims-triage), not a model. Routes point at deployments, so a new model version can be promoted and swapped in without any client changing a line.

The gateway Routes tab for a made-up insurer: one route, claims-triage, limited to confidential data, with a Tier 1 small model deployment and a Tier 2 domain LLM it escalates to, and capture turned on.
A route with a Tier 1 small model and a Tier 2 escalation target. Sample data.

① Authenticate and ② authorize

Applications call with an API key issued per application (only a hash is stored; keys can be rotated or revoked in one click). People and notebooks can call with a token from your identity provider. Each caller has a list of routes it may use, a maximum data classification (public, internal, confidential, restricted), and request-per-minute and token-per-day quotas. Ordered allow/deny access policies then apply by IdP group or by application: "claims adjusters may send confidential data to claims-triage", "contractors may not call claims routes at all".

The API clients tab: an Adjuster workbench application allowed confidential data and a Customer portal limited to internal data, each with a key prefix, rate limits and status.
Two applications with different data limits on the same route. Sample data.

③ Input guard

Before the model sees anything, the gateway looks for personal and sensitive data (emails, phone numbers, government IDs, payment cards checked with the Luhn test, account and policy numbers, medical record numbers, API keys) and, per route, masks it, replaces it with reversible tokens, or refuses the request. What it finds sets the request's classification. If the data is more sensitive than the caller or the route is allowed to send, the request stops there. The same stage scores prompt injection attempts and applies a topic gate, so a claims assistant can refuse "legal advice" outright.

The gateway playground: a request containing a made-up email address and policy number, and the decision trace: allowed by the default policy up to confidential, input classified confidential with one email and one policy number redacted, routed to the Tier 1 small model with confidence 0.85, output clean, and the response with [EMAIL] and [POLICY_NUMBER] in place of the values.
The playground runs the real pipeline as you. The model only ever saw [EMAIL] and [POLICY_NUMBER]. Simulator and sample data.

④ Route: cheapest tier that is sure

Each route lists its deployments cheapest first. The gateway starts at the smallest tier whose complexity ceiling fits the request and escalates to the next when the model's confidence (from token probabilities when the server returns them) is below the route's floor. A frontier model in your own cloud account can be the last tier, but only if an administrator has enabled egress, a policy allows it for that caller, and the request is not confidential or restricted. For sensitive data that is a hard rule, not a preference: the frontier tier is removed from the candidate list before routing starts.

The playground decision trace for a multi-step comparison request: classified public, complexity 4, escalated past the small model to the Tier 2 domain LLM for complexity, answered by the 27B model.
A multi-step request skips the small model and is answered by Tier 2. That escalation is captured as training data. Simulator.

⑤ Output guard and ⑥ audit

The answer is checked again, for personal data the model should not have produced and for unsafe content, before any byte is returned (streaming clients receive the approved text in chunks). Tokens that the caller sent are put back only for groups the route entitles to see them. Finally the gateway writes an audit record: caller, route, model version, tier, every policy and guard decision, tokens, latency and cost. Records are hash-chained, so editing or deleting one breaks verification, and prompt and response bodies are stored encrypted with your key, as a digest only, or not at all, by policy.

Calling it

import os
from openai import OpenAI
client = OpenAI(base_url="https://dlm-gateway.example.test/v1", api_key=os.environ["DLM_API_KEY"])
resp = client.chat.completions.create(model="claims-triage",
    messages=[{"role": "user", "content": "Summarise the hail damage claim and list missing items."}])
print(resp.choices[0].message.content)
# response headers: x-dlm-route, x-dlm-tier, x-dlm-model-version, x-dlm-audit-id

Applications can send POST /v1/feedback/{audit_id} with a thumbs up or down; with capture on, that feedback and every escalation feed the improvement loop.

Example · Harborline Mutual (fictional)

Two applications, one model, different rules

The adjuster workbench may send full claim notes, which are confidential. The customer portal may only send what a customer typed, classified internal at most; if a customer pastes a card number, the request is refused rather than sent. Contractors are denied by policy. All three share one route and one model, and the audit trail shows which rule applied to each call.

What the guards are and are not. The built-in PII and injection checks are deterministic pattern and heuristic checks that run on every request; they are a floor, not a guarantee, and they will miss things a trained classifier would catch (names, for instance). The curation jobs that prepare training data add a trained classifier (Presidio NER). The screens here use the built-in simulator and made-up data.

Scope a domain model with us

Bring one bounded task, a sample of the data behind it and the answers a good model should give. We set up the project, the dataset review and the evaluation suite with you.

Request a demo