Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex AI Studio
  • Getting started with Model Gallery
    • About Yandex AI Studio
    • Yandex Workflows
    • Quotas and limits
    • Terms and definitions
  • Switching from the AI Assistant API to Responses API
  • Compatibility with OpenAI
  • Access management
  • Pricing policy
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Getting started
  • Generate the text

Getting started with the Model Gallery models

Written by
Yandex Cloud
Updated at December 3, 2025
  • Getting started
  • Generate the text

In this section, you will learn how to use Model Gallery models to generate text in synchronous mode. For other examples, see Guides on how to use Yandex AI Studio.

For information about the Yandex AI Studio pricing, see Yandex AI Studio pricing policy.

Getting startedGetting started

To get started in Yandex Cloud:

  1. Log in to the management console. If not signed up yet, navigate to the management console and follow the on-screen instructions.
  2. In Yandex Cloud Billing, make sure you have a billing account linked and its status is ACTIVE or TRIAL_ACTIVE. If you do not have a billing account yet, create one.
  3. If you do not have a folder yet, create one.
Management console
SDK

You can start working from the management console right away.

To use the examples of requests using SDK:

  1. Create a service account and assign the ai.languageModels.user role to it.
  2. Get and save the service account's API key with yc.ai.foundationModels.execute for its scope.

    The following examples use API key authentication. Yandex Cloud ML SDK also supports IAM token and OAuth token authentication. For more information, see Authentication in Yandex Cloud ML SDK.

    Note

    If you are using Windows, we recommend installing the WSL shell first and using it to proceed.

  3. Install Python 3.10 or higher.

  4. Install Python venv to create isolated virtual environments in Python.

  5. Create a new Python virtual environment and activate it:

    python3 -m venv new-env
    source new-env/bin/activate
    
  6. Use the pip package manager to install the ML SDK library:

    pip install yandex-cloud-ml-sdk
    

Generate the textGenerate the text

Note

The AI Studio API logs users' prompts to keep improving its responses. Do not use sensitive information and personal data in your prompts.

Management console
SDK
  1. In the management console, select a folder for which your account has the ai.playground.user role or higher.

  2. Click All services on the left-hand panel and select AI Studio or find it using the search bar on the dashboard.

  3. On the panel that opens, click AI Playground.

    screen01

  4. Select the generation type:

    • Context-based text generation: The model will generate responses based on the dialog history. This will allow you to refine the result during the interaction.
    • Text generation: The model will generate responses based only on your last message and instructions.
  5. Type your query in the input field below and click or press Enter. You can also use the query examples provided above.

    All your dialogs are saved in the Experiments panel on the right. Click next to the dialog to rename or delete it.

  6. Under Settings, specify the following generation settings:

    • Select a generation model.
    • Temperature: Enter a value between 0 and 1 for the model's response variability. With a higher value, you get a more unpredictable result.
    • Instructions: Describe your task, the appropriate writing style, limits, and other requirements for the model.
    • Use context: Change the generation type.
    • Use an assistant: With this option on, AI Playground will operate based on the AI Assistant API.
  7. Click Fine-tune model if you want to train the model to follow a complex response format.

  8. Under Model usage, click View code to get the code for a request to the model via the ML SDK for Python or cURL.

    screen02

  1. Create a file named generate-text.py and paste the following code into it:

    #!/usr/bin/env python3
    
    from __future__ import annotations
    from yandex_cloud_ml_sdk import YCloudML
    
    messages = [
        {
            "role": "system",
            "text": "Find errors in the text and correct them",
        },
        {
            "role": "user",
            "text": """Laminate flooring is sutiable for instalation in the kitchen or in a child's 
    room. It withsatnds moisturre and mechanical dammage thanks to 
    a 0.2 mm thick proctive layer of melamine films and 
    a wax-treated interlocking system.""",
        },
    ]
    
    
    def main():
        sdk = YCloudML(
            folder_id="<folder_ID>",
            auth="<API_key>",
        )
    
        result = (
            sdk.models.chat("yandexgpt").configure(temperature=0.5).run(messages)
        )
    
        for alternative in result:
            print(alternative)
    
    
    if __name__ == "__main__":
        main()
    

    Where:

    Note

    As input data for a request, Yandex Cloud ML SDK can accept a string, a dictionary, an object of the TextMessage class, or an array containing any combination of these data types. For more information, see Yandex Cloud ML SDK usage.

    • messages: List of messages that set the context for the model:

      • role: Message sender's role:

        • user: To send user messages to the model.
        • system: To set the request context and define the model's behavior.
        • assistant: For responses generated by the model. In chat mode, the model's responses tagged with the assistant role are included in the message to save the conversation context. Do not send user messages with this role.
      • text: Message text.

    • <folder_ID>: ID of the folder in which the service account was created.

    • <API_key>: Service account API key you got earlier required for authentication in the API.

      The following examples use API key authentication. Yandex Cloud ML SDK also supports IAM token and OAuth token authentication. For more information, see Authentication in Yandex Cloud ML SDK.

    For more information about accessing a specific model version, see Accessing models.

  2. Run the file you created:

    python3 generate-text.py
    

    Result:

    Alternative(role='assistant', text='Laminate flooring is suitable for installation in the kitchen or in a child's room. It withstands moisture and mechanical damage thanks to a 0.2 mm thick protective layer of melamine films and a wax-treated interlocking system.', status=<AlternativeStatus.FINAL: 3>)
    

What's nextWhat's next

  • Learn more about the service
  • Learn about API authentication methods

Was the article helpful?

Next
About Yandex AI Studio
© 2025 Direct Cursus Technology L.L.C.