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]

test fixes mock tests

Ishaan Jafferd6271ceefbd5
diff --git a/litellm/llms/xai/responses/transformation.py b/litellm/llms/xai/responses/transformation.py
index bd422c8d81e..5bb6c9a9559 100644
--- a/litellm/llms/xai/responses/transformation.py
+++ b/litellm/llms/xai/responses/transformation.py
@@ -1,6 +1,5 @@
from typing import TYPE_CHECKING, Any, Dict, List, Optional
-import litellm
from litellm._logging import verbose_logger
from litellm.llms.openai.responses.transformation import OpenAIResponsesAPIConfig
from litellm.secret_managers.main import get_secret_str
@@ -102,6 +101,8 @@ class XAIResponsesAPIConfig(OpenAIResponsesAPIConfig):
Uses XAI_API_KEY from environment or litellm_params.
"""
+ import litellm
+
litellm_params = litellm_params or GenericLiteLLMParams()
api_key = (
litellm_params.api_key
@@ -132,6 +133,8 @@ class XAIResponsesAPIConfig(OpenAIResponsesAPIConfig):
Returns:
str: The full URL for the XAI /responses endpoint
"""
+ import litellm
+
api_base = (
api_base
or litellm.api_base