LLM ReferenceLLM Reference
Replicate API

Llama Guard 2 8B on Replicate API

Llama Guard · AI at Meta

ServerlessOpen Source

Last refreshed 2026-04-15. Next refresh: weekly.

Why use Llama Guard 2 8B on Replicate API?

Replicate API offers Llama Guard 2 8B with pay-as-you-go pricing at $0.05/1M input tokens. Replicate is a cloud-based platform that enables users to run machine learning models easily and efficiently.

Compare Llama Guard 2 8B across 3 providers to find the best fit for your use case
Input / 1M
$0.050
Output / 1M
$0.25
Cache
Not sourced
Batch
Not sourced

Setup recipe

Python + curl
Install
pip install replicate
Auth
export REPLICATE_API_TOKEN=...
Call
import replicate
output = replicate.run(
    "llama-guard-2-8b",
    input={"prompt": "Hello"}
Model ID
llama-guard-2-8b

Request example

import replicate

# reads REPLICATE_API_TOKEN from env
# llama-guard-2-8b format: "owner/model-name" (latest version) or "owner/model-name:version-hash"
output = replicate.run(
    "llama-guard-2-8b",
    input={"prompt": "Hello"}
)
# Output is a list or generator depending on the model
print("".join(output))

Gotchas

  • Replicate uses "owner/model-name" format (e.g. "meta/meta-llama-3-8b-instruct") for the latest version, or "owner/model-name:version-sha" to pin to a specific version. The REST endpoint splits owner and model-name into the path: /v1/models/{owner}/{model-name}/predictions.
  • The examples expect REPLICATE_API_TOKEN; rename it only if your application config maps the new variable.

Compare Llama Guard 2 8B Across Providers

ProviderInput (per 1M)Output (per 1M)
Fireworks AI$0.20$0.20
OctoAI API (Deprecated)$0.15$0.15
Replicate API$0.05$0.25

Pricing

TypePrice (per 1M)
Input tokens$0.05
Output tokens$0.25

Capabilities

No model capability flags are currently sourced.

About Llama Guard 2 8B

Llama Guard 2 is an 8B-parameter LLM built on the Llama 3 architecture, specifically designed for content moderation tasks. Released by Meta on April 18, 2024, it excels in classifying both inputs and outputs of LLMs across 11 safety categories. The model generates text outputs indicating whether content is safe or unsafe, providing detailed feedback on violations. It aims to enhance user experience by minimizing false positives while maintaining high accuracy in content moderation, supporting developers in creating safer AI applications .

FAQ

What does Llama Guard 2 8B cost on Replicate API?

On Replicate API, Llama Guard 2 8B costs $0.05 per 1M input tokens and $0.25 per 1M output tokens.

What is the context window for Llama Guard 2 8B on Replicate API?

Llama Guard 2 8B supports a 8,000 token context window on Replicate API.

How does Replicate API compare to other Llama Guard 2 8B providers?

Llama Guard 2 8B is available from 3 providers. The cheapest input pricing is $0.05/1M tokens from Replicate API.

Who created Llama Guard 2 8B?

Llama Guard 2 8B was created by AI at Meta as part of the Llama Guard model family.

Is Llama Guard 2 8B open source?

Llama Guard 2 8B is open source according to the seed data.

Get Started

Model Specs

Released2024-04-18
Parameters8B
Context8K
ArchitectureDecoder Only

Related Models on Replicate API