How to Redact Spoken Account Numbers in OpenAI Realtime API Voice Sessions
Treat redaction as runtime enforcement in the session path, not post-call cleanup. Map every path a spoken number can take, detect on normalized transcript text before it reaches model context, tool-call arguments, stored transcripts and logs, and decide per path whether to allow, redact or block. Fail closed where the data is high risk. Keep evidence of each decision without storing the value. Do not assume the audio path can be given the same guarantees as the text path.
Map the data paths before choosing a control
- 1
Inbound audio
Raw caller speech. Digits and voice characteristics travel together.
- 2
Input transcription
Text produced from the audio, including partial and corrected results.
- 3
Model context
Anything the model can read, repeat or reason over in later turns.
- 4
Tool calls
Arguments sent to account lookup, payment or case systems.
- 5
Response output
Spoken or text replies that may echo the number back.
- 6
Persisted transcripts and logs
Event streams, stored transcripts and downstream copies with their own retention.
Retain evidence of control, not the values
- The policy version and rules in force for the session
- Per-path decision records: allow, redact or block, with timestamp
- The data type detected, such as card number, without the value
- Detector confidence and whether a checksum or context rule applied
- Fail-open or fail-closed events and handoffs to a human
- Test results for false negatives, and the documented audio-path limits
Compare redaction placement options
Where you place detection determines what it can protect, how much delay it adds and how often it is wrong. No placement is best on every axis. Which options are practical depends on how your session is brokered and which components you control. Measure added latency in the real session path rather than relying on estimates.
The earlier the control sits, the more paths it protects, but the less time it has to decide. Real-time audio processing generally runs under millisecond-scale latency budgets, so any inline step that touches audio must be cheap. Text inspection has more room, but the delay is still audible to a caller as dead air.
- Before the model, on transcript text: Protects model context, tool arguments and later storage. Adds latency to each turn. Accuracy depends on transcription quality.
- At the tool-call boundary: Inspects arguments before they reach systems of record. Low impact on conversation flow. Does not protect the model context.
- On response output: Stops the agent from repeating a number. Must run before audio is spoken to the caller, so it is time sensitive.
- At storage and log writes: Keeps persisted records clean with little effect on latency. The model has already seen the value.
- Post-call batch cleanup: Easy to run and easy to tune. Sensitive values exist in every path until it completes.
Design detection for how people actually say numbers
Spoken numbers do not look like the strings that pattern matchers expect. A caller may read digits one at a time, in groups, or as pairs. They may say "oh" for zero, pause mid-number, or restart after a mistake. A number may be split across turns because the agent asked the caller to repeat a portion. Speech-to-text may turn digits into words, merge them, or substitute similar-sounding values.
A workable detector normalizes first. Convert spoken forms to digit sequences, hold a short rolling window across turns, and treat a correction as a replacement of the preceding digits rather than a new number. Then apply pattern rules based on the identifiers you must protect: account numbers, card numbers and credential combinations that permit access. For card numbers, a checksum test such as the Luhn algorithm can cut false positives. It cannot confirm an account number whose format has no checksum, and it will miss a number the transcript got wrong.
Context helps where structure does not. Phrases such as "my account number is" or an agent prompt asking for a card number raise confidence for the digits that follow. Context also lets you accept a bare digit sequence as sensitive when it would otherwise look like a date or an amount. Tune thresholds against recorded test calls that include accents, noise and corrections. Report false negatives separately from false positives, because a missed number is the costly error.
Decide what to allow, redact or block on each path
Apply a different decision to each path instead of one global rule. A tool call that needs an account number to perform a lookup may justify allowing it, but only to a named tool and only after validation. The same value in a stored transcript or a log almost never has a reason to be there, so redact it. If the detector flags a number in a response the agent is about to speak, blocking the turn or replacing the number with a masked reference is safer than letting it through.
Also decide the failure behavior up front. If inspection is unavailable or times out, fail-open means sensitive values pass unchecked, and fail-closed means the call degrades or hands off to a human. For high-risk values, fail-closed is the defensible default, with a documented fallback so callers are not stranded. Where the model needs to refer to the number later in the call, use a placeholder or token that does not reveal it. Be careful with encryption as a redaction substitute. Regulatory acceptance of encrypted account numbers in the marketing-disclosure context is narrow and is not a general standard for voice sessions.
A policy layer that operates in the execution path can enforce these decisions at runtime, not review them after the fact. Trussed enforces policy on individual interactions and tool calls, with allow, redact or block outcomes, so the per-path rules above are applied while the session is running.
State the limits of the audio path
Text redaction is tractable. Audio is harder. Removing or masking spoken digits inside a live audio stream means detecting them in near real time and altering the signal without damaging intelligibility, and that is a different problem from redacting a transcript. A text control cannot promise that digits are absent from the audio the model receives or from any audio you store.
Raw audio can also carry more than the number. Voice characteristics are treated as biometric identifiers in de-identification literature, so a recording can identify a caller even when every digit is masked in the transcript. For that reason, document what you do and do not claim. Common choices are to avoid retaining audio, to shorten its retention, to restrict access to it, or to move number capture to a separate channel. Whatever you choose, record it as a known limit of the design, not as a solved problem.
Where a spoken account number can land
Inbound audio
The caller's voice, carrying digits and other identifying characteristics.
Input transcript
Text derived from speech, with recognition errors and partial results.
Model context and tool calls
Values the model reads, repeats or passes as arguments.
Stored records
Persisted transcripts, event streams, logs and downstream systems.
Show examiners what your voice agent was allowed to do
See how policy enforced in the execution path produces audit-ready evidence for each allow, redact or block decision.
See How Evidence Is ProducedHow does your AI governance program compare?
See where your program has gaps in less than 2 minutes.