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
    • All guides
    • Disabling request logging
    • Getting an API key
      • Estimating prompt size in tokens
      • Sending a request in prompt mode
      • Sending a series of requests in chat mode
      • Sending an asynchronous request
      • Calling a function from a model
    • Image generation
    • Batch processing
    • About Yandex AI Studio
    • Yandex Workflows
    • Quotas and limits
    • Terms and definitions
  • Compatibility with OpenAI
  • Access management
  • Pricing policy
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Getting started
  • Send a request to the model
  1. Step-by-step guides
  2. Text generation
  3. Sending a request in prompt mode

Sending a request in prompt mode

Written by
Yandex Cloud
Updated at October 28, 2025
  • Getting started
  • Send a request to the model

Getting startedGetting started

Python

Get API authentication credentials as described in Authentication with the Yandex AI Studio API.

Send a request to the modelSend a request to the model

Python
  1. Create a file named index.py and add the following code to it:

    import openai
    
    YANDEX_CLOUD_MODEL = "yandexgpt-lite"
    
    client = openai.OpenAI(
        api_key=YANDEX_CLOUD_API_KEY,
        base_url="https://rest-assistant.api.cloud.yandex.net/v1",
        project= YANDEX_CLOUD_FOLDER
    )
    
    response = client.responses.create(
        model=f"gpt://{YANDEX_CLOUD_FOLDER}/{YANDEX_CLOUD_MODEL}",
        input="Come up with three off-beat ideas for a travel startup.",
        temperature=0.8,
        max_output_tokens=1500
    )
    
    print(response.output[0].content[0].text)
    
  2. Save authentication data to environment variables:

    export YANDEX_CLOUD_FOLDER=<folder_ID>
    export YANDEX_CLOUD_API_KEY=<API_key>
    
  3. Run the file you created:

    python index.py
    

    Response example:

    1. **Travel search and management platform with astrology factored in.** The service will help travelers choose a destination, trip dates, and activities based on their astrological sign or individual natal chart. This may include recommendations on the best periods for traveling, places that are in tune with your sign's energy, and the choice of cultural and natural attractions that align with your astrological preferences.
    
    2. **Virtual travel guide with augmented reality features.** This is an app or service allowing users to "come across" a virtual guide wherever they are via augmented reality (AR). This guide can share facts if interest about the location, show hidden sightseeing attractions, and suggest routes for your hikes. The user can ask questions and get answers in real time with the AR technology responsible for visualization.
    
    3. **AI-based travel management service.** A platform that relies on AI algorithms to personalize your travels. AI can analyze the user’s preferences, budget, season, etc., and propose optimized routes, including flights, transfers, accommodations, and activities. The service can also propose alternatives if there is a change of schedule or other unforeseen events.
    

See alsoSee also

  • Overview of Yandex AI Studio AI models
  • Examples of working with ML SDK on GitHub

Was the article helpful?

Previous
Estimating prompt size in tokens
Next
Sending a series of requests in chat mode
© 2025 Direct Cursus Technology L.L.C.