[Yandex Cloud documentation](../../../index.md) > [Yandex API Gateway](../../index.md) > [Step-by-step guides](../index.md) > [Specification constructor](index.md) > Yandex Cloud AI Studio

# Adding the `x-yc-apigateway-integration:http` extension for integration with the Yandex Cloud AI Studio text generation API

{% list tabs %}

- Management console

    1. In the [management console](https://console.yandex.cloud), select the [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) in which you created or want to create an [API gateway](../../concepts/index.md).
    1. Navigate to **API Gateway**.
    1. Select an API gateway or click **Create API gateway** to create a new one.
    1. In the **Specification** field, click ![image](../../../_assets/api-gateway/spec-constructor/cloud-yagpt.svg).
    1. Specify the following:

        * **Path**: Integration relative path to add to the API Gateway URL. Remember to wrap variables in braces, e.g., `/static/{function_id}`. For more information, see the [OpenAPI 3.0](https://github.com/OAI/OpenAPI-Specification) specification.
        * **HTTP method**: Method to use to work with the integration.

        * **Service account**: Service account for authorization when accessing the [text generation API](https://aistudio.yandex.ru/docs/en/ai-studio/concepts/generation/index). If you do not have a service account, [create](../../../iam/operations/sa/create.md) one.

    1. Under **Model in use**, select a model and specify:

        * For a `YandexGPT` model: Folder ID that will be specified in the text generation model URI.
        * For a `DataSphere` model: ID of the model tuned in [Yandex DataSphere](../../../datasphere/index.md).

    1. Under **Prompt transmission method**, select a prompt source and specify the following:

        * For the `Query parameter` source: Name of the query parameter in which to provide the prompt for the text generation API request.
        * For the `Body of request` source: Name of the request body field in which to provide the prompt for the text generation API request.
    1. Under **Usage scenarios**, select the model use case and set the relevant parameters:

        * `Text generation`:

            * Optionally, **Temperature**: Determines the variability of the model's response. Specify a value from `0` to `1`. With a higher temperature, you get a more creative and randomized response from the model. The default value is `0.3`.
            * Optionally, **Number of tokens**: Maximum number of generation [tokens](https://aistudio.yandex.ru/docs/en/ai-studio/concepts/generation/tokens). The default value is `5`. This allows you to limit the size of the model response, if required.

        * `Text classification`:

            * **Task description**: Text description of the task for the classifier.
            * **Classes**: List of classes the text can belong to. To add a class, click ![image](../../../_assets/console-icons/plus.svg).

                To get correct results, use meaningful class names.

            * Optionally, **Example requests**: Examples of text requests for classes in `text request:class` format. To add an example, click ![image](../../../_assets/console-icons/plus.svg). For more information, see [Few-shot classifier](https://aistudio.yandex.ru/docs/en/ai-studio/concepts/classifier/index#few-shot).

    1. Click **Add**.

{% endlist %}

The **Specification** field will display the OpenAPI specification with the specified parameter values.


## Requirements to the structure of an incoming request {#requirements}

For the API gateway to correctly process incoming requests, set the `Content-Type: application/json` header. Plus, consider the following:
* If `Query parameter` is selected as a method to deliver the prompt, the request must include the query parameter from the **Prompt transmission method** section and its value.

    Here is an API gateway call path example: `<path_to_integration>?<specified_query_parameter>=<prompt_contents>`.
* If `Request body` is selected as a method to deliver the prompt, the request body must include the field from the **Prompt transmission method** section and its value.
            
    Here is a request body example: `{"<request_body_field_name>": "<prompt_contents>"}`.