Installation
The DeepSeek client is included in the core Koog library. No additional dependencies required.Quick Start
Authentication
API Key Setup
Get your API key from DeepSeek Platform.Programmatic Configuration
Available Models
DeepSeek is based on OpenAI’s API format and supports similar model naming:Get Available Models
Code Examples
Basic Chat Completion
Code Generation
Function Calling
Structured Output
DeepSeek requires adding “JSON” to the prompt for structured output:Streaming Responses
Advanced Configuration
Custom Parameters
Tool Choice Control
Model Capabilities
| Model | Context | Features |
|---|---|---|
| deepseek-chat | 32K | Chat, tools, structured output |
| deepseek-coder | 32K | Code generation, tools |
Pricing
DeepSeek is known for competitive pricing. Check DeepSeek Pricing for current rates. Approximate costs (per 1M tokens):- Input: ~$0.14
- Output: ~$0.28
Best Practices
- Use deepseek-coder for code-related tasks
- Leverage structured outputs - DeepSeek handles JSON well
- Be specific in prompts - model responds better to detailed instructions
- Test thoroughly - quality can vary by task type
- Monitor costs - even though cheap, usage adds up
Advantages
- Cost-effective: Much cheaper than GPT-4/Claude
- Strong coding: Excellent for code generation and analysis
- Good quality: Competitive performance for many tasks
- OpenAI-compatible: Easy migration from OpenAI API
Limitations
- 32K context: Smaller than GPT-4/Claude (128K-400K)
- No embeddings: Use OpenAI/Google for embeddings
- No moderation: Implement custom content filtering
- No vision: Text-only (no image analysis)
- Newer provider: Less battle-tested than established providers
Use Cases
Ideal For:
- Code generation and review
- Technical documentation
- Cost-conscious production deployments
- High-volume applications
- Structured data extraction
Not Ideal For:
- Vision tasks (no image support)
- Very long documents (32K limit)
- Applications requiring embeddings
- Content moderation