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

# Create AI-task

> Creating an AI task.


This method allows you to create an AI task for VOD video processing:
- ASR: Transcribe video
- ASR: Translate subtitles
- CM: Sports detection
- CM: Not Safe For Work (NSFW) content detection
- CM: Soft nudity detection
- CM: Hard nudity detection
- CM: Objects recognition (soon)

![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif)


How to use:
- Create an AI task, specify algoritm to use
- Get `task_id`
- Check a result using ```.../ai/tasks/{task_id}``` method

For more detailed information, see the description of each method separately.

  


**AI Automatic Speech Recognition (ASR)**

AI is instrumental in automatic video processing for subtitles creation by using Automatic Speech Recognition (ASR) technology to transcribe spoken words into text, which can then be translated into multiple languages for broader accessibility. 

Categories:
- ```transcription``` – to create subtitles/captions from audio in the original language.
- ```translation``` – to transate subtitles/captions from the original language to 99+ other languages. 

AI subtitle transcription and translation tools are highly efficient, processing large volumes of audio-visual content quickly and providing accurate transcriptions and translations with minimal human intervention. Additionally, AI-driven solutions can significantly reduce costs and turnaround times compared to traditional methods, making them an invaluable resource for content creators and broadcasters aiming to reach global audiences.

Example response with positive result:

```
{
  "status": "SUCCESS",
  "result": {
    "subtitles": [
      {
          "start_time": "00:00:00.031",
          "end_time": "00:00:03.831",
          "text": "Come on team, ..."
      }, ...
    ]
    "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...",
    "concatenated_text": "Come on team, ...",
    "languages": [ "eng" ],
    "speech_detected": true
    }
  }, ...
}
``` 

  


**AI Content Moderation (CM)**

The AI Content Moderation API offers a powerful solution for analyzing video content to detect various categories of inappropriate material. Leveraging state-of-the-art AI models, this API ensures real-time analysis and flagging of sensitive or restricted content types, making it an essential tool for platforms requiring stringent content moderation.

Categories:
- ```nsfw```: Quick algorithm to detect pornographic material, ensuring content is "not-safe-for-work" or normal.
- ```hard_nudity```: Detailed analisys of video which detects explicit nudity involving genitalia.
- ```soft_nudity```: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts.
- ```sport```: Recognizes various sporting activities.

The AI Content Moderation API is an invaluable tool for managing and controlling the type of content being shared or streamed on your platform. By implementing this API, you can ensure compliance with community guidelines and legal requirements, as well as provide a safer environment for your users.

Important notes:
- It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration.
- Not all frames in the video are used for analysis, but only key frames (Iframe). For example, if a key frame in a video is set every ±2 seconds, then detection will only occur at these timestamps. If an object appears and disappears between these time stamps, it will not be detected. We are working on a version to analyze more frames, please contact your manager or our support team to enable this method.



Example response with positive result:

```
{
  "status": "SUCCESS",
  "result": {
      "nsfw_detected": true,
      "detection_results": [ "nsfw" ],
      "frames": [
          {
              "label": "nsfw",
              "confidence": 1.0,
              "frame_number": 24
          },...
      ]
  }
}
```

  


**Additional information**

Billing takes into account the duration of the analyzed video. Or the duration until the stop tag(where applicable), if the condition was triggered during the analysis.


  


The heart of content moderation is AI, with additional services. They run on our own infrastructure, so the files/data are not transferred anywhere to external services. After processing, original files are also deleted from local storage of AI.

  


Read more detailed information about our solution, and architecture, and benefits in the knowledge base and blog.



## OpenAPI

````yaml /api-reference/services_documented/streaming_api.yaml post /streaming/ai/tasks
openapi: 3.1.0
info:
  title: Gcore OpenAPI – Streaming API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-14T07:00:22.640261+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: AI
    x-displayName: AI
  - name: Broadcasts
    x-displayName: Broadcasts
  - name: Directories
    x-displayName: Directories
  - name: Overlays
    x-displayName: Overlays
  - name: Players
    x-displayName: Players
  - name: Playlists
    x-displayName: Playlists
  - name: QualitySets
    x-displayName: QualitySets
  - name: Restreams
    x-displayName: Restreams
  - name: Streaming Statistics
    x-displayName: Statistics
  - name: Streams
    x-displayName: Streams
  - name: Subtitles
    x-displayName: Subtitles
  - name: Videos
    x-displayName: Videos
paths:
  /streaming/ai/tasks:
    post:
      tags:
        - AI
      summary: Create AI-task
      description: >-
        Creating an AI task.



        This method allows you to create an AI task for VOD video processing:

        - ASR: Transcribe video

        - ASR: Translate subtitles

        - CM: Sports detection

        - CM: Not Safe For Work (NSFW) content detection

        - CM: Soft nudity detection

        - CM: Hard nudity detection

        - CM: Objects recognition (soon)


        ![Auto generated subtitles
        example](https://demo-files.gvideo.io/apidocs/captions.gif)



        How to use:

        - Create an AI task, specify algoritm to use

        - Get `task_id`

        - Check a result using ```.../ai/tasks/{task_id}``` method


        For more detailed information, see the description of each method
        separately.

          


        **AI Automatic Speech Recognition (ASR)**


        AI is instrumental in automatic video processing for subtitles creation
        by using Automatic Speech Recognition (ASR) technology to transcribe
        spoken words into text, which can then be translated into multiple
        languages for broader accessibility. 


        Categories:

        - ```transcription``` – to create subtitles/captions from audio in the
        original language.

        - ```translation``` – to transate subtitles/captions from the original
        language to 99+ other languages. 


        AI subtitle transcription and translation tools are highly efficient,
        processing large volumes of audio-visual content quickly and providing
        accurate transcriptions and translations with minimal human
        intervention. Additionally, AI-driven solutions can significantly reduce
        costs and turnaround times compared to traditional methods, making them
        an invaluable resource for content creators and broadcasters aiming to
        reach global audiences.


        Example response with positive result:


        ```

        {
          "status": "SUCCESS",
          "result": {
            "subtitles": [
              {
                  "start_time": "00:00:00.031",
                  "end_time": "00:00:03.831",
                  "text": "Come on team, ..."
              }, ...
            ]
            "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...",
            "concatenated_text": "Come on team, ...",
            "languages": [ "eng" ],
            "speech_detected": true
            }
          }, ...
        }

        ``` 

          


        **AI Content Moderation (CM)**


        The AI Content Moderation API offers a powerful solution for analyzing
        video content to detect various categories of inappropriate material.
        Leveraging state-of-the-art AI models, this API ensures real-time
        analysis and flagging of sensitive or restricted content types, making
        it an essential tool for platforms requiring stringent content
        moderation.


        Categories:

        - ```nsfw```: Quick algorithm to detect pornographic material, ensuring
        content is "not-safe-for-work" or normal.

        - ```hard_nudity```: Detailed analisys of video which detects explicit
        nudity involving genitalia.

        - ```soft_nudity```: Detailed video analysis that reveals both explicit
        and partial nudity, including the presence of male and female faces and
        other uncovered body parts.

        - ```sport```: Recognizes various sporting activities.


        The AI Content Moderation API is an invaluable tool for managing and
        controlling the type of content being shared or streamed on your
        platform. By implementing this API, you can ensure compliance with
        community guidelines and legal requirements, as well as provide a safer
        environment for your users.


        Important notes:

        - It's allowed to analyse still images too (where applicable). Format of
        image: JPEG, PNG. In that case one image is the same as video of 1
        second duration.

        - Not all frames in the video are used for analysis, but only key frames
        (Iframe). For example, if a key frame in a video is set every ±2
        seconds, then detection will only occur at these timestamps. If an
        object appears and disappears between these time stamps, it will not be
        detected. We are working on a version to analyze more frames, please
        contact your manager or our support team to enable this method.




        Example response with positive result:


        ```

        {
          "status": "SUCCESS",
          "result": {
              "nsfw_detected": true,
              "detection_results": [ "nsfw" ],
              "frames": [
                  {
                      "label": "nsfw",
                      "confidence": 1.0,
                      "frame_number": 24
                  },...
              ]
          }
        }

        ```

          


        **Additional information**


        Billing takes into account the duration of the analyzed video. Or the
        duration until the stop tag(where applicable), if the condition was
        triggered during the analysis.


          


        The heart of content moderation is AI, with additional services. They
        run on our own infrastructure, so the files/data are not transferred
        anywhere to external services. After processing, original files are also
        deleted from local storage of AI.

          


        Read more detailed information about our solution, and architecture, and
        benefits in the knowledge base and blog.
      operationId: post_ai_tasks_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ai_task'
      responses:
        '201':
          description: >-
            Response returns ID of the created AI task. Using this AI task ID,
            you can check the status and get the video processing result. Look
            at GET /ai/results method.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ai_post_response'
        '400':
          description: |-
            Bad request:
            - "url" is not specified
            - Queue limit reached (100), try later
            - etc
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/streaming_error'
        '422':
          description: >-
            This is advanced functionality; to enable it, contact your manager
            or the Support Team.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/upgraderequired'
        '429':
          description: Too many requests, try later
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/streaming_error'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            ai_task = client.streaming.ai_tasks.create(
                task_name="transcription",
                url="url",
            )
            print(ai_task.task_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/option\"\n\t\"github.com/G-Core/gcore-go/streaming\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\taiTask, err := client.Streaming.AITasks.New(context.TODO(), streaming.AITaskNewParams{\n\t\tTaskName: streaming.AITaskNewParamsTaskNameTranscription,\n\t\tURL:      \"url\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", aiTask.TaskID)\n}\n"
components:
  schemas:
    ai_task:
      type: object
      properties:
        task_name:
          type: string
          description: Name of the task to be performed
          enum:
            - transcription
            - content-moderation
      required:
        - task_name
        - url
      example:
        task_name: transcription|content-moderation
        url: https://demo-files.gvideo.io/ai_demo_subtitles_nudity_detection.mp4
        audio_language: ger
        category: nsfw
      allOf:
        - $ref: '#/components/schemas/ai_transcribe'
        - $ref: '#/components/schemas/ai_contentmoderation_general'
    ai_post_response:
      type: object
      required:
        - task_id
      properties:
        task_id:
          type: string
          format: uuid
          description: >-
            ID of the created AI task, from which you can get the execution
            result
      example:
        task_id: aafe70c6-0000-0000-0000-327b65f7670f
    streaming_error:
      type: object
      properties:
        error:
          type: string
          description: Text message with description of error.
      example:
        error: Queue limit reached (100), try later.
    upgraderequired:
      type: object
      properties:
        error:
          type: string
          description: >-
            This is advanced functionality; to enable it, contact your manager
            or support service.
      example:
        error: Feature is disabled. Contact support to enable.
    ai_transcribe:
      type: object
      required:
        - url
        - task_name
      properties:
        task_name:
          type: string
          description: Name of the task to be performed
          enum:
            - transcription
        url:
          type: string
          description: >-
            URL to the MP4 file to analyse. File must be publicly accessible via
            HTTP/HTTPS.
        audio_language:
          type: string
          description: >-
            Language in original audio (transcription only). This value is used
            to determine the language from which to transcribe.


            If this is not set, the system will run auto language identification
            and the subtitles will be in the detected language. The method also
            works based on AI analysis. It's fairly accurate, but if it's wrong,
            then set the language explicitly.


            Additionally, when this is not set, we also support recognition of
            alternate languages in the video (language code-switching).


            Language is set by 3-letter language code according to ISO-639-2
            (bibliographic code). 


            We can process languages:

            - 'afr': Afrikaans

            - 'alb': Albanian

            - 'amh': Amharic

            - 'ara': Arabic

            - 'arm': Armenian

            - 'asm': Assamese

            - 'aze': Azerbaijani

            - 'bak': Bashkir

            - 'baq': Basque

            - 'bel': Belarusian

            - 'ben': Bengali

            - 'bos': Bosnian

            - 'bre': Breton

            - 'bul': Bulgarian

            - 'bur': Myanmar

            - 'cat': Catalan

            - 'chi': Chinese

            - 'cze': Czech

            - 'dan': Danish

            - 'dut': Nynorsk

            - 'eng': English

            - 'est': Estonian

            - 'fao': Faroese

            - 'fin': Finnish

            - 'fre': French

            - 'geo': Georgian

            - 'ger': German

            - 'glg': Galician

            - 'gre': Greek

            - 'guj': Gujarati

            - 'hat': Haitian creole

            - 'hau': Hausa

            - 'haw': Hawaiian

            - 'heb': Hebrew

            - 'hin': Hindi

            - 'hrv': Croatian

            - 'hun': Hungarian

            - 'ice': Icelandic

            - 'ind': Indonesian

            - 'ita': Italian

            - 'jav': Javanese

            - 'jpn': Japanese

            - 'kan': Kannada

            - 'kaz': Kazakh

            - 'khm': Khmer

            - 'kor': Korean

            - 'lao': Lao

            - 'lat': Latin

            - 'lav': Latvian

            - 'lin': Lingala

            - 'lit': Lithuanian

            - 'ltz': Luxembourgish

            - 'mac': Macedonian

            - 'mal': Malayalam

            - 'mao': Maori

            - 'mar': Marathi

            - 'may': Malay

            - 'mlg': Malagasy

            - 'mlt': Maltese

            - 'mon': Mongolian

            - 'nep': Nepali

            - 'dut': Dutch

            - 'nor': Norwegian

            - 'oci': Occitan

            - 'pan': Punjabi

            - 'per': Persian

            - 'pol': Polish

            - 'por': Portuguese

            - 'pus': Pashto

            - 'rum': Romanian

            - 'rus': Russian

            - 'san': Sanskrit

            - 'sin': Sinhala

            - 'slo': Slovak

            - 'slv': Slovenian

            - 'sna': Shona

            - 'snd': Sindhi

            - 'som': Somali

            - 'spa': Spanish

            - 'srp': Serbian

            - 'sun': Sundanese

            - 'swa': Swahili

            - 'swe': Swedish

            - 'tam': Tamil

            - 'tat': Tatar

            - 'tel': Telugu

            - 'tgk': Tajik

            - 'tgl': Tagalog

            - 'tha': Thai

            - 'tib': Tibetan

            - 'tuk': Turkmen

            - 'tur': Turkish

            - 'ukr': Ukrainian

            - 'urd': Urdu

            - 'uzb': Uzbek

            - 'vie': Vietnamese

            - 'wel': Welsh

            - 'yid': Yiddish

            - 'yor': Yoruba
          default: null
        subtitles_language:
          type: string
          description: >-
            Indicates which language it is clearly necessary to translate into.

            If this is not set, the original language will be used from
            attribute "audio_language".


            Please note that:

            - transcription into the original language is a free procedure,

            - and translation from the original language into any other
            languages is a "translation" procedure and is paid. More details in
            [POST
            /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task).

            Language is set by 3-letter language code according to ISO-639-2
            (bibliographic code).
          default: null
        client_user_id:
          type: string
          maxLength: 256
          default: null
          description: >-
            Meta parameter, designed to store your own identifier. Can be used
            by you to tag requests from different end-users. It is not used in
            any way in video processing.
        client_entity_data:
          type: string
          maxLength: 4096
          default: null
          description: >-
            Meta parameter, designed to store your own extra information about a
            video entity: video source, video id, etc. It is not used in any way
            in video processing.


            For example, if an AI-task was created automatically when you
            uploaded a video with the AI auto-processing option (transcribing,
            translationing), then the ID of the associated video for which the
            task was performed will be explicitly indicated here.
      example:
        url: https://demo-files.gvideo.io/apidocs/spritefright-blender-cut30sec.mp4
        task_name: transcription
        audio_language: ger
    ai_contentmoderation_general:
      type: object
      required:
        - url
        - task_name
      properties:
        task_name:
          type: string
          description: Name of the task to be performed
          enum:
            - content-moderation
        url:
          type: string
          description: >-
            URL to the MP4 file to analyse. File must be publicly accessible via
            HTTP/HTTPS.
        category:
          type: string
          description: >-
            Model for analysis (content-moderation only). Determines what
            exactly needs to be found in the video.
          enum:
            - sport
            - nsfw
            - hard_nudity
            - soft_nudity
        client_user_id:
          type: string
          maxLength: 256
          default: null
          description: >-
            Meta parameter, designed to store your own identifier. Can be used
            by you to tag requests from different end-users. It is not used in
            any way in video processing.
        client_entity_data:
          type: string
          maxLength: 4096
          default: null
          description: >-
            Meta parameter, designed to store your own extra information about a
            video entity: video source, video id, etc. It is not used in any way
            in video processing.


            For example, if an AI-task was created automatically when you
            uploaded a video with the AI auto-processing option (nudity
            detection, etc), then the ID of the associated video for which the
            task was performed will be explicitly indicated here.
      example:
        url: https://demo-files.gvideo.io/ai_demo_subtitles_nudity_detection.mp4
        task_name: content-moderation
        category: nsfw
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````