Llama Guard 2 (8B) API

Powerful 8B model for classifying safety of LLM inputs and outputs, available through our API along with 100+ AI Models. Supports custom taxonomies.

Modalities
TextText
In / Out price
$0.26/$0.26per 1M
Model type
Chat

Llama Guard 2 (8B) overview

Llama Guard 2 (8B) specs

Developer
Meta
Input
Text
Output
Text
API
OpenAI-compatible, base URL https://api.aimlapi.com/v1

Llama Guard 2 (8B) Description

  • Model Type: Text Classification

Overview

LlamaGuard-2-8B is an 8 billion parameter model developed by Meta AI to classify content safety in large language models (LLMs). It is based on the Meta Llama 3 architecture and is trained to predict safety labels across 11 categories from the MLCommons taxonomy of hazards.

Key Features

  • Outperforms other popular content moderation APIs like Azure, OpenAI Moderation, and Perspective
  • Achieves high F1 score of 0.915 and low false positive rate of 0.040
  • Supports prompt and response safety classification for LLMs
  • Easily fine-tunable to create custom safety taxonomies for specific applications

Intended Use

LlamaGuard-2-8B is designed to be integrated into LLM-powered applications to ensure the safety and responsibility of generated content. It can be used to filter out potentially harmful or inappropriate text before it is displayed to users.

Language Support

The model is currently trained on English text, but it could potentially be fine-tuned to support other languages as well.

Architecture

LlamaGuard-2-8B is based on the Meta Llama 3 model, a large language model using the Transformer architecture.

Use cases

Filter user inputs before passing them to downstream models to prevent unsafe queries like hate speech or self-harm requests.

Scan model-generated outputs, and if unsafe, halt display and notify user of risk category.

Use as a classifier to tag large datasets for content policy compliance or training feedback loops.

Deploy to review generative responses against established policies (e.g. MLCommons taxonomy) for compliance checks.

Capabilities

  • Function calling
  • Streaming
  • Structured outputs

Llama Guard 2 (8B) API pricing

Llama Guard 2 (8B) pricing in US dollars
UsagePriceUnit
Input$0.261M tokens
Output$0.261M tokens

Prices from the AI/ML API price list, checked on Nov 4, 2026.

Llama Guard 2 (8B) vs other models: token prices

AI/ML API input and output rates for 5 models, per million tokens.

AI/ML API model prices in USD per million tokens
ModelInputOutput
Llama Guard 2 (8B)$0.26$0.26
Muse Glimmer 30B$0.3703$1.59
Muse Spark Open$1.32$4.5
Muse Spark 1.3$1.32$4.5
Muse Wonder$4.23$21.16

Llama Guard 2 (8B) FAQ

How much does Llama Guard 2 (8B) cost?

Llama Guard 2 (8B) costs $0.26 input and $0.26 output per 1M tokens on AI/ML API, billed as you go with no subscription.

Does Llama Guard 2 (8B) support streaming?

Yes, Llama Guard 2 (8B) can stream responses as they are generated.

Does Llama Guard 2 (8B) support tool calling and structured outputs?

Yes, Llama Guard 2 (8B) supports both function calling and structured outputs.

Who created Llama Guard 2 (8B)?

Llama Guard 2 (8B) was built by Meta.

What endpoint is used to access Llama Guard 2 (8B)?

Llama Guard 2 (8B) is available via the v1 endpoint.

Start building with Llama Guard 2 (8B)