Coverage for .venv/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/openai_passthrough_endpoints.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 12:01 +0000

1"""/openai_passthrough must be matched ahead of the native /{provider}/v1/files and 

2/{provider}/v1/batches routes, so unlike the other provider passthrough routes it is 

3registered at startup and defers to the lazily loaded handler per call.""" 

4 

5from typing import Final 

6 

7from fastapi import APIRouter, Depends, Request, Response 

8 

9from litellm.proxy._types import UserAPIKeyAuth 

10from litellm.proxy.auth.user_api_key_auth import user_api_key_auth 

11 

12router: Final = APIRouter() 

13 

14 

15@router.api_route( 

16 "/openai_passthrough/{endpoint:path}", 

17 methods=["GET", "POST", "PUT", "DELETE", "PATCH"], 

18 tags=["OpenAI Pass-through", "pass-through"], 

19) 

20async def openai_passthrough_route( 

21 endpoint: str, 

22 request: Request, 

23 fastapi_response: Response, 

24 user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), 

25) -> Response: 

26 """ 

27 Dedicated pass-through to the OpenAI API with no overlap with LiteLLM's native 

28 implementations (e.g. the Responses API at /v1/responses). 

29 

30 Examples: 

31 - /openai_passthrough/v1/responses 

32 - /openai_passthrough/v1/responses/{response_id} 

33 - /openai_passthrough/v1/responses/{response_id}/input_items 

34 

35 [Docs](https://docs.litellm.ai/docs/pass_through/openai_passthrough) 

36 """ 

37 from litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints import openai_proxy_route 

38 

39 return await openai_proxy_route( 

40 endpoint=endpoint, 

41 request=request, 

42 fastapi_response=fastapi_response, 

43 user_api_key_dict=user_api_key_dict, 

44 )