input: ModerationResults { model, results, type } | Error { code, message, type }

Moderation for the request input.

One of the following:
ModerationResults { model, results, type }

Successful moderation results for the request input or generated output.

model: string

The moderation model used to generate the results.

results: Array<Result>

A list of moderation results.

categories: Record<string, boolean>

A dictionary of moderation categories to booleans, True if the input is flagged under this category.

category_applied_input_types: Record<string, Array<"text" | "image">>

Which modalities of input are reflected by the score for each category.

One of the following:
"text"
"image"
category_scores: Record<string, number>

A dictionary of moderation categories to scores.

flagged: boolean

A boolean indicating whether the content was flagged by any category.

model: string

The moderation model that produced this result.

type: "moderation_result"

The object type, which was always moderation_result for successful moderation results.

type: "moderation_results"

The object type, which is always moderation_results.

Error { code, message, type }

An error produced while attempting moderation.

code: string

The error code.

message: string

The error message.

type: "error"

The object type, which is always error.

output: ModerationResults { model, results, type } | Error { code, message, type }

Moderation for the generated output.

One of the following:
ModerationResults { model, results, type }

Successful moderation results for the request input or generated output.

model: string

The moderation model used to generate the results.

results: Array<Result>

A list of moderation results.

categories: Record<string, boolean>

A dictionary of moderation categories to booleans, True if the input is flagged under this category.

category_applied_input_types: Record<string, Array<"text" | "image">>

Which modalities of input are reflected by the score for each category.

One of the following:
"text"
"image"
category_scores: Record<string, number>

A dictionary of moderation categories to scores.

flagged: boolean

A boolean indicating whether the content was flagged by any category.

model: string

The moderation model that produced this result.

type: "moderation_result"

The object type, which was always moderation_result for successful moderation results.

type: "moderation_results"

The object type, which is always moderation_results.

Error { code, message, type }

An error produced while attempting moderation.

code: string

The error code.

message: string

The error message.

type: "error"

The object type, which is always error.