# Task ID: 31 **Title:** Add DeepSeek API LLM provider **Status:** done **Dependencies:** 25 ✓ **Priority:** medium **Description:** Implement DeepSeek API provider as a cheap cloud-based fallback when local LLMs are unavailable. **Details:** 1. Create `src/mcplocal/src/providers/deepseek.ts`: ```typescript export class DeepSeekProvider implements LlmProvider { readonly name = 'deepseek'; private apiKey: string; private baseUrl = 'https://api.deepseek.com/v1'; constructor(config: DeepSeekConfig) { this.apiKey = config.apiKey || process.env.DEEPSEEK_API_KEY; } async isAvailable(): Promise { return !!this.apiKey; } async complete(options: CompletionOptions): Promise { // DeepSeek uses OpenAI-compatible API const response = await fetch(`${this.baseUrl}/chat/completions`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'deepseek-chat', messages: [{ role: 'user', content: options.userPrompt }] }) }); // Parse and return } } ``` 2. Add DEEPSEEK_API_KEY to configuration 3. Register in provider registry with medium priority 4. Support both deepseek-chat and deepseek-coder models 5. Add rate limiting handling **Test Strategy:** 1. Unit test: Provider correctly checks API key availability 2. Unit test: Request formatting matches DeepSeek API spec 3. Unit test: Response parsing handles all fields 4. Integration test: Full completion with actual API (with valid key) 5. Test error handling for rate limits 6. Test error handling for invalid API key