DeepSeek
DeepSeek offers highly cost-effective AI models with strong reasoning capabilities, making it an excellent choice for budget-conscious usage.
-
Get an API Key
Visit platform.deepseek.com to create an account and generate an API key.
-
Set Environment Variable
Terminal window export DEEPSEEK_API_KEY=sk-...Or add to your
.envfile:DEEPSEEK_API_KEY=sk-... -
Configure Codemetry
config/codemetry.php 'ai' => ['enabled' => true,'engine' => 'deepseek','model' => null, // Uses deepseek-flash by default], -
Run Analysis
Terminal window php artisan codemetry:analyze --days=7 --ai=1 --ai-engine=deepseek
Available Models
Section titled “Available Models”| Model | Default | Cost | Quality | Speed |
|---|---|---|---|---|
deepseek-flash |
✓ | Very Low | Good | Fast |
deepseek-v4-pro |
Low | Better | Medium |
DeepSeek retires models regularly. If a model on this page stops working, check the provider’s model list and set a current one.
Choosing a Model
Section titled “Choosing a Model”For routine analysis: Use deepseek-flash (default)
- Extremely cost-effective and fast
Alternative: Use deepseek-v4-pro
- DeepSeek’s advanced reasoning model, still inexpensive
There is no --ai-model flag. To override the model for a single run, set CODEMETRY_AI_MODEL:
CODEMETRY_AI_MODEL=deepseek-v4-pro php artisan codemetry:analyze --days=7 --ai=1 --ai-engine=deepseekOr in configuration:
'ai' => [ 'engine' => 'deepseek', 'model' => 'deepseek-v4-pro',],API Key Options
Section titled “API Key Options”Codemetry checks for API keys in this order:
CODEMETRY_AI_API_KEY— Unified key for any engineDEEPSEEK_API_KEY— DeepSeek-specific key
# Option 1: Unifiedexport CODEMETRY_AI_API_KEY=sk-...
# Option 2: Engine-specificexport DEEPSEEK_API_KEY=sk-...Cost Management
Section titled “Cost Management”DeepSeek charges per token. Codemetry sends minimal data:
- ~500-1000 input tokens per day analyzed
- ~200-500 output tokens per summary
Prices change often, so check DeepSeek pricing for current per-token rates.
Why Choose DeepSeek?
Section titled “Why Choose DeepSeek?”Advantages:
- Extremely low cost
- Good quality for structured tasks
- Fast response times
- OpenAI-compatible API format
Considerations:
- Newer provider, less established
- May have occasional availability issues
- Quality can vary compared to premium models
For Codemetry’s use case (explaining structured metrics), DeepSeek performs very well at a fraction of the cost.
Troubleshooting
Section titled “Troubleshooting”“Invalid API key”
Section titled ““Invalid API key””Cause: API key is incorrect or expired.
Solution:
- Verify key at platform.deepseek.com
- Check for typos
- Regenerate key if needed
“Connection timeout”
Section titled ““Connection timeout””Cause: Network issues or API availability.
Solution:
- Check your network connectivity
- Retry after a few seconds
- Check DeepSeek status page
“Insufficient balance”
Section titled ““Insufficient balance””Cause: API credit balance exhausted.
Solution:
- Add credits to your DeepSeek account
- Check usage in dashboard
Lower Quality Responses
Section titled “Lower Quality Responses”Symptom: AI summaries seem less detailed or insightful.
Solution:
- Try
deepseek-v4-profor better quality - Consider using a different engine for critical analyses
- DeepSeek works well for routine use; use premium models for investigations