{"slug": "moderation-is-not-one-field", "title": "Moderation is not one field", "summary": "BabySea introduced a unified moderation interface that collapses the fragmented, model-specific safety fields of generative media APIs into a single boolean, generation_moderation. The company's engineering writeup details how it maps that intent to conflicting model fields such as disable_safety_checker, enable_safety_checker, safety_tolerance, safety_filter_level and moderation, inverting polarity and translating types behind the scenes rather than passing raw fields through. The approach targets subtle bugs that arise when multi-model systems expose inconsistent moderation controls directly.", "body_md": "When people discuss moderation in generative media, they often describe it as if there is a single standard control: turn safety on, turn safety off, maybe adjust one tolerance value.\n\nThat is not how real model interfaces work.\n\nIn practice, moderation is exposed through a scattered set of fields that vary from model to model. One model may expose `disable_safety_checker`. Another may expose `enable_safety_checker`. Another may use `safety_tolerance` as a number. Another may use the same field as a string enum. Some models add `safety_filter_level`. Others expose a separate `moderation` mode. Some combine several of these. Some expose only one.\n\nThe result is that moderation is not a clean capability. It is a fragmented interface.\n\nBecause the inconsistency is not in documentation, it is in the interface itself.\n\nA model can expose moderation through fields like these:\n\n```\ndisable_safety_checker: boolean\nenable_safety_checker: boolean\nsafety_tolerance: number\nsafety_tolerance: string\nsafety_filter_level: string\nmoderation: string\n```\n\nThe inconsistency is not superficial. It exists at multiple levels at once.\n\nFirst, the field names conflict. `disable_safety_checker` and `enable_safety_checker` represent opposite polarity. A strict moderation intent may require `false` in one model and `true` in another.\n\nSecond, the types conflict. `safety_tolerance` may be numeric in one model and a string enum in another.\n\nThird, the semantics conflict. A boolean switch is not equivalent to a tolerance range, and neither is equivalent to a policy level such as `block_low_and_above` or a moderation mode such as `auto`.\n\nFourth, availability is inconsistent. Some models expose one moderation field, some expose several, some expose combinations that have to be aligned manually.\n\nThis means there is no stable moderation surface at the model layer.\n\nA pass-through design looks simple: expose every raw field and let developers choose what they want.\n\nThat design fails immediately in a multi-model system. It pushes all inconsistency upward. The application now has to know which model expects inverted booleans, which one expects a string tolerance, which one wants a numeric range, and which one needs multiple moderation fields coordinated together.\n\nAt that point, the API is no longer abstracting anything.\n\nIt is just forwarding fragmentation.\n\nA useful abstraction has to preserve intent. The same request should mean the same thing regardless of which model is ultimately selected.\n\nBabySea defines a single control for moderation intent:\n\n```\ngeneration_moderation: boolean\n```\n\nThe meaning is intentionally simple.\n\n```\ntrue  // moderation ON  ➜ strict/safe\nfalse // moderation OFF ➜ permissive\n```\n\nThis is the only moderation input that matters at the BabySea layer. Everything else becomes derived behavior.\n\nThat choice is important. The goal is not to expose every moderation knob a model happens to have. The goal is to define one stable contract for the user, then translate it into model-specific configuration behind the scenes.\n\nThe most obvious inconsistency is polarity.\n\nSome models represent moderation through a disabling field. In that case, strict moderation must invert the value:\n\n```\nexport function moderationToDisableBoolean(input: SharedInputSchema): boolean | undefined {\n  const val = input.generation_moderation as boolean | undefined;\n  if (val === undefined) return undefined;\n  return !val;\n}\n```\n\nOther models represent moderation through an enabling field. In that case, the mapping is direct:\n\n```\nexport function moderationToEnableBoolean(input: SharedInputSchema): boolean | undefined {\n  return input.generation_moderation as boolean | undefined;\n}\n```\n\nThis looks trivial, but it is exactly the kind of inconsistency that creates subtle bugs when raw fields are exposed directly. A user should not need to know whether a model thinks in terms of enabling safety or disabling it.\n\nThe harder problem is that moderation often cannot be expressed through one value alone. A single strict or permissive intent may need to drive several fields at once.\n\nIn BabySea, the same `generation_moderation` input can map into:\n\n```\n{\n  disable_safety_checker: moderationToDisableBoolean(input),\n  safety_tolerance: moderationToSafetyTolerance(input, rawField),\n  safety_filter_level: moderationToSafetyFilterLevel(input),\n  moderation: moderationToModerationString(input),\n}\n```\n\nOr, for another model surface:\n\n```\n{\n  enable_safety_checker: moderationToEnableBoolean(input),\n  safety_tolerance: moderationToSafetyToleranceString(input, rawField),\n}\n```\n\nThis is the key point: moderation is not normalized by renaming one field. It is normalized by coordinating several unrelated fields so they all represent the same user intent.\n\nIf moderation is strict, all derived values must point in the strict direction. If moderation is permissive, all derived values must point in the permissive direction. That coordination is the actual complexity of moderation.\n\nTolerance is where many implementations become fragile. It is tempting to hardcode something like \"strict means 1, permissive means 6.\"\n\nThat only works until a model uses a different range, or exposes tolerance as an enum instead of a number.\n\nBabySea avoids that by deriving bounds from the schema itself:\n\n```\nfunction extractSafetyBounds(schema: z.ZodTypeAny): { min: number; max: number } {\n  let inner: z.ZodTypeAny = schema;\n\n  while (inner instanceof z.ZodOptional || inner instanceof z.ZodDefault) {\n    inner =\n      inner instanceof z.ZodOptional\n        ? inner.unwrap()\n        : (inner as z.ZodDefault<z.ZodTypeAny>)._def.innerType;\n  }\n\n  if (inner instanceof z.ZodNumber) {\n    let min = 1;\n    let max = 6;\n    for (const check of (inner._def as { checks: Array<{ kind: string; value: number }> }).checks) {\n      if (check.kind === 'min') min = check.value;\n      if (check.kind === 'max') max = check.value;\n    }\n    return { min, max };\n  }\n\n  if (inner instanceof z.ZodEnum) {\n    const nums = (inner._def.values as string[]).map(Number).sort((a, b) => a - b);\n    return { min: nums[0]!, max: nums[nums.length - 1]! };\n  }\n\n  return { min: 1, max: 6 };\n}\n```\n\nThis matters because it makes moderation schema-driven rather than assumption-driven. The converter does not guess the valid strict and permissive bounds. It reads them from the actual field definition.\n\nFrom there, the mapping becomes deterministic:\n\n```\nexport function moderationToSafetyTolerance(input: SharedInputSchema, rawField: z.ZodTypeAny): number | undefined {\n  const val = input.generation_moderation as boolean | undefined;\n  if (val === undefined) return undefined;\n  const { min, max } = extractSafetyBounds(rawField);\n  return val ? min : max;\n}\n```\n\nAnd for models that expect the same concept as a string:\n\n```\nexport function moderationToSafetyToleranceString(input: SharedInputSchema, rawField: z.ZodTypeAny): string | undefined {\n  const val = input.generation_moderation as boolean | undefined;\n  if (val === undefined) return undefined;\n  const { min, max } = extractSafetyBounds(rawField);\n  return val ? String(min) : String(max);\n}\n```\n\nThat is a much stronger design than hardcoding model assumptions into business logic. It lets the schema remain the source of truth.\n\nNot all moderation controls are numeric. Some are semantic levels.\n\nBabySea maps those too:\n\n```\nexport function moderationToSafetyFilterLevel(input: SharedInputSchema): string | undefined {\n  const val = input.generation_moderation as boolean | undefined;\n  if (val === undefined) return undefined;\n  return val ? 'block_low_and_above' : 'block_only_high';\n}\nexport function moderationToModerationString(input: SharedInputSchema): string | undefined {\n  const val = input.generation_moderation as boolean | undefined;\n  if (val === undefined) return undefined;\n  return val ? 'auto' : 'low';\n}\n```\n\nThese strings are model-level implementation details. They should not leak into the public API as if they were universal moderation concepts. They are just one more representation that has to be normalized.\n\nOnce all of these mappings are in place, the public moderation surface becomes stable.\n\nThe user sees this:\n\n```\ngeneration_moderation: true\n```\n\nInternally, one model may receive:\n\n```\n{\n  \"disable_safety_checker\": false,\n  \"safety_tolerance\": 1,\n  \"safety_filter_level\": \"block_low_and_above\",\n  \"moderation\": \"auto\"\n}\n```\n\nAnother may receive:\n\n```\n{\n  \"enable_safety_checker\": true,\n  \"safety_tolerance\": \"1\"\n}\n```\n\nThe raw fields differ. The types differ. The polarity differs. But the intent is identical.\n\nThat is the value of normalization.\n\nThis is not just about moderation. It reflects a broader reality of generative media infrastructure: model interfaces are not stable, not uniform, and not designed around shared abstractions.\n\nIf an orchestration layer simply forwards raw fields, it inherits that fragmentation and passes it directly to every customer.\n\nA pass-through API is a transport layer for inconsistency.\n\nIf the goal is to provide a real platform contract, the inconsistency has to be absorbed above the model layer.\n\nModeration is one of the clearest examples because the fragmentation is visible immediately: enable versus disable, number versus string, tolerance versus policy mode. But the same pattern shows up in many other parts of the stack.\n\nThe correct response is not to document the inconsistency better. The correct response is to normalize it above the model layer.\n\nModeration is not a field. It is not a toggle. It is part of execution itself.\n\nIf safety is defined only at the interface, it will break under real-world conditions; across providers, across models, and across time.\n\nWhat has to be built is not validation at the edge, but enforcement throughout the lifecycle.\n\nAt BabySea, moderation is not something attached to a request.\n\nIt is something the system carries through execution.", "url": "https://wpnews.pro/news/moderation-is-not-one-field", "canonical_source": "https://dev.to/ariesrandy/moderation-is-not-one-field-2ka5", "published_at": "2026-11-22 02:38:31+00:00", "updated_at": "2026-11-22 02:42:41.231017+00:00", "lang": "en", "topics": ["generative-ai", "ai-tools", "ai-safety", "developer-tools"], "entities": ["BabySea"], "also_reported_by": [], "takeaway": "Abstract moderation behind one intent-level boolean and translate it per model, inverting polarity for disable_* fields and mapping booleans, numeric tolerances and string enums rather than passing raw safety fields through.", "recommendation": {"advice": "Expose a single moderation-intent boolean in your API and derive each model's disable/enable flags, tolerance values and filter levels behind the scenes instead of forwarding raw safety fields.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/moderation-is-not-one-field", "markdown": "https://wpnews.pro/news/moderation-is-not-one-field.md", "text": "https://wpnews.pro/news/moderation-is-not-one-field.txt", "jsonld": "https://wpnews.pro/news/moderation-is-not-one-field.jsonld"}}