2 2
3# Output Watermarking3# Output Watermarking
4 4
55Text watermarking embeds an invisible signal in text generated by Grok models, so the text can later be identified as AI-generated. Watermarking can help enable compliance with the EU AI Act.Watermarking embeds an invisible signal in text and audio generated by Grok models, so the output can later be identified as AI-generated. Watermarking can help enable compliance with the EU AI Act.
6 6
7> [!TIP]7> [!TIP]
8>8>
99> Text watermarking is off by default. Team admins can turn it on per model in the SpaceXSI Console's team settings; see [How to enable text watermarking](#how-to-enable-text-watermarking).> Text watermarking is off by default. Team admins can turn it on per model in the SpaceXSI Console's team settings; see [How to enable text watermarking](#how-to-enable-text-watermarking). Audio from the voice APIs is watermarked in some regions and when you ask for it; see [Audio watermarking](#audio-watermarking).
10 10
11## Which outputs are watermarked11## Which outputs are watermarked
12 12
119 119
120Every opt-in and opt-out is recorded in your team's audit log. Team admins can view it on the [Audit Log page](https://console.x.ai/team/default/audit?utm_source=docs\&utm_medium=referral\&utm_campaign=developers-watermarking\&utm_content=audit) in the SpaceXSI Console. To find a change, search by event ID, description, or user, and use the time filter to narrow the results to a range of dates. For screenshots of these filters, see [Do you have audit logs?](/developers/faq/security#do-you-have-audit-logs) in the security FAQ.120Every opt-in and opt-out is recorded in your team's audit log. Team admins can view it on the [Audit Log page](https://console.x.ai/team/default/audit?utm_source=docs\&utm_medium=referral\&utm_campaign=developers-watermarking\&utm_content=audit) in the SpaceXSI Console. To find a change, search by event ID, description, or user, and use the time filter to narrow the results to a range of dates. For screenshots of these filters, see [Do you have audit logs?](/developers/faq/security#do-you-have-audit-logs) in the security FAQ.
121 121
122## Audio watermarking
123
124Audio from the voice APIs can also include an invisible watermark. This applies to [Text to Speech](/developers/model-capabilities/audio/text-to-speech) and [Speech to Speech](/developers/model-capabilities/audio/speech-to-speech), including speech in [custom voices](/developers/model-capabilities/audio/custom-voices).
125
126The watermark is [AudioSeal](https://github.com/facebookresearch/audioseal). It is added to the audio before it is encoded, so every output format includes it, and it can't be heard.
127
128### Which audio is watermarked
129
130Audio is watermarked when:
131
132* The request is sent to `eu-west-1.api.x.ai`.
133* The end user is in the EU, the EEA, or California. The location comes from the IP address of the request.
134* The request asks for a watermark. See [How to enable audio watermarking](#how-to-enable-audio-watermarking).
135
136If none of these apply, the audio is not watermarked.
137
138### Checking whether audio was watermarked
139
140Read the `x-watermark` header on the response, as with text. `x-watermark: true` means the audio was watermarked, and `x-watermark: false` means it was not. For WebSocket connections, the header is on the response that opens the connection.
141
142### How to enable audio watermarking
143
144Add the `x-watermark: true` header to your request. If your WebSocket client can't set headers, add `watermark=true` to the URL instead.
145
146```bash customLanguage="bash"
147curl -X POST https://api.x.ai/v1/tts \
148 -H "Authorization: Bearer $XAI_API_KEY" \
149 -H "Content-Type: application/json" \
150 -H "x-watermark: true" \
151 -d '{
152 "text": "Hello! Welcome to the SpaceXSI Text to Speech API.",
153 "voice_id": "eve",
154 "language": "en"
155 }' \
156 --output hello.mp3
157```
158
159```python customLanguage="pythonWithoutSDK"
160import os
161import requests
162
163response = requests.post(
164 "https://api.x.ai/v1/tts",
165 headers={
166 "Authorization": f"Bearer {os.environ['XAI_API_KEY']}",
167 "Content-Type": "application/json",
168 "x-watermark": "true",
169 },
170 json={
171 "text": "Hello! Welcome to the SpaceXSI Text to Speech API.",
172 "voice_id": "eve",
173 "language": "en",
174 },
175)
176response.raise_for_status()
177
178print(response.headers.get("x-watermark"))
179```
180
181```javascript customLanguage="javascriptWithoutSDK"
182const ws = new WebSocket(
183 'wss://api.x.ai/v1/realtime?model=grok-voice-latest&watermark=true',
184);
185```
186
187`x-watermark: false` doesn't remove a watermark that is required by the user's location or the EU endpoint. Any value other than `true` or `false` returns a `400` error.
188
189To watermark all audio for your team, email [support@x.ai](mailto:support@x.ai).
190
122## FAQ191## FAQ
123 192
124### Do I need to change my code?193### Do I need to change my code?
125 194
126195No. Watermarking has no request parameter, and the response format is unchanged apart from the `x-watermark` header.No. Text watermarking is turned on in the Console, and audio is watermarked where required without any changes. To watermark other audio, send the `x-watermark: true` header.
127 196
128### Does the setting apply to all of my API keys?197### Does the setting apply to all of my API keys?
129 198
135 204
136For questions about a locked model, contact your team admin. If you still have questions, email [support@x.ai](mailto:support@x.ai).205For questions about a locked model, contact your team admin. If you still have questions, email [support@x.ai](mailto:support@x.ai).
137 206
207### Can I turn off audio watermarking?
208
209Audio is only watermarked in the cases listed in [Which audio is watermarked](#which-audio-is-watermarked). When the request is sent to the EU endpoint, or the end user is in the EU, the EEA, or California, the watermark can't be turned off.
210
138### Does watermarking affect quality or speed?211### Does watermarking affect quality or speed?
139 212
140No. Watermarking doesn't change response quality, and its effect on speed is negligible.213No. Watermarking doesn't change response quality, and its effect on speed is negligible.