Skip to content
  • Auto
  • Light
  • Dark
Log in to API

Create

Create
post/moderations

Classifies if given messages are potentially harmful across several categories.

Body Parameters
messagesarray of Message

List of messages in the conversation.

modelstring
optional

Optional identifier of the model to use. Defaults to "Llama-Guard".

Returns
modelstring
resultsarray of object
Hide ParametersShow Parameters
flaggedboolean
flagged_categoriesarray of string
curl https://api.llama.com/v1/moderations \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LLAMA_API_KEY" \
    -d '{
      "messages": [
        {
          "content": "string",
          "role": "user"
        }
      ]
    }'
200 Example
{
  "model": "model",
  "results": [
    {
      "flagged": true,
      "flagged_categories": [
        "string"
      ]
    }
  ]
}