Skip to content

Connecting GigaChat

This guide explains how to configure GigaChat as an AI provider for TG Support Bot.

TIP

Before proceeding, make sure the AI assistant is enabled by following the base integration guide.

Getting an API Key

  1. Log in to your GigaChat account.
  2. Navigate to the API Settings section.
  3. Copy the Client ID and Authorization key — you will need them in the next step.
GigaChat API Settings page

Obtaining the Ministry of Digital Development Certificate

Requests to GigaChat require a security certificate issued by the Russian Ministry of Digital Development. Follow the instructions in the official documentation: GigaChat Certificates.

Once downloaded, place the .crt file in the storage/certs directory.

Configuring .env Parameters

Add or update the following variables in your .env file:

env
GIGACHAT_CLIENT_SECRET=your_authorization_key
GIGACHAT_BASE_URL=https://gigachat.devices.sberbank.ru/api/v1
GIGACHAT_CLIENT_ID=your_client_id
GIGACHAT_MODEL=GigaChat-2-Max
GIGACHAT_MAX_TOKENS=1000
GIGACHAT_TEMPERATURE=0.7
GIGACHAT_CERT_PATH="certs/russian_trusted_root_ca_pem.crt"
VariableDescription
GIGACHAT_CLIENT_SECRETAuthorization key from your GigaChat account
GIGACHAT_BASE_URLAPI base URL — always https://gigachat.devices.sberbank.ru/api/v1
GIGACHAT_CLIENT_IDClient ID from your GigaChat account
GIGACHAT_MODELModel to use (currently GigaChat-2-Max is available)
GIGACHAT_MAX_TOKENSMaximum number of tokens in a single response
GIGACHAT_TEMPERATURECreativity level: 0 — deterministic, 1 — highly creative
GIGACHAT_CERT_PATHPath to the certificate file relative to the storage directory (e.g. certs/russian_trusted_root_ca_pem.crt)

Enabling GigaChat

Set GigaChat as the default provider in your .env file:

env
AI_ENABLED=true
AI_DEFAULT_PROVIDER=gigachat

Released under the MIT License.