Llama Guard 4 12B on Replicate API

Llama Guard · AI at Meta

ServerlessOpen Weights

Last refreshed 2026-07-09. Next refresh: weekly.

Why use Llama Guard 4 12B on Replicate API?

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

Compare Llama Guard 4 12B across 3 providers to find the best fit for your use case
Input / 1M
$0.20
Output / 1M
$0.20
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(
    "meta/llama-guard-4-12b",
    input={"prompt": "Hello"}
Model ID
meta/llama-guard-4-12b

Request example

import replicate

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

Gotchas

  • Use provider model ID "meta/llama-guard-4-12b", not the LLMReference slug "llama-guard-4-12b".
  • 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 4 12B Across Providers

ProviderInput (per 1M)Output (per 1M)
NVIDIA NIM——
Replicate API$0.20$0.20
OpenRouter$0.18$0.18

Pricing

TypePrice (per 1M)
Input tokens$0.20
Output tokens$0.20

Capabilities

Structured Outputs

About Llama Guard 4 12B

Meta: Llama Guard 4 12B available via OpenRouter. Pricing: $0.18/1M input, $0.18/1M output.

Get Started

Model Specs

Released2025-04-05
Parameters12B
Context164k
ArchitectureDecoder Only
Knowledge cutoff2024-08

Related Models on Replicate API