Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex API Gateway
  • Getting started
    • All guides
    • Creating an API gateway
      • Overview
      • Cloud Functions
      • Static response
      • Object Storage
      • Serverless Containers
      • Access over HTTP
      • Message Queue
      • Data Streams
      • Managed Service for YDB
      • DataSphere
      • Yandex Foundation Models
      • Yandex Workflows
    • Viewing operations with service resources
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ
  1. Step-by-step guides
  2. Specification constructor
  3. Yandex Foundation Models

Adding the x-yc-apigateway-integration:http extension for integration with the Yandex Foundation Models text generation API

Written by
Yandex Cloud
Updated at April 9, 2025
Management console
  1. In the management console, select the folder in which you created or want to create an API gateway.

  2. From the list of services, select API Gateway.

  3. Select an API gateway or click Create API gateway to create a new one.

  4. In the Specification field, click .

  5. Specify the following in the field:

    • Path: Relative path to the integration that will be added to API Gateway URL. Specify variables in curly braces, e.g., /static/{function_id}. For more information, see the OpenAPI 3.0 specification.
    • HTTP method: Method that will be used to work with the integration.
    • Service account: Service account for authorization when accessing the text generation API. If you do not have a service account, create one.
  6. Under Model used select a model and provide the following:

    • 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.
  7. Under Prompt delivery method, select a prompt source and specify the following:

    • For the Query parameter source: Name of the query parameter where you will provide the prompt for the text generation API request.
    • For the Request body source: Name of the request body field you will use to provide the prompt for the text generation API request.
  8. Under Use case, select the model use case and set the relevant parameters:

    • Text generation:

      • (Optional) 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.
      • (Optional) Number of tokens: Maximum number of 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 .

        To get correct results, use meaningful class names.

      • (Optional) Request examples: Examples of text requests for classes in text request:class format. To add an example, click . To learn more, see Few-shot classifier.

  9. Click Add.

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

Requirements to the structure of an incoming request

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 delivery 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 delivery method section and its value.

    Here is a request body example: {"<request_body_field_name>": "<prompt_contents>"}.

Was the article helpful?

Previous
DataSphere
Next
Yandex Workflows
© 2025 Direct Cursus Technology L.L.C.