Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

add expires_at check to gigachat authenticator

KnyazSh4fc3e2e06441
diff --git a/litellm/llms/gigachat/authenticator.py b/litellm/llms/gigachat/authenticator.py
index 5418b3bcb8f..6c6a3d58b46 100644
--- a/litellm/llms/gigachat/authenticator.py
+++ b/litellm/llms/gigachat/authenticator.py
@@ -112,12 +112,13 @@ def get_access_token(
# Request new token
token, expires_at = _request_token_sync(credentials, scope, auth_url)
- # Cache token
- ttl_seconds = max(
- 0, (expires_at - TOKEN_EXPIRY_BUFFER_MS - time.time() * 1000) / 1000
- )
- if ttl_seconds > 0:
- _token_cache.set_cache(cache_key, (token, expires_at), ttl=ttl_seconds)
+ if expires_at:
+ # Cache token
+ ttl_seconds = max(
+ 0, (expires_at - TOKEN_EXPIRY_BUFFER_MS - time.time() * 1000) / 1000
+ )
+ if ttl_seconds > 0:
+ _token_cache.set_cache(cache_key, (token, expires_at), ttl=ttl_seconds)
return token