Skip to content

DeepSeek

DeepSeek offers highly cost-effective AI models with strong reasoning capabilities, making it an excellent choice for budget-conscious usage.

  1. Get an API Key

    Visit platform.deepseek.com to create an account and generate an API key.

  2. Set Environment Variable

    Terminal window
    export DEEPSEEK_API_KEY=sk-...

    Or add to your .env file:

    DEEPSEEK_API_KEY=sk-...
  3. Configure Codemetry

    config/codemetry.php
    'ai' => [
    'enabled' => true,
    'engine' => 'deepseek',
    'model' => null, // Uses deepseek-flash by default
    ],
  4. Run Analysis

    Terminal window
    php artisan codemetry:analyze --days=7 --ai=1 --ai-engine=deepseek
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.

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:

Terminal window
CODEMETRY_AI_MODEL=deepseek-v4-pro php artisan codemetry:analyze --days=7 --ai=1 --ai-engine=deepseek

Or in configuration:

'ai' => [
'engine' => 'deepseek',
'model' => 'deepseek-v4-pro',
],

Codemetry checks for API keys in this order:

  1. CODEMETRY_AI_API_KEY — Unified key for any engine
  2. DEEPSEEK_API_KEY — DeepSeek-specific key
Terminal window
# Option 1: Unified
export CODEMETRY_AI_API_KEY=sk-...
# Option 2: Engine-specific
export DEEPSEEK_API_KEY=sk-...

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.

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.

Cause: API key is incorrect or expired.

Solution:

Cause: Network issues or API availability.

Solution:

  • Check your network connectivity
  • Retry after a few seconds
  • Check DeepSeek status page

Cause: API credit balance exhausted.

Solution:

  • Add credits to your DeepSeek account
  • Check usage in dashboard

Symptom: AI summaries seem less detailed or insightful.

Solution:

  • Try deepseek-v4-pro for better quality
  • Consider using a different engine for critical analyses
  • DeepSeek works well for routine use; use premium models for investigations