{"id":21380,"library":"gigachat","title":"GigaChat Python Library","description":"Python library for GigaChat API by Sberbank. Current version 0.2.1, supports chat completions, embeddings, function calling, structured output (JSON schema), and streaming. Released regularly with minor updates.","status":"active","version":"0.2.1","language":"python","source_language":"en","source_url":"https://github.com/ai-forever/gigachat","tags":["gigachat","sberbank","llm","chat","api"],"install":[{"cmd":"pip install gigachat","lang":"bash","label":"latest release"}],"dependencies":[{"reason":"HTTP client for API calls","package":"httpx","optional":false},{"reason":"Data validation and serialization","package":"pydantic","optional":false}],"imports":[{"note":"Main client class for API interactions.","symbol":"GigaChat","correct":"from gigachat import GigaChat"},{"note":"Messages is a model class, not top-level.","wrong":"from gigachat import Messages","symbol":"Messages","correct":"from gigachat.models import Messages"},{"note":"ChatCompletion is a model, not directly in gigachat namespace.","wrong":"from gigachat import ChatCompletion","symbol":"ChatCompletion","correct":"from gigachat.models import ChatCompletion"}],"quickstart":{"code":"from gigachat import GigaChat\nimport os\n\n# Use environment variable for token (replace with your actual token)\ntoken = os.environ.get('GIGACHAT_TOKEN', '')\nwith GigaChat(credentials=token, verify_ssl_certs=False) as giga:\n    response = giga.chat(\"Hello, how are you?\")\n    print(response.choices[0].message.content)","lang":"python","description":"Initialize GigaChat client with token, send a chat message, and print the response."},"warnings":[{"fix":"Update to use httpx-based patterns. The client API remains the same.","message":"In v0.2.0, the synchronous client no longer uses 'requests' library; it uses 'httpx'. Code that relied on requests internals may break.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"If you use .dict() or .json() on models, ensure compatibility with Pydantic V2. Use .model_dump() instead of .dict() if needed.","message":"In v0.2.0, Pydantic V2 is used instead of V1. Models like Messages, ChatCompletion have changed their internal schema. Serialization with .dict() now returns a dict, not a Model instance.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Use message format: {'role': 'user', 'content': '...', 'user_id': '...'}","message":"The 'user' parameter in GigaChat().chat() is deprecated in favor of passing user_id in the message dict.","severity":"deprecated","affected_versions":">=0.1.40"},{"fix":"Instantiate with GigaChat(credentials=..., verify_ssl_certs=True)","message":"The client defaults to verify_ssl_certs=False. For production, set verify_ssl_certs=True to avoid security warnings.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Upgrade gigachat: pip install --upgrade gigachat","cause":"Older versions (pre 0.1.30) used a different import path.","error":"ImportError: cannot import name 'GigaChat' from 'gigachat'"},{"fix":"Ensure you provide a valid token as the 'credentials' parameter or set the GIGACHAT_TOKEN environment variable.","cause":"Invalid or missing credentials token.","error":"gigachat.exceptions.AuthenticationError: ..."},{"fix":"Replace .dict() with .model_dump() for Pydantic models.","cause":"Pydantic V2 removed .dict() for models; use .model_dump() instead.","error":"AttributeError: 'Messages' object has no attribute 'dict'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}