Moderations

Check text for policy violations:
curl https://your-gateway/v1/moderations \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-moderation-latest",
    "input": "Text to check for policy violations"
  }'

Response

{
  "id": "modr-...",
  "model": "text-moderation-latest",
  "results": [
    {
      "flagged": false,
      "categories": {
        "hate": false,
        "sexual": false,
        "violence": false
      },
      "category_scores": {
        "hate": 0.0001,
        "sexual": 0.0002,
        "violence": 0.0001
      }
    }
  ]
}
For providers that support moderation (OpenAI), the request is passed through to the upstream. ManyLayers also has a built-in moderation capability.

Rerank

Rerank a set of documents against a query for better RAG retrieval or search ranking. Supported by Cohere (translated to /v2/rerank) and Together (passthrough to /v1/rerank).
curl https://your-gateway/v1/rerank \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cohere-rerank",
    "query": "What is machine learning?",
    "documents": [
      "Machine learning is a subset of AI...",
      "The weather today is sunny...",
      "Deep learning uses neural networks..."
    ],
    "top_n": 2
  }'

Response

{
  "results": [
    {"index": 0, "relevance_score": 0.95},
    {"index": 2, "relevance_score": 0.87}
  ]
}

Rerank in RAG

The rerank endpoint is also used by the RAG pipeline when rag.rerank_model is configured. Configure it in Admin → Settings → RAG:
rag:
  rerank_model: cohere-rerank   # cross-encoder pass after initial retrieval