Use Case · Customer Support

Support bots with guardrails built in.

Support traffic carries real customer data and the occasional hostile prompt. nRouter redacts PII and blocks injection on every request, keeps tone consistent with versioned templates, and caps spend with budgets.

support-bot · guardrail trace

Every message, screened first

Injection scanclean
PII detectedemail, phone
PII actionredacted
Prompt templatesupport-v4
Modelgemini-2.5-flash
Budget$18 / $50
PII-safeinjection-blockedbudgeted
Cost reduction
50–75%

Via FAQ caching & fast-tier routing

Failover uptime
99.99%

Zero dropped customer conversations

Cache hit latency
<15 ms

Instant answers for top repeat questions

Guardrail defense
100%

Inline PII redaction & injection block

Why nRouter for support

Safety, consistency, and cost — handled

A support bot is the part of your AI stack that talks to real customers. It needs to protect their data, resist abuse, stay on-brand, and not blow the budget.

PII redaction on every message

Emails, phones, SSNs, cards, IPs detected and masked before the prompt leaves your gateway. Customer data never lands unredacted in a provider log. Every redaction recorded.

Prompt-injection defense

A public-facing bot gets hostile inputs. Jailbreak and instruction-override patterns are blocked before the provider call and surfaced in the guardrail log for review.

Versioned prompt templates

Tone, escalation rules, and brand voice live in one central template. Edit it and every bot updates; A/B test two versions, roll back without a redeploy.

Cost control for bursty volume

Per-key and per-team budgets cap spend with a hard 402 ceiling, while caching absorbs the repeated FAQ traffic that drives most support volume.

How it works

A support message, screened end to end

Every inbound message passes the same gates: injection detection, then PII redaction, then the templated prompt. Guardrails run before the model ever sees the text.

Support request flow

  1. Customer Message

    inbound chat turn

    User inquiries, ticket updates, account queries from Zendesk/Intercom.

  2. Gateway & Bot Auth

    :4000 · In-Memory RLS

    Bot virtual key authentication, rate pacing, and monthly budget caps.

  3. Safety & PII Guardrail

    Pre-Inference Filter

    Masks SSNs, cards, emails, and blocks prompt-injection jailbreaks.

  4. Smart Router & Cache

    Semantic FAQ Cache

    Repeated inquiries hit cache in <15ms; novel turns route to fast flash tier (50–75% ROI).

  5. Model Providers

    OpenAI · Anthropic · Bedrock

    99.99% multi-provider failover ensuring zero dropped customer conversations.

Guardrails run inline before the provider call. A blocked or redacted message never reaches the model, and the event is logged so your trust and safety team can review it.

The code

Reference a template, let guardrails run

Your bot calls the standard chat endpoint and points at a prompt template by id. Guardrails apply automatically. You do not wire them per request. These snippets are generated from the SDK examples the playground uses.

Installpip install openai
1# Cache: enabled (org default). Pass nrouter_cache: false to skip.
2from openai import OpenAI
3import os
4
5client = OpenAI(
6 api_key=os.environ["NROUTER_API_KEY"],
7 base_url="https://api.nrouter.ai/v1",
8)
9
10response = client.chat.completions.create(
11 model="gpt-5.4-mini",
12 temperature=1,
13 max_completion_tokens=1024,
14 messages=[
15 {"role": "user", "content": "Hello! What models do you support?"},
16 ],
17 extra_body={
18 # "nrouter_cache": False, # Uncomment to skip cache
19 },
20)
21
22print(response.choices[0].message.content)

Pass nrouter_prompt_template_id in extra_body to drive tone from a central, versioned template.

FAQ

Common support-bot questions

How does nRouter protect customer PII in support conversations?

PII redaction runs as an inline guardrail filter on every request. It detects and masks email addresses, phone numbers, SSNs, credit-card numbers, and IP addresses before the prompt reaches the model, ensuring sensitive customer data is never leaked or retained in third-party provider logs.

Can guardrails block prompt-injection attempts from customers?

Yes. A prompt-injection detection guardrail inspects every inbound message for jailbreak, roleplay bypass, and instruction-override patterns. Any hostile payload is halted before it reaches the foundation model, returning a safe deflection response while logging the attempt in the security audit ledger.

How do semantic caching and tier routing reduce customer support costs?

Customer support traffic is heavily repetitive. nRouter caches frequently asked question responses semantically, serving identical questions in under 15 milliseconds at $0 model token cost. Uncached queries route to high-efficiency flash models, cutting overall support inference bills by 50% to 75%.

How does multi-provider failover keep support bots online 24/7?

If an upstream foundation model provider degrades, hits rate limits, or returns 5xx status codes, nRouter’s circuit breaker reroutes traffic to an alternative provider in milliseconds. Your support bots maintain 99.99% operational uptime without customer-visible downtime or chat dropouts.

Can I enforce hard monthly budget limits on customer support bots?

Yes. Each support bot operates under a dedicated virtual key with strict hard budget caps. When monthly allocations are exhausted, the gateway returns HTTP 402 rather than incurring surprise overdrafts. Soft alerts warn your operations team at 70%, 90%, and 100% capacity thresholds.

Safe by default

Ship a support bot your security team signs off on

PII redaction, injection defense, versioned prompts, and budgets — all unlocked on every plan across 169+ models.

Explore other use cases

Production AI workflows powered by nRouter