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
    • About Yandex AI Studio
    • Yandex Workflows
    • Quotas and limits
    • Terms and definitions
  • Compatibility with OpenAI
    • All tutorials
    • Implementing an AI assistant with search capabilities for PDF files with complex formatting
    • Model tuning in DataSphere
    • Creating an AI agent with Yandex Cloud Functions
    • Integrating generative models in Visual Studio Code
    • Creating an AI assistant for Telegram
    • Developing a Telegram bot with AI agent support using Yandex Workflows
    • AI-powered review of GitHub pull requests with Yandex Workflows and GitHub Actions
  • Access management
  • Pricing policy
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Set up the infrastructure
  • Create a folder
  • Create a service account
  • Create an API key for the service account
  • Connect to the model
  • Test the model
  1. Tutorials
  2. Integrating generative models in Visual Studio Code

Integrating generative models in Visual Studio Code

Written by
Yandex Cloud
Updated at November 26, 2025
  • Set up the infrastructure
    • Create a folder
    • Create a service account
  • Create an API key for the service account
  • Connect to the model
  • Test the model

You can facilitate software development in Visual Studio Code with Qwen3-235B-A22B, GPT-OSS-120b, and other models. The models can generate code, convert it to other programming languages, help you with debugging and error detection in code, analyze data, write documentation, and more.

In this tutorial, you will integrate the models into your Visual Studio Code with the help of Yandex AI Studio and the SourceCraft Code Assistant or Roo Code extension.

Note

The Roo Code extension is only available in Visual Studio Code.

To use models as an assistant in the code editor:

  1. Set up the infrastructure.
  2. Create an API key for the service account.
  3. Connect to the model.
  4. Test the model.

The infrastructure support fee for connecting to the model from the code editor includes a text generation fee (see the Yandex AI Studio pricing).

Set up the infrastructureSet up the infrastructure

Create a folderCreate a folder

Management console
  1. In the management console, select a cloud and click Create folder.
  2. Name your folder, e.g., aistudio.
  3. Click Create.

Create a service accountCreate a service account

You will need this service account to get an API key.

Management console
  1. Navigate to aistudio.
  2. In the list of services, select Identity and Access Management.
  3. Click Create service account.
  4. Enter a name for the service account, e.g., ai-model-user.
  5. Click Add role and assign the ai.languageModels.user role to the service account.
  6. Click Create.

Create an API key for the service accountCreate an API key for the service account

To enable the code editor to access the model, create an API key.

Management console
  1. In the management console, navigate to aistudio.
  2. In the list of services, select Identity and Access Management.
  3. In the left-hand panel, select Service accounts.
  4. In the list that opens, select ai-model-user.
  5. In the top panel, click Create new key and select Create API key.
  6. In the Scope field, select yc.ai.languageModels.execute.
  7. Click Create.
  8. Save the ID and secret key.

Connect to the modelConnect to the model

Visual Studio Code
  1. Install the SourceCraft Code Assistant or Roo Code extension.

  2. Configure the extension:

    SourceCraft Code Assistant
    1. Click SourceCraft Code Assistant in the program's left-hand panel.

    2. Click Select API configuration at the bottom of the chat window and click Yandex Cloud AI Studio.

    3. In the settings window that opens, make sure the OpenAI Compatible option is selected in the API provider field and the Base URL field is set to https://llm.api.cloud.yandex.net/v1, and close the settings window.

    4. Click Select API configuration at the bottom of the chat window and click Add model.

    5. In the window that opens, enter a name for the profile and click Create profile.

    6. In the settings window that opens, select OpenAI Compatible in the API provider field.

    7. In the Base URL field, specify https://llm.api.cloud.yandex.net/v1.

    8. In the OpenAI API-key field, paste the secret key value you got in the previous step.

    9. In the Model field, specify the model URI in gpt://<folder_ID>/<model_ID>/latest format, where:

      • <folder_ID>: aistudio folder ID.
      • <model_ID>: Model ID. For example: qwen3-235b-a22b-fp8 or gpt-oss-120b.

      Note

      The selected model will be used only for the assistant. The SourceCraft Code Assistant autocompletion feature will continue using the default model.

    Roo Code
    1. Click Roo Code in VSC left-hand panel.

    2. In the window that opens, select OpenAI Compatible in the API Provider field.

    3. In the Base URL field, specify https://llm.api.cloud.yandex.net/v1.

    4. In the API-key field, paste the secret key value you got in the previous step.

    5. In the Model field, specify the model URI in gpt://<folder_ID>/<model_ID>/latest format, where:

      • <folder_ID>: aistudio folder ID.
      • <model_ID>: Model ID. For example: qwen3-235b-a22b-fp8 or gpt-oss-120b.
    6. Click Go!.

Test the modelTest the model

As an example, let's ask Qwen to generate a script to access an AI model via the OpenAI SDK.

Visual Studio Code
SourceCraft Code Assistant
  1. In the left-hand panel, click SourceCraft Code Assistant.

  2. At the bottom of the screen in the assistant chat window, enter your prompt and click Send Message:

    Write a script named `test.py` to make a streaming call to generate a poem about Yandex Cloud via the Python OpenAI SDK. Use model token and ID as parameters. Use `https://llm.api.cloud.yandex.net/v1` as the endpoint
    

    Result:

    import sys
    from openai import OpenAI
    
    def main():
        if len(sys.argv) != 3:
            print("Usage: python test.py <token> <model_id>")
            return
    
        token = sys.argv[1]
        model_id = sys.argv[2]
    
        client = OpenAI(
            base_url="https://llm.api.cloud.yandex.net/v1",
            api_key=token
        )
    
        stream = client.chat.completions.create(
            model=model_id,
            messages=[
                {"role": "user", "content": "Write a poem about Yandex Cloud"}
            ],
            stream=True
        )
    
        for chunk in stream:
            content = chunk.choices[0].delta.content
            if content:
                print(content, end="")
    
    if __name__ == "__main__":
        main()
    
Roo Code
  1. Click Roo Code on the left-hand panel.

  2. In the window that opens, enter your prompt in the input field below and click Send message:

    Write a script named `test.py` to make a streaming call to generate a poem about Yandex Cloud via the Python OpenAI SDK. Use model token and ID as parameters. Use `https://llm.api.cloud.yandex.net/v1` as the endpoint
    

    Result:

    import sys
    from openai import OpenAI
    
    def main():
        if len(sys.argv) != 3:
            print("Usage: python test.py <token> <model_id>")
            return
    
        token = sys.argv[1]
        model_id = sys.argv[2]
    
        client = OpenAI(
            base_url="https://llm.api.cloud.yandex.net/v1",
            api_key=token
        )
    
        stream = client.chat.completions.create(
            model=model_id,
            messages=[
                {"role": "user", "content": "Write a poem about Yandex Cloud"}
            ],
            stream=True
        )
    
        for chunk in stream:
            content = chunk.choices[0].delta.content
            if content:
                print(content, end="")
    
    if __name__ == "__main__":
        main()
    

Was the article helpful?

Previous
Creating an AI agent with Yandex Cloud Functions
Next
Creating an AI assistant for Telegram
© 2025 Direct Cursus Technology L.L.C.