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]

feat: add Asia/Bangkok timezone support for budget resets - Add Asia/Bangkok (UTC+7) to timezone_map in duration_parser.py - Update documentation to include Bangkok in common timezone values - Add test case to verify Bangkok timezone functionality

Michael Tan6721189b7cbb
diff --git a/docs/my-website/docs/proxy/budget_reset_and_tz.md b/docs/my-website/docs/proxy/budget_reset_and_tz.md
index 541ff6a2f0a..340e33afe18 100644
--- a/docs/my-website/docs/proxy/budget_reset_and_tz.md
+++ b/docs/my-website/docs/proxy/budget_reset_and_tz.md
@@ -29,5 +29,6 @@ Common timezone values:
- `US/Pacific` - Pacific Time
- `Europe/London` - UK Time
- `Asia/Kolkata` - Indian Standard Time (IST)
+- `Asia/Bangkok` - Indochina Time (ICT)
- `Asia/Tokyo` - Japan Standard Time
- `Australia/Sydney` - Australian Eastern Time
diff --git a/litellm/litellm_core_utils/duration_parser.py b/litellm/litellm_core_utils/duration_parser.py
index 08e5323c30c..9a317cfcf0d 100644
--- a/litellm/litellm_core_utils/duration_parser.py
+++ b/litellm/litellm_core_utils/duration_parser.py
@@ -158,6 +158,7 @@ def _setup_timezone(
"US/Eastern": timezone(timedelta(hours=-4)), # EDT
"US/Pacific": timezone(timedelta(hours=-7)), # PDT
"Asia/Kolkata": timezone(timedelta(hours=5, minutes=30)), # IST
+ "Asia/Bangkok": timezone(timedelta(hours=7)), # ICT (Indochina Time)
"Europe/London": timezone(timedelta(hours=1)), # BST
"UTC": timezone.utc,
}
diff --git a/tests/test_litellm/litellm_core_utils/test_duration_parser.py b/tests/test_litellm/litellm_core_utils/test_duration_parser.py
index b6e73dab6bc..cebad07c07a 100644
--- a/tests/test_litellm/litellm_core_utils/test_duration_parser.py
+++ b/tests/test_litellm/litellm_core_utils/test_duration_parser.py
@@ -88,6 +88,12 @@ class TestStandardizedResetTime(unittest.TestCase):
)
self.assertEqual(london_result, london_expected)
+ # Test Bangkok timezone (UTC+7): 5:30 AM next day, so next reset is midnight the day after
+ bangkok = ZoneInfo("Asia/Bangkok")
+ bangkok_expected = datetime(2023, 5, 17, 0, 0, 0, tzinfo=bangkok)
+ bangkok_result = get_next_standardized_reset_time("1d", base_time, "Asia/Bangkok")
+ self.assertEqual(bangkok_result, bangkok_expected)
+
def test_edge_cases(self):
"""Test edge cases and boundary conditions"""
# Exactly on hour boundary