Authentication with the Yandex Cloud AI Studio API
To use the Yandex Cloud AI Studio API, you need to get authenticated:
-
Get an IAM token for a Yandex account, federated account, or local account.
-
Get the ID of the folder for which your account has at least the minimum role for the functionality:
ai.languageModels.useror higher: For text generation models.ai.imageGeneration.useror higher: For YandexART.ai.assistants.editorandai.languageModels.useror higher: For Responses API.ai.models.useror higher: For Realtime API.serverless.mcpGateways.editoror higher: To manage MCP servers.
You will need the folder ID to get the model's URI.
-
When accessing AI Studio via the API, specify the IAM token in the
Authorizationheader of each request:Authorization: Bearer <IAM_token>
To access AI Studio, your service account needs at least the minimum required role:
ai.languageModels.useror higher: For text generation models.ai.imageGeneration.useror higher: For YandexART.ai.assistants.editorandai.languageModels.useror higher: For Responses API.ai.models.useror higher: For Realtime API.serverless.mcpGateways.editoror higher: To manage MCP servers. The MCP Hub API supports only IAM token authentication.
The AI Studio APIs support two service account authentication methods:
-
With an IAM token:
-
Provide the IAM token in the
Authorizationheader in the following format:Authorization: Bearer <IAM_token>
-
With API keys.
Use API keys if requesting an IAM token automatically is not an option.
-
Provide the API key in the
Authorizationheader in the following format:Authorization: Api-Key <API_key>
Do not specify the folder ID in your request headers, as the service uses the folder the service account was created in. However, you will need the parent folder ID to get the model's URI.