feat: Implement OpenAI Conversations API endpoints #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the OpenAI Conversations API endpoints in LiteLLM, resolving the 404 error when calling
client.conversations.create().Fixes: BerriAI#15296
Changes
Type Definitions (
litellm/types/llms/openai.py)Conversation,ConversationItem,ConversationContentItemTypedDictsConversationCreateParams,ConversationUpdateParams,ConversationDeletedResourceConversationItemCreateParams,ConversationItemListParams,ConversationItemListOpenAI Provider Implementation (
litellm/llms/openai/conversations.py)OpenAIConversationsAPIclass with sync and async methodsCore Module (
litellm/conversations/main.py)litellm.acreate_conversation(), etc.Router Integration (
litellm/router.py)Proxy Endpoints (
litellm/proxy/conversation_endpoints/)POST /v1/conversations- Create conversationGET /v1/conversations/{id}- Get conversationPOST /v1/conversations/{id}- Update conversationDELETE /v1/conversations/{id}- Delete conversationPOST /v1/conversations/{id}/items- Create itemGET /v1/conversations/{id}/items- List itemsGET /v1/conversations/{id}/items/{item_id}- Get itemDELETE /v1/conversations/{id}/items/{item_id}- Delete itemAll endpoints support
/v1/,/, and/openai/v1/prefixes.Route Mapping
ROUTE_ENDPOINT_MAPPINGwith conversation routescommon_request_processing.pyTests (
tests/local_testing/test_conversations_api.py)Background
The Conversations API is part of OpenAI's new Responses API ecosystem, which is replacing the Assistants API (deprecated mid-2026). It provides stateful multi-turn conversation management.
Testing
All 6 unit tests pass:
Commits
feat(conversations): add type definitions for Conversations APIfeat(conversations): add OpenAI provider implementationfeat(conversations): add core conversations modulefeat(conversations): export conversation functions from litellmfeat(conversations): add router methods for conversationsfeat(conversations): add route types for proxy endpointsfeat(conversations): add proxy server endpointstest(conversations): add unit tests for Conversations API