Integrating the Qwen3 model into Visual Studio Code
You can facilitate software development in Visual Studio Code
In this tutorial, you will integrate the Qwen3-235B-A22B model into your Visual Studio Code IDE with the help of Yandex AI Studio and the Roo Code
To use Qwen3-235B-A22B as your Visual Studio Code assistant, proceed as followings:
- Set up your infrastructure.
- Create an API key for the service account.
- Connect to the model.
- Test the model.
The infrastructure support fee for connecting Qwen3-235B-A22B from Visual Studio Code includes a text generation fee (see Yandex AI Studio pricing).
Set up the infrastructure
Create a folder
- In the management console
, select a cloud and click Create folder. - Name your folder, e.g.,
aistudio. - Click Create.
Create a service account
You will need this service account to get an API key.
- Navigate to
aistudio. - In the list of services, select Identity and Access Management.
- Click Create service account.
- Enter a name for the service account, e.g.,
qwen-user. - Click Add role and assign the
ai.languageModels.userrole to this service account. - Click Create.
Create an API key for the service account
You need to create an API key for Visual Studio Code to be able to access the model.
- In the management console
, navigate toaistudio. - In the list of services, select Identity and Access Management.
- In the left-hand panel, select
Service accounts. - In the list that opens, select
qwen-user. - In the top panel, click
Create new key and select Create API key. - In the Scope field, select
yc.ai.languageModels.execute. - Click Create.
- Save the ID and secret key.
Connect to the model
- Install the Roo Code
extension in Visual Studio Code. - Click Roo Code in VSC left-hand panel.
- In the window that opens, select OpenAI Compatible in the API Provider field.
- In the Base URL field, specify
https://llm.api.cloud.yandex.net/v1. - In the API-key field, paste the secret key value you got in the previous step.
- In the Model field, specify
gpt://<folder_ID>/qwen3-235b-a22b-fp8/latest, where<folder_ID>stands for theaistudiofolder ID. - Click Go!.
Test the model
As an example, let's ask Qwen to generate a script to access an AI model via the OpenAI SDK.
-
Click Roo Code in Visual Studio Code left-hand panel.
-
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 endpointResult:
import sys from openai import OpenAI def main(): if len(sys.argv) != 4: print("Usage: python test.py <token> <model_id> <folder_id>") return token = sys.argv[1] model_id = sys.argv[2] folder_id = sys.argv[3] client = OpenAI( base_url="https://llm.api.cloud.yandex.net/v1", api_key=token, project=folder_id ) 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()