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.

① 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".

③ 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.](assets/img/screens/dlm-gateway-playground.webp)
④ 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.

⑤ 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.
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.


