Unify DeepChat's low-level LLM request pipeline on Vercel AI SDK while keeping the upper-layer contracts unchanged:
BaseLLMProviderLLMProviderPresenterLLMCoreStreamEvent- existing provider IDs, model configs, and conversation history
The AI SDK runtime becomes the default implementation. A hidden runtime switch keeps legacy available as a rollback path.
- No functional regression in text streaming, reasoning streaming, tool call streaming, image output, prompt cache, proxy handling, request tracing, routing, and embeddings.
LLMCoreStreamEventevent names, field names, and stop reasons remain unchanged.- Existing
function_call_recordhistory must stay reusable across providers and across runtime switches. - Existing provider list / model list / provider check / key status responsibilities remain in provider classes.
- Default:
ai-sdk - Hidden fallback:
legacy - Resolution order:
DEEPCHAT_LLM_RUNTIME- config setting
llmRuntimeMode - default
ai-sdk
Shared runtime under src/main/presenter/llmProviderPresenter/aiSdk/ provides:
- provider factory
- model / message mapper
- MCP tool mapper
- streaming adapter
- image runtime
- embedding runtime
- provider-options mapper
- reasoning middleware
- legacy function-call compatibility middleware
Phase 1:
OpenAICompatibleProviderOpenAIResponsesProvider- all
extends OpenAICompatibleProviderproviders
Phase 2:
AnthropicProviderGeminiProviderVertexProviderAwsBedrockProviderOllamaProvider
Phase 3:
NewApiProviderZenmuxProvider
Out of scope for first unification pass:
AcpProviderVoiceAIProvider
- pure text
- reasoning native
- reasoning via
<think> - native tool streaming
- legacy
<function_call>fallback - multi-tool history replay
- image input
- image output
- usage mapping
- prompt cache mapping
- proxy / trace / abort
- embeddings
- hidden rollback path
- AI SDK runtime passes the provider regression matrix
- rollback path remains unused for at least one release cycle
- duplicated legacy stream parsers / tool parsers have no remaining callers