From 03919891e4c6b7e951772b1d0035d06b4a0f47c3 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 3 Feb 2026 16:33:30 -0800 Subject: [PATCH] refactor: XAI_API_BASE --- litellm/constants.py | 3 +++ litellm/llms/xai/chat/transformation.py | 3 +-- litellm/llms/xai/responses/transformation.py | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/litellm/constants.py b/litellm/constants.py index 6427c367924..444e78f8ed4 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -99,6 +99,9 @@ DEFAULT_REASONING_EFFORT_MINIMAL_THINKING_BUDGET = int( os.getenv("DEFAULT_REASONING_EFFORT_MINIMAL_THINKING_BUDGET", 128) ) +# Provider-specific API base URLs +XAI_API_BASE = "https://api.x.ai/v1" + DEFAULT_REASONING_EFFORT_LOW_THINKING_BUDGET = int( os.getenv("DEFAULT_REASONING_EFFORT_LOW_THINKING_BUDGET", 1024) ) diff --git a/litellm/llms/xai/chat/transformation.py b/litellm/llms/xai/chat/transformation.py index 245e10e45c1..21782fc6fbf 100644 --- a/litellm/llms/xai/chat/transformation.py +++ b/litellm/llms/xai/chat/transformation.py @@ -4,6 +4,7 @@ import httpx import litellm from litellm._logging import verbose_logger +from litellm.constants import XAI_API_BASE from litellm.litellm_core_utils.prompt_templates.common_utils import ( filter_value_from_dict, strip_name_from_messages, @@ -14,8 +15,6 @@ from litellm.types.utils import Choices, ModelResponse, Usage, PromptTokensDetai from ...openai.chat.gpt_transformation import OpenAIGPTConfig -XAI_API_BASE = "https://api.x.ai/v1" - class XAIChatConfig(OpenAIGPTConfig): @property diff --git a/litellm/llms/xai/responses/transformation.py b/litellm/llms/xai/responses/transformation.py index 82b4771fb4d..95873aab846 100644 --- a/litellm/llms/xai/responses/transformation.py +++ b/litellm/llms/xai/responses/transformation.py @@ -2,6 +2,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union import litellm from litellm._logging import verbose_logger +from litellm.constants import XAI_API_BASE from litellm.llms.openai.responses.transformation import OpenAIResponsesAPIConfig from litellm.secret_managers.main import get_secret_str from litellm.types.llms.openai import ResponsesAPIOptionalRequestParams @@ -16,8 +17,6 @@ if TYPE_CHECKING: else: LiteLLMLoggingObj = Any -XAI_API_BASE = "https://api.x.ai/v1" - class XAIResponsesAPIConfig(OpenAIResponsesAPIConfig): """