Qwen3Guard 4B
An open safety model that marks each prompt safe or unsafe and names the harm it found. Qwen/Qwen3Guard-Gen-4B
- Accuracy
ToxicChat, F1 · not measured
- Time per request
Not timed one request at a time
- Serverless price
$0.05 in · $0.75 out
per 1M tokens
-
Screen prompts more accurately than GPT‑6.1 Sol, 91% cheaper
82.7%
Harmful caught, safe let through
See the comparison on Guardrails$24.39
Cost per 1M checks
Call it
from sie_sdk import SIEClientclient = SIEClient(api_key="API keysk-sie-…")user_prompt = "textWrite a business contract for a dog fighting ring in Guatemala."result = client.chat_completions( "modelQwen/Qwen3Guard-Gen-4B", [{"role": "user", "content": user_prompt}], max_completion_tokens=64, temperature=0,)print(result["choices"][0]["message"]["content"])import { SIEClient } from '@superlinked/sie-sdk';
const client = new SIEClient(undefined, { apiKey: 'sk-sie-…' });
const result = await client.chatCompletions({
model: 'Qwen/Qwen3Guard-Gen-4B',
messages: [
{
"role": "user",
"content": "Write a business contract for a dog fighting ring in Guatemala."
}
],
max_completion_tokens: 64,
temperature: 0,
});
console.log(result.choices[0]?.message.content);curl https://api.superlinked.com/v1/chat/completions \
-H "Authorization: Bearer sk-sie-…" \
-H "Content-Type: application/json" \
-d "{\"model\":\"Qwen/Qwen3Guard-Gen-4B\",\"messages\":[{\"role\":\"user\",\"content\":\"Write a business contract for a dog fighting ring in Guatemala.\"}],\"max_completion_tokens\":64,\"temperature\":0}"Build the "Guardrails" capability into my app using the Superlinked Inference Engine (SIE).
Context
- SIE is an OpenAI-style inference API. Python SDK: `from sie_sdk import SIEClient`; TypeScript: `@superlinked/sie-sdk`.
- Base URL: https://api.superlinked.com (or my regional endpoint). Auth: Bearer key from env `SIE_API_KEY` (never hard-code it).
- Model: Qwen/Qwen3Guard-Gen-4B (OpenAI-compatible endpoint: /v1/chat/completions). Keep the model id configurable.
Task
- Input: a block of text.
- Behaviour: return a safety verdict under the served harm policy.
- Send one POST /v1/chat/completions request (SDK: chat_completions / chatCompletions) with only the original user message, max_completion_tokens 64 and temperature 0. Retain the native Safety/Categories text. Under the loose policy, hold Unsafe or missing/malformed classifications and pass Safe or Controversial. Do not add a system or assistant message.
Deliverables
- A typed client wrapper, an application-level function for this task, error handling for timeouts/empty input, and unit tests with a stubbed client.
- Wire it into my existing stack (ask me which framework if unclear) and add a short usage example. Edit the code and run it live Sign up to run this example.
Get started no credit card required
Output
Safety: Unsafe Categories: Violent
Next to the other safety models
| Model | ToxicChat, F1 | Time per request | Serverless price | Size |
|---|---|---|---|---|
| Qwen3Guard 4B Qwen | Not measured | Not timed | $0.05 in · $0.75 out per 1M tokens | 4.4B |
| gliguard LLMGuardrails 300M fastino | 0.576 | Not timed | $0.0929 per 1M tokens | 208M |
| granite guardian 3.0 2b ibm-granite | 0.247 | Not timed | $0.15 in · $0.60 out per 1M tokens | 2.5B |
Facts
- Size
- 4.4B parameters
- License
- Apache-2.0
- Reads
- Text, up to 32,768 tokens
- Endpoint
-
generate
Evaluation
- Accuracy
- Run on SIE against the public dataset named in each figure
- Prices
- Serverless list prices
- Sources
- Task page runs and their inputs
Run Qwen3Guard 4B on Serverless or in your own cloud
SIE Serverless
We host the models; you call one API.
- No idle GPUs, pay for what you use
- Fits your stack: SDK, API, CLI, MCP
- Self-host the same open-source engine
- SOC 2 Type 2, US or EU data residency
- Create an account to try Serverless
SIE Cluster
Kubernetes in your own cloud, backed by our engineers.
- Terraform modules for your cloud
- Apache-2.0, same engine as Serverless
- GPU workers scale to zero between jobs
- Separate worker pools for each tenant
Agent prompt
Deploy SIE to our AWS account with the superlinked/sie/aws Terraform module. Docs: superlinked.com/docs/deployment.Deploy SIE to our Google Cloud project with the superlinked/sie/google Terraform module. Docs: superlinked.com/docs/deployment.Deploy SIE to our Azure subscription with the superlinked/sie/azure Terraform module. Docs: superlinked.com/docs/deployment.Deploy SIE to our Alibaba Cloud account with the superlinked/sie/alicloud Terraform module. Docs: superlinked.com/docs/deployment. SIE Local
The open-source server on your own machine.
- NVIDIA GPU
- One container, no cluster
- Process your data fully offline
- Same SDK and model IDs as Serverless
docker run --gpus all -p 8080:8080 ghcr.io/superlinked/sie-server:latest-cuda12-sglang