TokenPad

LLM API error

Content filtered or request refused

The model declined or a safety filter blocked the response. Why legitimate requests trigger it, how to tell a refusal from a filter, and what to change.

The message you are seeing

OpenAI
"finish_reason": "content_filter"
Model output
I can't help with that request.

What it means

Either an external safety system blocked the content, or the model itself declined. These are different mechanisms with different fixes, and the response tells you which.

A filter shows up as a stop reason or an error; a refusal arrives as ordinary text where the answer should be. Applications that only check for errors treat a refusal as a valid answer.

Why it happens

Most likely cause first.

  1. 1

    Legitimate content that resembles prohibited content

    The most common case in production. Security research, medical or legal information, moderation work and fiction all sit near boundaries drawn for a general audience.

  2. 2

    Retrieved content triggering it, not the user

    In a retrieval system the blocked material may be in a document you supplied. The user asked something innocuous and the context carried the trigger.

  3. 3

    Ambiguous framing

    A request that reads as harmful without context often succeeds when the legitimate purpose is stated plainly, because the model has something to weigh against the surface pattern.

  4. 4

    An actual attack

    Sometimes the filter is right. If refusals cluster on particular users or particular retrieved documents, that is a signal worth reading rather than routing around.

How to fix it

  1. Determine whether it was a filter or a refusal

    Check the stop reason. A filter is a system decision reported by the API; a refusal is text the model generated. Your code should detect both, and today probably detects neither.

  2. State the legitimate context explicitly

    Professional purpose, audience and use case in the system prompt. This resolves a large share of false refusals without weakening anything real.

    Structured Prompt BuilderDeterministic, not AI-generated. Six sections, live token cost, copy as plain text or XML tags.
  3. Check what your retrieval put in the prompt

    If the trigger is in a retrieved document rather than the question, no amount of rewording the question will help.

    RAG Context PackerScore-ordered packing into a fixed budget, with drop reasons reported.
  4. Handle refusals as a distinct outcome

    Not as a successful answer and not as an error. Users need to know the request was declined, and you need to know how often it happens.

Stopping it happening again

  • Track refusal rate as a metric. A rising rate usually means a prompt change or a retrieval change, and it is invisible if you only monitor errors.
  • Include purpose and audience in the system prompt for any domain that sits near a policy boundary.
  • Scan untrusted input before it reaches the model — some refusals are the system working correctly against an injection.

Tools that help

Frequently asked questions

Can I turn the content filter off?
Generally no on hosted APIs, though some providers offer configurable thresholds on certain categories for approved use cases. The practical lever is clearer context in the prompt.
Why does the same request sometimes succeed and sometimes fail?
Sampling. At non-zero temperature the model does not follow an identical path each time, so a borderline request lands on either side of the line. Consistent refusal means a boundary; intermittent refusal means you are near one.