
Grok API 文本水印改为默认关闭,需团队管理员手动开启
来源标题:Grok API text watermarking is now 'off' by default
Grok API 的文本水印功能现默认关闭,团队管理员需在 SpaceXSI 控制台按模型手动开启。水印会在 Grok 模型生成的文本和音频中嵌入不可见信号,以便识别 AI 生成内容,并有助于满足欧盟 AI Act 的合规要求。开启后水印自动应用于所有请求,无需改动代码,覆盖 Responses API 和 Chat Completions API 的普通文本、结构化输出及工具调用参数。
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Copy for LLMView as Markdown
Create API keyMeet grok-4.7
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.
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. Audio from the voice APIs is watermarked in some regions and when you ask for it; see Audio watermarking.
Watermarking applies to text output from text generation requests, for each model that has watermarking turned on for your team.
Responses from these models can include a watermark. It's off by default, and you can turn it on per model.
Watermarking applies to outputs from every text generation API, including the Responses API and the Chat Completions API. It covers the generated text you receive in the response: ordinary text responses, structured outputs, and tool call arguments.
After watermarking is enabled for a model, it is automatically applied to all requests, with no further code changes required.
To check whether a response was watermarked, read the x-watermark header on the Responses API or Chat Completions API response. x-watermark: true means the output for that request was generated with the watermark. Any other value, or no header at all, means it was not.
JavaScriptPython (OpenAI)JavaScript (OpenAI)Bash
import { xai } from '@ai-sdk/xai'; import { generateText } from 'ai';
const { text, response } = await generateText({ model: xai.responses('grok-4.7'), prompt: 'Write a haiku about the ocean.', });
console.log(response.headers?.['x-watermark']); console.log(text);
import os from openai import OpenAI
client = OpenAI( api_key=os.getenv("XAI_API_KEY"), base_url="https://api.x.ai/v1", )
raw = client.responses.with_raw_response.create( model="grok-4.7", input="Write a haiku about the ocean.", ) response = raw.parse()
print(raw.headers.get("x-watermark")) print(response.output_text)
import OpenAI from 'openai';
const client = new OpenAI({ apiKey: process.env.XAI_API_KEY, baseURL: 'https://api.x.ai/v1', });
const { data: response, response: raw } = await client.responses .create({ model: 'grok-4.7', input: 'Write a haiku about the ocean.', }) .withResponse();
console.log(raw.headers.get('x-watermark')); console.log(response.output_text);
curl -i https://api.x.ai/v1/responses
-H "Authorization: Bearer $XAI_API_KEY"
-H "Content-Type: application/json"
-d '{
"model": "grok-4.7",
"input": "Write a haiku about the ocean."
}'
How it works
The watermark is not visible. It is applied while the model generates text: it slightly shapes which tokens the model picks, so it adds no characters, markup, or hidden text to the response.
Our implementation uses SynthID Text, the text watermarking technique published by Google DeepMind in a Nature paper in 2024.
Detection is statistical. SpaceXSI scores a piece of text against the watermark and reports whether it is watermarked, not watermarked, or uncertain. Longer text gives a stronger signal.
Access to watermark detection is granted by application. You can submit a request for the detection API through this form.
Team admins can turn watermarking on for some or all models in the SpaceXSI Console. The setting applies to every API key on the team.
Changes apply to new requests within 5 minutes. After you turn a model on, its new requests include the watermark; after you turn it off, they stop including it.
Turning a model off asks you to confirm that an exception under applicable law applies to your use, and that you are solely responsible for any marking, disclosure, or other legal requirement.
Some models may be locked on for your team. Locked models are listed in the dialog but cannot be turned off from the Console. To ask about a locked model, see Why can't I turn watermarking off for a model?
Every opt-in and opt-out is recorded in your team's audit log. Team admins can view it on the Audit Log page 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? in the security FAQ.
Audio from the voice APIs can also include an invisible watermark. This applies to Text to Speech and Speech to Speech, including speech in custom voices.
The watermark is AudioSeal. It is added to the audio before it is encoded, so every output format includes it, and it can't be heard.
If none of these apply, the audio is not watermarked.
Read 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.
Add the x-watermark: true header to your request. If your WebSocket client can't set headers, add watermark=true to the URL instead.
curl -X POST https://api.x.ai/v1/tts
-H "Authorization: Bearer $XAI_API_KEY"
-H "Content-Type: application/json"
-H "x-watermark: true"
-d '{
"text": "Hello! Welcome to the SpaceXSI Text to Speech API.",
"voice_id": "eve",
"language": "en"
}'
--output hello.mp3
import os import requests
response = requests.post( "https://api.x.ai/v1/tts", headers={ "Authorization": f"Bearer {os.environ['XAI_API_KEY']}", "Content-Type": "application/json", "x-watermark": "true", }, json={ "text": "Hello! Welcome to the SpaceXSI Text to Speech API.", "voice_id": "eve", "language": "en", }, ) response.raise_for_status()
print(response.headers.get("x-watermark"))
const ws = new WebSocket( 'wss://api.x.ai/v1/realtime?model=grok-voice-latest&watermark=true', );
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.
To watermark all audio for your team, email support@x.ai.
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.
Yes. The setting belongs to the team, so it applies to every API key on the team. You choose it separately for each model.
The model is locked on for your team. Locked models show in the watermarking dialog without a checkbox.
For questions about a locked model, contact your team admin. If you still have questions, email support@x.ai.
Audio is only watermarked in the cases listed in 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.
No. Watermarking doesn't change response quality, and its effect on speed is negligible.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。