Hugging Face Transformers watermark plugin
Marks the text your Transformers code generates, for EU AI Act Article 50. Prompts and outputs stay on your machines.
$ export WIDAR_PLUGIN_KEY="$(cat /run/secrets/widar_plugin_key)"$ python generate.pyfrom transformers import AutoModelForCausalLM, AutoTokenizer
from widar_transformers import Widar
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B")
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B", device_map="auto")
widar = Widar(tokenizer) # reads WIDAR_PLUGIN_KEY
messages = [{"role": "user", "content": "How should I store a sourdough starter over a long weekend?"}]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
output = widar.generate(model, inputs=inputs, do_sample=True, max_new_tokens=300)
print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))Check text from Tessera Assistant
widar.com/verify/tessera-assistant
Pasted text, 412 characters
Feed it as usual, let it rise for about an hour, then put it in the fridge in a jar with a loose lid. Cold slows the yeast down, so a fed starter keeps for four or five days without another feeding. When you are back, take it out, discard all but a few spoonfuls and feed it twice at room temperature before you bake. A layer of grey liquid on top is normal: pour it off or stir it in.
widar watermark
FoundTessera Assistant 2 by Tessera Chat sp. z o.o.
C2PA credential
Not checkedPlain text carries no credential
Install, configure, verify
Three steps, in test mode first. Move to a live plugin key when your plan starts.
- 1
Install
The plugin comes with your widar workspace: widar's sales team provides it. Add it to your Python environment.
widar for TransformersVersion 0.1.0Talk to sales
- 2
Configure
Create a plugin key for your system and set it as WIDAR_PLUGIN_KEY where your code runs, then generate through the plugin with the model you already use. A plugin key only fetches and reports for one system, and can never call the rest of the API.
$ widar plugin-keys create --system-id sys_t3ss8ra2wq5m --name "transformers-fleet"$ export WIDAR_PLUGIN_KEY="$(cat /run/secrets/widar_plugin_key)"from transformers import AutoModelForCausalLM, AutoTokenizer from widar_transformers import Widar tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B") model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B", device_map="auto") widar = Widar(tokenizer) # reads WIDAR_PLUGIN_KEY messages = [{"role": "user", "content": "How should I store a sourdough starter over a long weekend?"}] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, return_tensors="pt" ).to(model.device) output = widar.generate(model, inputs=inputs, do_sample=True, max_new_tokens=300) print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))Create a plugin key for the system and generate through the plugin - 3
Verify
Generate an answer through the plugin and check it. The finding names your system and your company.
$ python generate.py > answer.txt$ widar verifications create answer.txtAsk for an answer and check it
What a check of an answer shows
An example for Tessera Chat sp. z o.o., an invented company: an answer generated through the plugin, and what a check of it finds.
Prompt
How should I store a sourdough starter over a long weekend?
Answer
Feed it as usual, let it rise for about an hour, then put it in the fridge in a jar with a loose lid. Cold slows the yeast down, so a fed starter keeps for four or five days without another feeding. When you are back, take it out, discard all but a few spoonfuls and feed it twice at room temperature before you bake. A layer of grey liquid on top is normal: pour it off or stir it in.
Check text from Tessera Assistant
widar.com/verify/tessera-assistant
Pasted text
412 characters, sha256 7f2c11ab…09d8e3c5
Findings
widar watermark
FoundTessera Assistant 2 by Tessera Chat sp. z o.o.
C2PA credential
Not checkedPlain text carries no credential
The same check by machine
Save the answer and check it from the CLI, the API or an agent's MCP client. The findings come back as JSON: what was found, who made it and when.
- The text is checked and not kept.
- The system's verify page and its API are free to every caller.
- A text with nothing readable gets No mark found. This does not mean a person made it.
$ widar verifications create answer.txt$ jq -Rs '{text: .}' answer.txt | curl -X POST https://api.widar.com/v1/verifications \ -H "Authorization: Bearer $WIDAR_API_KEY" \ -H "Content-Type: application/json" \ --data-binary @-create_verification {"text": "Feed it as usual, let it rise for about an hour, then…"}Example answer, for an invented company
{
"object": "verification",
"mode": "live",
"content_type": "text",
"findings": [
{
"kind": "widar_watermark",
"outcome": "found",
"who": {
"system": "Tessera Assistant 2",
"customer": "Tessera Chat sp. z o.o."
}
},
{ "kind": "c2pa_credential", "outcome": "not_checked" }
]
}Requirements and model families
What the plugin needs to run, as its version 0.1.0 declares it.
| Component | Version |
|---|---|
| Transformers | 4.50 or later |
| Python | 3.9 or later |
| PyTorch | Installed with the plugin |
Model families
Any causal language model Transformers loads for text generation.
Works with
- Streaming and whole responses
- Many requests in one batch
- Structured output: a JSON schema keeps its structure
What leaves your servers
The plugin talks to widar's API only, and only about counts and health.
| What | To widar |
|---|---|
| Prompts | Never |
| Responses | Never |
| Tokens marked, requests left unmarked and why | Counts, each minute |
| Plugin and engine versions, health | Each minute |
| Your system's keys and policy | From widar, at start and within 15 minutes of a change |
Questions about the Hugging Face Transformers plugin
Call widar.generate(model, ...) with the arguments you pass to generate() today. It returns what generate() returns, with the output marked.
No. It fetches the system's keys and policy when it starts and reports usage counts each minute. A rotated key is in use within 15 minutes.
A plugin key (wd_plg_) made for one system. It fetches and reports for that system only. A full API key does not start the plugin.
Source code in fenced code blocks, output you declare as machine-only, and output held to a grammar. A JSON schema keeps its structure. Each output left unmarked is counted with the rule that left it.
By default it refuses to serve unmarked answers, and widar sends marking.failed. A policy can let it serve them unmarked instead, counted one by one.
Get a test plugin key
Create a free account and mark your first response in test mode, or talk to sales about Enterprise and the self‑hosted edition.