Use cases · Updated 2026-11-15
Prompt injection testing: the loop, the scoring, the price.
A prompt injection test is not a hack, it is a measurement: feed attack-shaped inputs into YOUR application, record whether the guard holds, fix what failed, re-run. The loop below runs tonight on one API key.
TLDR. Who it suits: developers of their own LLM apps and guardrails who need a repeatable injection suite, not a one-off pentest report. Cost: at $0.03/$0.12 per 1M tokens a 100-request generation pass is about $0.009. The catch: this tests the app you own - pointing it at someone else's system is out of scope everywhere, free tools included.
The four steps
Nothing here is bespoke. Each row produces an artifact a ticket can reference.
| Step | Do | You get |
|---|---|---|
| 1. Corpus | Collect 50-200 injection attempts that fit your threat model: direct overrides, role confusion, tool-call abuse, encoding tricks | A versioned file of attacks with stable ids |
| 2. Variants | Generate paraphrases and novel attempts per request with the preset header X-Relay-Preset: redteam-fiction-v1 | A corpus that grows without hand-writing every mutation |
| 3. Run and score | Send every attack through your app guard; label each outcome hold or breach by your own rubric | Breach rate, with the raw log to re-check the arithmetic |
| 4. Harden and re-run | Patch the guard, re-run the same corpus, compare rates | A delta that proves the patch did something |
Same dataset in and out: hash the corpus, keep both logs, or the delta measures your edits instead of your patch.
Generation pass, end to end
The generator call is one header apart from a plain completion. Scoring stays yours: only you know what a breach means for your app.
import json, urllib.request
corpus = [json.loads(l) for l in open('corpus.jsonl')]
out = []
for atk in corpus:
body = json.dumps({
'model': 'deepseek-v4.1-flash-latest-jailbreak',
'messages': [{'role': 'user', 'content': atk['seed']}],
'max_tokens': 300,
}).encode()
req = urllib.request.Request('https://app.rawline.dev/v1/chat/completions', data=body,
headers={'Authorization': 'Bearer rlk_YOUR_KEY',
'Content-Type': 'application/json'})
resp = json.loads(urllib.request.urlopen(req).read())
out.append({'id': atk['id'], 'variant': resp['choices'][0]['message']['content']})
open('variants.jsonl', 'w').write('\n'.join(json.dumps(o) for o in out))
OpenAI-compatible
Free tools, and where this fits
Honesty first: the OSS suites do most of this for free, and you should know them before paying anyone per token:
- garak, PyRIT and promptfoo ship probe collections, harnesses and scoring rubrics for your own apps. If a free harness covers your threat model, use it - the cost of this loop is cents, so the honest argument for RawLine is frontier-grade paraphrase variety, not price.
- Where a per-request preset helps: generated variants stop drifting safe after fifty paraphrases. The preset keeps the generator in adversarial voice for the lawful corpus you own.
- Where dedicated vendors are stronger: if you need compliance reports, SLAs and auditor-ready artifacts, commercial pentest vendors ($4,500-$40,000 per engagement, per /blog/ai-security-audit-cost) sell exactly that. This loop buys the measuring instrument, not the report.
- Scope stays yours: the loop tests the app you own or are authorized to evaluate. Attack payloads against someone else's production system are out of scope for every tool on this page.
Questions
What does a prompt injection test cost on RawLine?
Generation only, at $0.03/$0.12 per 1M: 100 variants of ~300 output tokens is roughly $0.004; with prompts, about $0.009 per pass. Scoring runs on your side and costs nothing here.
Can I test someone else's chatbot?
No. The loop is for your own application or one you have written permission to evaluate. The preset changes refusal behaviour of the generator you are paying for, not of the target system.
How is this different from red teaming generally?
Injection testing is one slice of a red-team pass: it attacks the input boundary. Refusal benchmarks and false-refusal rates probe the model itself; the full loop is in /use-cases/ai-red-teaming.
Research only. Lawful use only. Test systems you own or are authorized to evaluate.