Overview
DeepSeek provides specialized LLMs optimized for coding and general chat. The provider extends OpenAI’s interface with DeepSeek’s API endpoints and supports 128K context windows.Installation
Basic Usage
Constructor Options
DeepSeekModelName
default:"deepseek-coder"
DeepSeek model name:
"deepseek-coder" or "deepseek-chat"string
DeepSeek API key (defaults to
DEEPSEEK_API_KEY env variable)number
Sampling temperature
number
Maximum tokens in response
number
Nucleus sampling parameter
object
Additional OpenAI client options (e.g., custom baseURL)
Supported Models
DeepSeek Coder
- Context: 128K tokens
- Optimized for: Code generation, completion, debugging
- Use cases: Writing code, explaining code, refactoring
DeepSeek Chat
- Context: 128K tokens
- Optimized for: General conversation, reasoning
- Use cases: Q&A, analysis, creative writing
Streaming
Function Calling
DeepSeek supports function calling (tool use):Code Generation
Code Explanation
With LlamaIndex
Convenience Function
Configuration
Environment Variables
Custom Base URL
https://api.deepseek.com/v1
Global Settings
Model Selection Guide
Long Context Support
Both models support 128K context windows:Error Handling
Tool Calling Support
Check if tool calling is supported:Best Practices
- Use deepseek-coder for code: Better results for programming tasks
- Use deepseek-chat for general: Better for non-code tasks
- Leverage long context: Use full 128K for large codebases
- Provide context: Include relevant code snippets
- Use system messages: Guide the model’s behavior
- Enable streaming: Better UX for long generations