> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kiểm tra Prompt

> Kiểm tra văn bản, hình ảnh hoặc cả hai trước khi tạo, và nhận kết quả cho phép, gắn cờ hoặc từ chối cùng điểm số cho từng danh mục moderation.



## OpenAPI

````yaml post /moderation/screen
openapi: 3.1.0
info:
  title: public
  description: ''
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 1.116.1
servers:
  - url: https://test.dodopayments.com/
    description: Test Mode Server Host
  - url: https://live.dodopayments.com/
    description: Live Mode Server Host
security: []
tags:
  - name: Products
  - name: Payments
  - name: Subscriptions
  - name: Addons
  - name: Customers
  - name: Refunds
  - name: Disputes
  - name: Events
  - name: License Keys
  - name: Entitlements
  - name: Licenses
  - name: Discounts
  - name: Meters
  - name: Credit Entitlements
  - name: Credit Entitlement Balances
  - name: Outgoing Webhooks
  - name: Checkout
  - name: Webhook Events
  - name: Payment Connector Webhooks
  - name: Moderation
paths:
  /moderation/screen:
    post:
      tags:
        - Moderation
      summary: Screen a prompt
      description: >-
        Screens text, an image, or both, and returns a verdict: `allow`, `flag`
        or `deny`. The API is

        fail-closed: do not generate when you get no verdict.


        **Pricing.** Dodo Payments charges $0.30 per 1000 billable screens and
        debits the fee from your

        balance. A billable screen is a live-mode screen that returns a verdict.
        Errors and test-mode

        screens are free.


        **429.** Honour `Retry-After` and retry. A 429 is a throughput limit,
        not a verdict.


        **Test mode** returns mock verdicts and never calls the model. The
        default verdict is

        `allow`. Put one of these strings in `text` to select another outcome:
        `dodo_mock_flag`

        (`flag`), `dodo_mock_deny` (`deny`), `dodo_mock_overloaded` (429) or
        `dodo_mock_not_ready`

        (503).
      operationId: screen
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScreenRequest'
        required: true
      responses:
        '200':
          description: The verdict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScreenResponse'
        '400':
          description: '`INVALID_REQUEST_PARAMETERS` or `MODERATION_INVALID_IMAGE`.'
        '403':
          description: '`MODERATION_DISABLED`: the Moderation API is off for this business.'
        '413':
          description: '`MODERATION_INPUT_TOO_LARGE`.'
        '429':
          description: '`MODERATION_OVERLOADED`: retry after `Retry-After` seconds.'
          headers:
            Retry-After:
              schema:
                type: integer
                format: int64
                minimum: 0
              description: Seconds to wait before a retry.
        '503':
          description: '`MODERATION_UNAVAILABLE`: no verdict is available. Do not generate.'
      security:
        - API_KEY: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import DodoPayments from 'dodopayments';

            const client = new DodoPayments({
              bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.moderation.screen();

            console.log(response.request_id);
        - lang: Python
          source: |-
            import os
            from dodopayments import DodoPayments

            client = DodoPayments(
                bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"),  # This is the default and can be omitted
            )
            response = client.moderation.screen()
            print(response.request_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/dodopayments/dodopayments-go\"\n\t\"github.com/dodopayments/dodopayments-go/option\"\n)\n\nfunc main() {\n\tclient := dodopayments.NewClient(\n\t\toption.WithBearerToken(\"My Bearer Token\"),\n\t)\n\tresponse, err := client.Moderation.Screen(context.TODO(), dodopayments.ModerationScreenParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.RequestID)\n}\n"
        - lang: Java
          source: >-
            package com.dodopayments.api.example;


            import com.dodopayments.api.client.DodoPaymentsClient;

            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;

            import
            com.dodopayments.api.models.moderation.ModerationScreenParams;

            import
            com.dodopayments.api.models.moderation.ModerationScreenResponse;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

                    ModerationScreenResponse response = client.moderation().screen();
                }
            }
        - lang: Kotlin
          source: >-
            package com.dodopayments.api.example


            import com.dodopayments.api.client.DodoPaymentsClient

            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient

            import com.dodopayments.api.models.moderation.ModerationScreenParams

            import
            com.dodopayments.api.models.moderation.ModerationScreenResponse


            fun main() {
                val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

                val response: ModerationScreenResponse = client.moderation().screen()
            }
        - lang: Ruby
          source: |-
            require "dodopayments"

            dodo_payments = Dodopayments::Client.new(
              bearer_token: "My Bearer Token",
              environment: "test_mode" # defaults to "live_mode"
            )

            response = dodo_payments.moderation.screen

            puts(response)
        - lang: PHP
          source: |-
            <?php

            require_once dirname(__DIR__) . '/vendor/autoload.php';

            use Dodopayments\Client;
            use Dodopayments\Core\Exceptions\APIException;

            $client = new Client(
              bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
              environment: 'test_mode',
            );

            try {
              $response = $client->moderation->screen(
                image: 'image', requestID: 'request_id', text: 'text'
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: |-
            using System;
            using DodoPayments.Client;
            using DodoPayments.Client.Models.Moderation;

            DodoPaymentsClient client = new();

            ModerationScreenParams parameters = new();

            var response = await client.Moderation.Screen(parameters);

            Console.WriteLine(response);
        - lang: Rust
          source: |-
            use dodopayments::Client;

            #[tokio::main]
            async fn main() -> dodopayments::Result<()> {
                let client = Client::from_env()?;
                let result = client
                    .moderation()
                    .screen()
                    .body(Default::default())
                    .await?;
                println!("{result:?}");
                Ok(())
            }
components:
  schemas:
    ScreenRequest:
      type: object
      description: >-
        A screen of text, an image, or both. Send at least one of `text` and
        `image`.
      properties:
        image:
          type:
            - string
            - 'null'
          description: >-
            The image to screen, as base64, with or without a
            `data:image/...;base64,` prefix. The

            formats are JPEG, PNG, WebP, GIF and BMP. The limit is 6991530
            base64 characters, and the

            decoded image must be at most 5 MiB.
          maxLength: 6991530
        request_id:
          type:
            - string
            - 'null'
          description: >-
            Your identifier for this screen, up to 128 characters, with no
            control characters. The

            response returns it in `request_id`.
        text:
          type:
            - string
            - 'null'
          description: The text to screen, up to 8000 characters.
          maxLength: 8000
    ScreenResponse:
      type: object
      description: The verdict of one screen.
      required:
        - decision
        - categories
        - provenance
        - triggered
        - compound_triggered
        - notes
        - latency_ms
        - passes
        - normalized_applied
        - request_id
      properties:
        categories:
          $ref: '#/components/schemas/CategoryScores'
        compound_triggered:
          type: boolean
          description: >-
            True when real-person likeness and sexual content together crossed
            their combined

            threshold, the pattern of a sexual deepfake.
        decision:
          $ref: '#/components/schemas/Decision'
        latency_ms:
          type: integer
          format: int64
          description: The time the screen took, in milliseconds.
          minimum: 0
        normalized_applied:
          type: boolean
          description: >-
            True when the text was also screened in a normalized form, with
            obfuscation such as

            invisible or look-alike characters removed.
        notes:
          type: array
          items:
            type: string
          description: >-
            Human-readable reasons for the decision. The wording can change, so
            do not parse it.
        passes:
          type: integer
          format: int64
          description: The number of yes/no questions the model answered for this screen.
          minimum: 0
        provenance:
          $ref: '#/components/schemas/CategoryProvenance'
        request_id:
          type:
            - string
            - 'null'
          description: The `request_id` you sent, or null.
        triggered:
          type: array
          items:
            $ref: '#/components/schemas/Category'
          description: >-
            The categories whose score crossed the threshold of the category. It
            can be empty on a

            `flag` from the general check. `notes` then gives the reason.
    CategoryScores:
      type: object
      description: The probability, from 0 to 1, that the screen falls in each category.
      required:
        - violent_crimes
        - sex_related_crimes
        - child_sexual_exploitation
        - suicide_and_self_harm
        - indiscriminate_weapons
        - intellectual_property
        - defamation
        - non_violent_crimes
        - hate
        - privacy
        - specialized_advice
        - sexual_content
        - non_consensual_intimate_imagery
        - minor_coded_language
        - real_person_likeness
        - living_artist_style
        - prompt_injection
      properties:
        child_sexual_exploitation:
          type: number
          format: double
          description: Child sexual exploitation.
        defamation:
          type: number
          format: double
          description: >-
            False depiction that is likely to injure the reputation of a real
            person.
        hate:
          type: number
          format: double
          description: Demeaning people because of a protected characteristic.
        indiscriminate_weapons:
          type: number
          format: double
          description: Chemical, biological, radiological, nuclear or explosive weapons.
        intellectual_property:
          type: number
          format: double
          description: Copyright or trademark infringement.
        living_artist_style:
          type: number
          format: double
          description: Imitation of the signature style of a specific living artist.
        minor_coded_language:
          type: number
          format: double
          description: Age-coded language that suggests the subject is a minor.
        non_consensual_intimate_imagery:
          type: number
          format: double
          description: >-
            Non-consensual intimate imagery: undressing, nudifying or
            sexualising a real person.
        non_violent_crimes:
          type: number
          format: double
          description: Non-violent crimes.
        privacy:
          type: number
          format: double
          description: Sensitive private information about a person.
        prompt_injection:
          type: number
          format: double
          description: An attempt to override or manipulate the instructions of the system.
        real_person_likeness:
          type: number
          format: double
          description: The likeness of a real, identifiable, named person.
        sex_related_crimes:
          type: number
          format: double
          description: Sex-related crimes.
        sexual_content:
          type: number
          format: double
          description: Sexually explicit or pornographic content.
        specialized_advice:
          type: number
          format: double
          description: Unqualified financial, medical, legal or electoral advice.
        suicide_and_self_harm:
          type: number
          format: double
          description: Suicide and self-harm.
        violent_crimes:
          type: number
          format: double
          description: Violent crimes.
    Decision:
      type: string
      description: >-
        The verdict. `allow` means the content passed. `deny` means block the
        content. `flag` means

        apply your own judgement. It is not a soft deny.
      enum:
        - allow
        - flag
        - deny
    CategoryProvenance:
      type: object
      description: How each score in `categories` was measured.
      required:
        - violent_crimes
        - sex_related_crimes
        - child_sexual_exploitation
        - suicide_and_self_harm
        - indiscriminate_weapons
        - intellectual_property
        - defamation
        - non_violent_crimes
        - hate
        - privacy
        - specialized_advice
        - sexual_content
        - non_consensual_intimate_imagery
        - minor_coded_language
        - real_person_likeness
        - living_artist_style
        - prompt_injection
      properties:
        child_sexual_exploitation:
          $ref: '#/components/schemas/Provenance'
          description: Child sexual exploitation.
        defamation:
          $ref: '#/components/schemas/Provenance'
          description: >-
            False depiction that is likely to injure the reputation of a real
            person.
        hate:
          $ref: '#/components/schemas/Provenance'
          description: Demeaning people because of a protected characteristic.
        indiscriminate_weapons:
          $ref: '#/components/schemas/Provenance'
          description: Chemical, biological, radiological, nuclear or explosive weapons.
        intellectual_property:
          $ref: '#/components/schemas/Provenance'
          description: Copyright or trademark infringement.
        living_artist_style:
          $ref: '#/components/schemas/Provenance'
          description: Imitation of the signature style of a specific living artist.
        minor_coded_language:
          $ref: '#/components/schemas/Provenance'
          description: Age-coded language that suggests the subject is a minor.
        non_consensual_intimate_imagery:
          $ref: '#/components/schemas/Provenance'
          description: >-
            Non-consensual intimate imagery: undressing, nudifying or
            sexualising a real person.
        non_violent_crimes:
          $ref: '#/components/schemas/Provenance'
          description: Non-violent crimes.
        privacy:
          $ref: '#/components/schemas/Provenance'
          description: Sensitive private information about a person.
        prompt_injection:
          $ref: '#/components/schemas/Provenance'
          description: An attempt to override or manipulate the instructions of the system.
        real_person_likeness:
          $ref: '#/components/schemas/Provenance'
          description: The likeness of a real, identifiable, named person.
        sex_related_crimes:
          $ref: '#/components/schemas/Provenance'
          description: Sex-related crimes.
        sexual_content:
          $ref: '#/components/schemas/Provenance'
          description: Sexually explicit or pornographic content.
        specialized_advice:
          $ref: '#/components/schemas/Provenance'
          description: Unqualified financial, medical, legal or electoral advice.
        suicide_and_self_harm:
          $ref: '#/components/schemas/Provenance'
          description: Suicide and self-harm.
        violent_crimes:
          $ref: '#/components/schemas/Provenance'
          description: Violent crimes.
    Category:
      type: string
      description: A moderation category.
      enum:
        - violent_crimes
        - sex_related_crimes
        - child_sexual_exploitation
        - suicide_and_self_harm
        - indiscriminate_weapons
        - intellectual_property
        - defamation
        - non_violent_crimes
        - hate
        - privacy
        - specialized_advice
        - sexual_content
        - non_consensual_intimate_imagery
        - minor_coded_language
        - real_person_likeness
        - living_artist_style
        - prompt_injection
    Provenance:
      type: string
      description: >-
        How a score was measured. `targeted` means a check for that one category
        measured it.

        `broad` means the general check that covers all categories measured it.
      enum:
        - targeted
        - broad
  securitySchemes:
    API_KEY:
      type: http
      scheme: bearer

````