models/Meta/Llama-Guard-3-8b
Meta

Llama-Guard-3-8b

moderation
Compare

Llama Guard 3 is a Llama-3.1-8B pretrained model, fine-tuned for content safety classification. Similar to previous versions, it can be used to classify content in both LLM inputs (prompt classification) and in LLM responses (response classification). It acts as an LLM – it generates text in its output that indicates whether a given prompt or response is safe or unsafe, and if unsafe, it also lists the content categories violated.

MODALITIES
text
INPUT
$0.040 /1M
OUTPUT
$0.080 /1M
RELEASED
2025-01-22

Llama-Guard-3-8b (meta/llama-guard-3-8b) is a moderation model from Meta, released 2025-01-22. Context window: tokens; max output . Pricing via AIgateway: input $0.040/M tokens, output $0.080/M tokens. Call it via https://api.aigateway.sh/v1/moderations — set model="meta/llama-guard-3-8b". Best for: Input/output moderation, Abuse detection.

model · meta/llama-guard-3-8b

Use this model

model: meta/llama-guard-3-8b
curl https://api.aigateway.sh/v1/moderations \
  -H "Authorization: Bearer $AIGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"meta/llama-guard-3-8b"}'

Capabilities

Strengths

  • Policy-aware
  • Fast
  • Open-weight

Use cases

Input/output moderationAbuse detection

Pricing

Input$0.040 / 1M tokens
Output$0.080 / 1M tokens
You pay pass-through · 5% applied at credit top-up, not per-call.
See API example →CompareAPI referenceSee usage ranking →

Collections

More text models →More from MetaFrontier models →Free-tier models →
API schema

Call Llama-Guard-3-8b from any OpenAI SDK

POST https://api.aigateway.sh/v1/chat/completions·Content-Type: application/json·Auth: Bearer sk-aig-...

Request body

json
{
  "model": "meta/llama-guard-3-8b",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user",   "content": "Hello!" }
  ],
  "temperature": 0.7,
  "top_p": 0.95,
  "max_tokens": 1024,
  "stream": false

}

Response

json
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1776947082,
  "model": "meta/llama-guard-3-8b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 12,
    "total_tokens": 36
  }
}

Quickstart

# pip install aigateway-py openai
# aigateway-py adds sub-accounts, evals, replays, jobs, webhook verify.
# openai SDK covers chat — drop-in per our SDK's own guidance.
from openai import OpenAI

client = OpenAI(
    base_url="https://api.aigateway.sh/v1",
    api_key="sk-aig-...",
)

r = client.chat.completions.create(
    model="meta/llama-guard-3-8b",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(r.choices[0].message.content)

Errors

401authentication_errorInvalid or missing API key
402insufficient_creditsWallet empty (PAYG only)
404not_foundUnknown model or endpoint
429rate_limit_errorOver per-minute limit — see Retry-After header
500server_errorUpstream provider failed (retryable)
503service_unavailableUpstream saturated (retryable)
Full docs →API reference →OpenAPI spec →llms.txt →

Frequently asked questions

What is Llama-Guard-3-8b?
Llama Guard 3 is a Llama-3.1-8B pretrained model, fine-tuned for content safety classification. Similar to previous versions, it can be used to classify content in both LLM inputs (prompt classification) and in LLM responses (response classification). It acts as an LLM – it generates text in its output that indicates whether a given prompt or response is safe or unsafe, and if unsafe, it also lists the content categories violated. It is a moderation model from Meta, accessible via AIgateway's OpenAI-compatible API at slug meta/llama-guard-3-8b.
How much does Llama-Guard-3-8b cost via AIgateway?
Input costs $0.040 per 1M tokens; output costs $0.080 per 1M tokens. Pass-through plus a 5% platform fee applied at top-up, not per call.
How do I call Llama-Guard-3-8b from my code?
Point the OpenAI SDK at https://api.aigateway.sh/v1 with your AIgateway key and set model to "meta/llama-guard-3-8b". The request and response shapes match OpenAI exactly.
Does Llama-Guard-3-8b support streaming, tool calling, vision, and JSON mode?
Streaming — no. Tool calling — no. Vision — no. JSON mode — no. Prompt caching — no.
What are the best use cases for Llama-Guard-3-8b?
Input/output moderation, Abuse detection. Key strengths: Policy-aware; Fast; Open-weight.
Can I bring my own Meta API key (BYOK)?
Yes. Attach a Meta key in your AIgateway dashboard and this model flips to pass-through — you pay Meta directly and AIgateway waives the 5% platform fee on those calls.