Getting started with Yandex Cloud AI Studio

Yandex Cloud AI Studio brings together AI services and Yandex Cloud technologies for your business so you can create AI solutions of your own.

AI Studio provides a wide range of APIs and tools that are good for any challenge: OpenAI-compatible APIs for creating text-based and voice-based agents, MCP servers, web and file search tools, as well as specialized APIs developed by Yandex.

As you go through this section, you will create and configure your account and then submit your first query to a generative text model from Model Gallery.

Get your cloud ready

AI Studio follows the Yandex Cloud resource model, where most services store their resources in folders. Folders belong to clouds, and clouds belong to organizations. You will need a folder to work with AI Studio.

  1. Log in to AI Studio under your personal Yandex account (Yandex ID). For a detailed guide on how to create such an account, see Yandex ID Help.

  2. Create an organization:

    • Enter the organization name.
    • Specify the cloud name. This name will be used for all the Yandex Cloud resources.
    • Click Open AI Studio.

    The organization will automatically get a new folder named default.

Linking a billing account

To work with AI Studio, you need an active billing account linked to your cloud. When you create your first billing account and add a credit/debit card, you will get your initial grant.

  1. After you log in to AI Studio, click Link billing account in the top-right corner of the UI.

  2. Create a billing account or select an existing one.

    • Click Add card.
    • Specify your card details: 16-digit number, expiration date, and CVV (you can find it on the back side of your card).
    • Click Link.
  3. Make sure the billing account status is ACTIVE or TRIAL_ACTIVE.

Create an API key

To create an API key:

  1. In the AI Studio interface, click Create API key in the top-right corner.
  2. Optionally, change the description of the API key so you can easily find the key later.
  3. Select the API key expiration date.
  4. Click Create.
  5. Save the ID and secret key.

Alert

Do not share your API key with anyone. After you close this dialog, the key value will no longer be available.

Together with the API key, the system will create a service account with minimal roles required for working in AI Studio.

Set up your environment

  1. Install the required packages and libraries:

    1. Install Python 3.10 or higher.

    2. Optionally, install Python venv to create isolated virtual environments in Python.

    3. Optionally, create a new Python virtual environment and activate it:

      python3 -m venv new-env
              source new-env/bin/activate
              

      Note

      If you are using Windows, we recommend installing the WSL shell first and then using it to perform other operations.

    4. Install the OpenAI Python library:

      pip install --upgrade openai
              

    Install the OpenAI Node.js library:

    npm install --save openai
            # or
            yarn add openai
            

    Install cURL.

    1. Install Go 1.23.4 or higher:

      Note

      For Windows, download the installer from the official website.
      For macOS, install the package from the official website or use Homebrew:

      brew install go
              
      • Download the archive from the official website:

        wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
                
      • Unpack the archive to the /usr/local directory:

        sudo tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
                
      • Open ~/.bashrc:

        nano ~/.bashrc
                
      • Add the following lines at the end of the file:

        export GOROOT=/usr/local/go          # Go path
                export GOPATH=$HOME/go               # Working directory (modules and cache)
                export PATH=$PATH:$GOROOT/bin        # Required for the `go` command
                export PATH=$PATH:$GOPATH/bin        # Required for the installed tools
                
      • Save the file and reload the settings:

        source ~/.bashrc
                
      • Test how it all works:

        go version 
                

        Response example:

        go version go1.23.4 linux/amd64
                
    2. Install the OpenAI Go library:

      go get github.com/openai/openai-go # v1
              go get -u 'github.com/openai/openai-go/v3@v3.32.0' # v3
              
    1. Install Python 3.10 or higher.

    2. Optionally, install Python venv to create isolated virtual environments in Python.

    3. Optionally, create a new Python virtual environment and activate it:

      python3 -m venv new-env
              source new-env/bin/activate
              

      Note

      If you are using Windows, we recommend installing the WSL shell first and then using it to perform other operations.

    4. Install the ML SDK library:

      pip install yandex-ai-studio-sdk
              
  2. To use Model Gallery models, set the authentication credentials. To do this, you will need the folder ID and the secret value of your created API key:

    import openai
            
            YANDEX_FOLDER_ID='<folder_ID>'
            YANDEX_API_KEY='<API_key_value>'
            
            client = openai.OpenAI(
                api_key=YANDEX_API_KEY,
                project=YANDEX_FOLDER_ID,
                base_url="https://ai.api.cloud.yandex.net/v1"
            )
            
    import OpenAI from "openai";
            
            const YANDEX_FOLDER_ID = '<folder_ID>';
            const YANDEX_API_KEY = '<API_key_value>';
            
            const openai = new OpenAI({
              apiKey: YANDEX_API_KEY,
              project: YANDEX_FOLDER_ID,
              baseURL:'https://ai.api.cloud.yandex.net/v1'});
            
    export YANDEX_FOLDER_ID='<folder_ID>'
            export YANDEX_API_KEY='<API_key_value>'
            
    package main
            
            import (
                "context"
                "github.com/openai/openai-go"
                "github.com/openai/openai-go/option"
            )
            
            const (
                YANDEX_FOLDER_ID = "<folder_ID>"
                YANDEX_API_KEY   = "<API_key_value>"
            )
            
            func main() {
                client := openai.NewClient(
                    option.WithAPIKey(YANDEX_API_KEY),
                    option.WithBaseURL("https://ai.api.cloud.yandex.net/v1"),
                )
            }
            
    export YANDEX_FOLDER_ID='<folder_ID>'
            export YANDEX_API_KEY='<API_key_value>'
            

Send a request to the model

Send a request to a model, e.g., to Alice AI LLM:

YANDEX_MODEL = "aliceai-llm"
        
        response = client.responses.create(
            model=f"gpt://{YANDEX_FOLDER_ID}/{YANDEX_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)
        
const response = await openai.responses.create({
          model: `gpt://${YANDEX_FOLDER_ID}/aliceai-llm`,
          input: 'Come up with three off-beat ideas for a travel startup.'
        });
        
        console.log(response.output_text);
        
curl \
          --request POST https://ai.api.cloud.yandex.net/v1/responses \
          --header "Authorization: Api-Key ${YANDEX_API_KEY}" \
          --header "Content-Type: application/json" \
          --data '{
            "modelUri": "gpt://'"${YANDEX_FOLDER_ID}"'/aliceai-llm",
            "temperature": 0.8,
            "max_output_tokens": 1500,
            "input": "Come up with three off-beat ideas for a travel startup."
          }'
        
package main
        
        import (
          "context"
          "fmt"
          "log"
        
          "github.com/openai/openai-go"
          "github.com/openai/openai-go/option"
        )
        
        const (
          YANDEX_FOLDER_ID = "<folder_ID>"
          YANDEX_API_KEY   = "<API_key_value>"
        )
        
        func main() {
          client := openai.NewClient(
            option.WithAPIKey(YANDEX_API_KEY),
            option.WithBaseURL("https://ai.api.cloud.yandex.net/v1"),
          )
        
          ctx := context.Background()
        
          resp, err := client.Chat.Completions.New(ctx, openai.ChatCompletionNewParams{
            Model: fmt.Sprintf("gpt://%s/aliceai-llm", YANDEX_FOLDER_ID),
            Messages: []openai.ChatCompletionMessageParamUnion{
              openai.UserMessage("Come up with three off-beat ideas for a travel startup."),
            },
            Temperature: openai.Float(0.8),
            MaxTokens:   openai.Int(1500),
          })
        
          if err != nil {
            log.Fatalf("Error requesting: %v", err)
          }
        
          fmt.Println(resp.Choices[0].Message.Content)
        }
        
import os
        from yandex_ai_studio_sdk import AIStudio
        
        YANDEX_API_KEY = os.environ["YANDEX_API_KEY"]
        YANDEX_FOLDER_ID = os.environ["YANDEX_FOLDER_ID"]
        
        sdk = AIStudio(
            folder_id=YANDEX_FOLDER_ID,
            auth=YANDEX_API_KEY,
        )
        
        model = sdk.models.completions("aliceai-llm")
        model = model.configure(temperature=0.8, max_tokens=1500)
        result = model.run("Come up with three off-beat ideas for a travel startup.")
        
        for alternative in result:
            print(alternative.text)
        

What's next