[Integrations](https://spiral.ai/integrations) › [VS Code](https://spiral.ai/integrations/vscode) › [Llama Guard 4 12B](https://spiral.ai/integrations/vscode/llama-guard-4-12b)

# How to Use Llama Guard 4 12B in VS Code

Llama Guard 4 12B classifies prompts and assistant replies against a safety policy. Its safe or unsafe verdicts and violation codes suit moderation checks before and after text generation.

|  |  |
| --- | --- |
| Model | Llama Guard 4 12B |
| Available through | OpenRouter |
| Category | LLM |
| Price | Up to $0.000968 per run at the default inputs. $0.234 per 1M input tokens, $0.234 per 1M output tokens. |
| Returns | text, json |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with Llama Guard 4 12B in VS Code

- Use Llama Guard 4 12B to classify the user prompts in our moderation fixtures one at a time with Meta's default safety categories. Compare each verdict with its expected label and report disagreements.
- Use Llama Guard 4 12B to check the draft assistant replies in our conversation fixtures. Include the matching user request, target only the final assistant reply, and report the verdict and violation codes.
- Use Llama Guard 4 12B to evaluate our proposed code interpreter actions under the default safety policy, including code interpreter abuse. Produce a review report without executing the actions.
- Use Llama Guard 4 12B to classify our English and Spanish moderation fixtures separately. Compare its verdicts with the human labels and report disagreements by language.
- Use Llama Guard 4 12B to rerun our labeled response examples after the system prompt changes. Show which verdicts changed, retaining the original user request as context for each reply.

## How to set up Llama Guard 4 12B in VS Code

Pick the way that suits you. Each takes about two minutes.

### Use Spiral's MCP server

1. **Add the hosted server**: Use Add to VS Code on the console's Agents & MCP page, or run:

```bash
code --add-mcp '{"name":"spiral","type":"http","url":"https://api.spiral.ai/mcp"}'
```

2. **Sign in**: VS Code asks you to sign in when it first starts the server: sign in to Spiral and click Authorize. No API key. Run MCP: List Servers from the Command Palette to check that Spiral is running.

### Use the Spiral skill

1. **Send VS Code this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run Llama Guard 4 12B**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "openrouter",
    "model": "meta-llama/llama-guard-4-12b",
    "input": {
      "messages": [
        {
          "role": "system"
        }
      ]
    }
  }'
```

Then paste one of the prompts above: VS Code finds Llama Guard 4 12B on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/vscode

## Llama Guard 4 12B tools and prices

- [Meta: Llama Guard 4 12B](https://spiral.ai/tools/openrouter/meta-llama/llama-guard-4-12b) (OpenRouter): Up to $0.000968 per run at the default inputs. $0.234 per 1M input tokens, $0.234 per 1M output tokens.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| seed |  | — |  |
| stop |  | — |  |
| min_p | 0 to 1 | — |  |
| top_k | 0 to … | — |  |
| top_p | 0 to 1 | — |  |
| max_tokens | 1 to 16384 | — | The most output tokens to generate. |

## What can you do with Llama Guard 4 12B in VS Code?

Check your project's chatbot prompts and replies against a defined safety policy. A coding agent can run labeled examples, preserve violation codes, and surface changed verdicts after edits.

### Screen incoming chatbot requests

Classify each user request against the selected safety policy before passing it to a text generator. Keep the verdict and any violation codes with the request for review.

### Check generated support replies

Evaluate a draft reply together with the customer's request. Route unsafe verdicts to a reviewer before sending the reply.

### Triage community posts

Apply a defined safety policy to submitted text and use the resulting labels to organize a moderation queue. Keep publication decisions separate from the classification.

### Review multilingual conversations

Screen conversations in languages covered by Meta's published evaluations. Compare results with human labels for each language before relying on the workflow.

### Flag privacy concerns in draft answers

Use the privacy category to triage assistant replies that may disclose sensitive personal information. Send flagged replies for review before sharing them.

### Review proposed code interpreter actions

Classify proposed text actions under the code interpreter abuse category before execution. Use the result alongside the application's existing execution controls.

### Compare safety results after prompt changes

Run a fixed set of labeled prompts and replies through the classifier after changing an assistant's instructions. Review changed verdicts and disagreements with the expected labels.

## Overview

- [OpenRouter](https://spiral.ai/providers/openrouter)
- [All VS Code guides](https://spiral.ai/integrations/vscode)

## Llama Guard 4 12B in other agents

- [Amp](https://spiral.ai/integrations/amp/llama-guard-4-12b)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/llama-guard-4-12b)
- [Claude](https://spiral.ai/integrations/claude-desktop/llama-guard-4-12b)
- [Claude Code](https://spiral.ai/integrations/claude-code/llama-guard-4-12b)
- [Cline](https://spiral.ai/integrations/cline/llama-guard-4-12b)
- [Codex](https://spiral.ai/integrations/codex/llama-guard-4-12b)
- [Cursor](https://spiral.ai/integrations/cursor/llama-guard-4-12b)
- [Devin](https://spiral.ai/integrations/devin/llama-guard-4-12b)
- [dots](https://spiral.ai/integrations/dots/llama-guard-4-12b)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/llama-guard-4-12b)
- [Gemini](https://spiral.ai/integrations/gemini/llama-guard-4-12b)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/llama-guard-4-12b)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/llama-guard-4-12b)
- [goose](https://spiral.ai/integrations/goose/llama-guard-4-12b)
- [Grok](https://spiral.ai/integrations/grok/llama-guard-4-12b)
- [Grok Build](https://spiral.ai/integrations/grok-build/llama-guard-4-12b)
- [Hermes](https://spiral.ai/integrations/hermes/llama-guard-4-12b)
- [Instinct](https://spiral.ai/integrations/instinct/llama-guard-4-12b)
- [Manus](https://spiral.ai/integrations/manus/llama-guard-4-12b)
- [Muse](https://spiral.ai/integrations/muse/llama-guard-4-12b)
- [Muse Code](https://spiral.ai/integrations/muse-code/llama-guard-4-12b)
- [n8n](https://spiral.ai/integrations/n8n/llama-guard-4-12b)
- [Notion](https://spiral.ai/integrations/notion/llama-guard-4-12b)
- [OpenClaw](https://spiral.ai/integrations/openclaw/llama-guard-4-12b)
- [opencode](https://spiral.ai/integrations/opencode/llama-guard-4-12b)
- [Perplexity](https://spiral.ai/integrations/perplexity/llama-guard-4-12b)
- [Raycast](https://spiral.ai/integrations/raycast/llama-guard-4-12b)
- [Windsurf](https://spiral.ai/integrations/windsurf/llama-guard-4-12b)
- [Zapier](https://spiral.ai/integrations/zapier/llama-guard-4-12b)

## More VS Code guides

- [Llama 4 Scout](https://spiral.ai/integrations/vscode/llama-4-scout)
- [LongCat 2.0](https://spiral.ai/integrations/vscode/longcat-2-0)
- [Llama 4 Maverick](https://spiral.ai/integrations/vscode/llama-4-maverick)
- [Magnum v4 72B](https://spiral.ai/integrations/vscode/magnum-v4-72b)
- [Llama 3.3 70B Instruct](https://spiral.ai/integrations/vscode/llama-3-3-70b-instruct)
- [Mi:dm K 3.0 Pro](https://spiral.ai/integrations/vscode/mi-dm-k-3-0-pro)

## Questions about Llama Guard 4 12B in VS Code

**Can VS Code use Llama Guard 4 12B?**

Yes. Add Spiral to VS Code as an MCP server, and VS Code can find and run Llama Guard 4 12B like any built-in tool.

**How much does Llama Guard 4 12B cost in VS Code?**

Up to $0.000968 per run at the default inputs. $0.234 per 1M input tokens, $0.234 per 1M output tokens. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your VS Code plan is separate.

**Do I need an OpenRouter account to use Llama Guard 4 12B in VS Code?**

No. Spiral runs Llama Guard 4 12B on its own OpenRouter account. You sign in to Spiral once and never paste a key.

**How long does it take to set up Llama Guard 4 12B in VS Code?**

About two minutes: add the hosted server, then sign in.

**Does VS Code wait while Llama Guard 4 12B runs?**

Llama Guard 4 12B runs in the background. VS Code starts the run, checks on it and gives you the text, json when it's ready.

**What is Llama Guard 4 useful for?**

Use it to classify a user's prompt before generation or an assistant's reply afterward. It applies a safety policy and produces labels you can use in a moderation workflow.

**What does Llama Guard 4 return?**

Meta's expected format starts with safe or unsafe. An unsafe verdict adds a second line containing comma-separated violation codes.

**Which safety categories does Llama Guard 4 check?**

Its S1 through S14 labels cover crimes, exploitation, defamation, specialized advice, privacy, intellectual property, weapons, hate, self-harm, sexual content, elections, and code interpreter abuse. Code interpreter abuse applies to text.

**How should I format a moderation request?**

Provide the safety categories, separate the conversation from the instructions, and identify whether the target is the user or assistant. When checking a reply, include the user's request so the classifier has context.

**Which languages have published evaluations?**

Meta publishes English results and multilingual results covering French, German, Hindi, Italian, Portuguese, Spanish, and Thai. Test representative examples in each language you plan to moderate.

