Overview
Streaming profanity filtering lets you automatically mask profane words in your streaming transcripts in real time. When enabled, the API replaces profane words with asterisks in both partial and final turns before sending them to the client. The mask uses the first letter of the word followed byn - 1 asterisks (for example, shit becomes s***). Apostrophes, capitalization, and surrounding punctuation are preserved (for example, shit's becomes s***'s).
Profanity filtering supports all streaming models: u3-rt-pro, universal-streaming-english, and universal-streaming-multilingual. It also works alongside other features such as format_turns and PII redaction.
Connection parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
filter_profanity | boolean | No | false | Enable real-time profanity filtering. When true, profane words in both partial and final turns are masked with asterisks (first letter preserved). The server accepts the truthy strings true, 1, and yes. Invalid values cause the WebSocket to close with code 3006. |
include_partial_turns | boolean | No | true | When false, the API only sends final turns. Useful with filter_profanity: true if you display partials directly to end-users and want to avoid any unmasked profanity flashing during word completion. |
Quickstart
Setfilter_profanity to true when you open the WebSocket.
- Python
- Python SDK
- Javascript
- JavaScript SDK
Example output
Withfilter_profanity=true, a final turn might look like:
shit's is returned as s***'s and motherfucker becomes m***********.
Troubleshooting
Why are some profane words still appearing in the transcript?
Why are some profane words still appearing in the transcript?
The streaming filter targets the same word list as pre-recorded profanity
filtering and only masks words on that list. Some words you might consider
profane, such as
crap and damn, are intentionally not masked and pass
through unchanged. If you need stricter filtering, apply your own
post-processing on top of the masked transcript.An unmasked profane word briefly appeared in a partial turn
An unmasked profane word briefly appeared in a partial turn
Profanity masking applies during word classification, so an unmasked partial
can briefly appear before the word is fully recognized and masked. If your
UI surfaces partials directly to users, set
include_partial_turns: false
on the connection. Final turns are always masked.