Chat and generation
Dialogue, summarization, rewriting. Conversation context is assembled and sent by your side — plan history storage in your application.
Developer Docs · GigaChat
5 steps from a key to the first validated answer: an OAuth exchange with an explicit scope, TLS with a trusted certificate instead of insecure flags, a model picked from your own catalog — then structured output, functions, files and streaming, with the error-handling habits a stable integration is built on.
Create a project in the developer account and obtain the authorization key. It is a token-exchange secret: keep it server-side and never embed it in client code.
One POST to the OAuth endpoint with an explicit scope returns a short-lived access token (the official reference states the lifetime — about 30 minutes at the time of writing). Cache it and refresh on expiry rather than exchanging per call.
Add the Russian trusted root certificate to your HTTP client's trust store. Certificate verification stays on — insecure flags have no place in production.
Request the model list with your token and pin the chosen name in configuration. Your catalog is the only authoritative list of what your account can use.
Send a request to the chat endpoint with the pinned model. If you expect structured output, validate it against your schema before use — a day-one rule, not a late optimization.
Dialogue, summarization, rewriting. Conversation context is assembled and sent by your side — plan history storage in your application.
JSON Schema describes the parameters; the model returns structured arguments. Schema validation on your side is a mandatory part of the contract.
Upload a file → get an identifier → attach it to a message. That is how document questions and image understanding work; check official limits for formats and sizes.
Server-sent events for responsive interfaces; image generation returns a file you download by its identifier.
You start from an Authorization Key issued in the developer account — it is a credential for the token exchange, not a reusable access token. Exchange it at the OAuth endpoint with an explicit scope (the official reference lists the exact values for personal, business and corporate access), receive a short-lived access token — about 30 minutes per the documentation at the time of writing; treat the official reference as authoritative — and cache it until shortly before expiry instead of exchanging on every request. Keep the key server-side and out of client code, logs and repositories.
The API endpoints present certificates issued by the Russian trusted root CA (the national certification authority), which most default trust stores do not include. The safe path is to add that root certificate to your HTTP client's trust store and keep TLS verification on. Disabling certificate verification 'to make it work' removes the protection TLS exists for — treat any snippet suggesting it as a bug.
Request the model catalog with your own token and choose from what your account actually offers — the catalog you see is the authoritative list for you. For how the vendor positions each model, read the official model overview rather than third-party tier lists; then pin the exact model name in configuration, re-check the catalog when you upgrade, and let the task — not the biggest available name — drive the choice.
Yes — you can describe functions with JSON Schema parameters, let the model decide when to call them, and get structured arguments back; the same mechanism is the reliable route to machine-readable output. Two habits make it production-grade: validate every returned object against your schema before acting on it, and never assume prose instructions alone will hold a format — the schema is the contract, the prompt is only a hint.
You upload a file through the files endpoint, get an identifier, and attach that identifier to a chat message — that is the route for document questions and for image understanding. Image generation runs through the same chat interface: the response references a generated file that you then download by its identifier. Check the official limits for supported formats and sizes before wiring uploads into a product flow.
Enable streaming to receive the answer as server-sent events for responsive interfaces, and read chunks until the stream's terminating [DONE] event rather than assuming a fixed shape for the last message. On errors, inspect the returned status and message: refresh an expired access token and retry once; otherwise re-check the Authorization Key or token, scope and required headers; rate-limit responses deserve backoff, not hammering; and every structured answer gets validated before use. Log request identifiers, never request contents with user data.
The primary source is the official GigaChat API documentation: models, prices, limits and formats move — verify there before you start and again before release. Official API overview.