Skip to content

Available Models

DeepSeek offers a range of specialized AI models optimized for different tasks and use cases.

Model Overview

ModelContext LengthStrengthsBest For
deepseek-chat32K tokensGeneral conversation, reasoningChatbots, Q&A, general AI tasks
deepseek-coder16K tokensCode generation, debuggingProgramming assistance, code review
deepseek-math8K tokensMathematical reasoningMath problems, calculations

DeepSeek Chat

Model Details

  • Model ID: deepseek-chat
  • Context Length: 32,768 tokens
  • Training Data: Diverse text from web, books, and curated sources
  • Capabilities: General conversation, reasoning, analysis, creative writing

Strengths

  • Conversational AI: Natural, engaging dialogue
  • Reasoning: Complex problem-solving and analysis
  • Multilingual: Support for multiple languages
  • Knowledge: Broad knowledge across domains
  • Safety: Built-in safety measures and content filtering

Use Cases

  • Customer service chatbots
  • Virtual assistants
  • Content generation
  • Question answering
  • Educational tutoring
  • Creative writing assistance

Example Usage

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.deepseek.com/v1"
)

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum computing in simple terms."}
    ],
    temperature=0.7,
    max_tokens=500
)

print(response.choices[0].message.content)

Performance Characteristics

  • Latency: ~1-3 seconds for typical responses
  • Throughput: High concurrent request handling
  • Quality: State-of-the-art response quality
  • Consistency: Reliable performance across different prompts

DeepSeek Coder

Model Details

  • Model ID: deepseek-coder
  • Context Length: 16,384 tokens
  • Training Data: Code repositories, documentation, programming resources
  • Capabilities: Code generation, debugging, explanation, optimization

Strengths

  • Multi-language Support: Python, JavaScript, Java, C++, Go, Rust, and more
  • Code Understanding: Analyze and explain existing code
  • Bug Detection: Identify and fix programming errors
  • Optimization: Suggest performance improvements
  • Documentation: Generate code comments and documentation

Supported Languages

  • Python
  • JavaScript/TypeScript
  • Java
  • C/C++
  • Go
  • Rust
  • PHP
  • Ruby
  • Swift
  • Kotlin
  • And many more...

Use Cases

  • Code generation and completion
  • Bug fixing and debugging
  • Code review and optimization
  • API integration assistance
  • Algorithm implementation
  • Documentation generation

Example Usage

python
response = client.chat.completions.create(
    model="deepseek-coder",
    messages=[
        {
            "role": "user", 
            "content": "Write a Python function to find the longest common subsequence of two strings."
        }
    ],
    temperature=0.2,  # Lower temperature for more deterministic code
    max_tokens=800
)

print(response.choices[0].message.content)

Code Generation Best Practices

  1. Be specific: Provide clear requirements and constraints
  2. Include context: Mention the programming language and framework
  3. Specify format: Request comments, tests, or documentation
  4. Use examples: Show input/output examples when helpful
python
# Good prompt example
prompt = """
Write a Python function that:
1. Takes a list of integers as input
2. Returns the second largest number
3. Handles edge cases (empty list, single element)
4. Include docstring and type hints
5. Add error handling for invalid inputs
"""

DeepSeek Math

Model Details

  • Model ID: deepseek-math
  • Context Length: 8,192 tokens
  • Training Data: Mathematical texts, problem sets, proofs, equations
  • Capabilities: Mathematical reasoning, problem solving, proof generation

Strengths

  • Mathematical Reasoning: Step-by-step problem solving
  • Multiple Domains: Algebra, calculus, geometry, statistics, and more
  • Proof Generation: Formal and informal mathematical proofs
  • Equation Solving: Symbolic and numerical computation
  • Explanation: Clear mathematical explanations

Mathematical Domains

  • Algebra: Linear equations, polynomials, systems
  • Calculus: Derivatives, integrals, limits
  • Geometry: Euclidean and analytic geometry
  • Statistics: Probability, distributions, hypothesis testing
  • Number Theory: Prime numbers, modular arithmetic
  • Discrete Math: Combinatorics, graph theory, logic

Use Cases

  • Educational math tutoring
  • Homework assistance
  • Mathematical research support
  • Engineering calculations
  • Financial modeling
  • Scientific computing

Example Usage

python
response = client.chat.completions.create(
    model="deepseek-math",
    messages=[
        {
            "role": "user",
            "content": "Solve the differential equation dy/dx = 2x + 3, with initial condition y(0) = 1. Show all steps."
        }
    ],
    temperature=0.1,  # Very low temperature for mathematical accuracy
    max_tokens=600
)

print(response.choices[0].message.content)

Mathematical Formatting

The model supports various mathematical notation formats:

  • LaTeX: $\int_0^1 x^2 dx = \frac{1}{3}$
  • Plain text: integral from 0 to 1 of x^2 dx = 1/3
  • Step-by-step: Detailed solution processes

Model Selection Guide

Choose DeepSeek Chat When:

  • Building conversational applications
  • Need general-purpose AI assistance
  • Working with diverse content types
  • Require multilingual support
  • Need creative or analytical thinking

Choose DeepSeek Coder When:

  • Generating or reviewing code
  • Building developer tools
  • Need programming assistance
  • Working on software projects
  • Require code explanation or documentation

Choose DeepSeek Math When:

  • Solving mathematical problems
  • Building educational applications
  • Need mathematical reasoning
  • Working with equations or proofs
  • Require step-by-step solutions

Model Comparison

Performance Metrics

MetricDeepSeek ChatDeepSeek CoderDeepSeek Math
General Knowledge⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Code Generation⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Mathematical Reasoning⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Conversation Quality⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Context Understanding⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐

Cost Considerations

ModelInput CostOutput CostContext Length
deepseek-chat$0.14/1M tokens$0.28/1M tokens32K
deepseek-coder$0.14/1M tokens$0.28/1M tokens16K
deepseek-math$0.14/1M tokens$0.28/1M tokens8K

Prices are subject to change. Check our pricing page for current rates.

Advanced Features

Function Calling

All models support function calling for external tool integration:

python
functions = [
    {
        "name": "calculate",
        "description": "Perform mathematical calculations",
        "parameters": {
            "type": "object",
            "properties": {
                "expression": {"type": "string", "description": "Math expression"}
            },
            "required": ["expression"]
        }
    }
]

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "What's 15% of 240?"}],
    functions=functions,
    function_call="auto"
)

JSON Mode

Force structured output with JSON mode:

python
response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {
            "role": "system",
            "content": "You are a helpful assistant designed to output JSON."
        },
        {
            "role": "user",
            "content": "Generate a user profile for John Doe"
        }
    ],
    response_format={"type": "json_object"}
)

Streaming

All models support streaming for real-time responses:

python
stream = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "Tell me a story"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Model Updates and Versioning

Version Naming

Models follow semantic versioning:

  • deepseek-chat: Latest stable version
  • deepseek-chat-v1.0: Specific version
  • deepseek-chat-preview: Preview/beta version

Update Policy

  • Stable models: Updated monthly with improvements
  • Preview models: Updated weekly with latest features
  • Deprecated models: 90-day notice before removal

Backward Compatibility

We maintain backward compatibility for:

  • API endpoints and parameters
  • Response formats
  • Core functionality

Breaking changes are introduced only in major version updates with advance notice.

Best Practices

Model-Specific Optimization

For DeepSeek Chat:

  • Use system messages to set context
  • Adjust temperature based on creativity needs
  • Implement conversation memory management

For DeepSeek Coder:

  • Be specific about programming language
  • Request code comments and documentation
  • Use lower temperature for deterministic output

For DeepSeek Math:

  • Request step-by-step solutions
  • Specify desired output format (LaTeX, plain text)
  • Use very low temperature for accuracy

Performance Optimization

  1. Choose the right model: Match model capabilities to your use case
  2. Optimize context length: Use only necessary context
  3. Batch requests: Combine multiple queries when possible
  4. Cache responses: Store results for repeated queries

Error Handling

python
def robust_model_call(model, messages, **kwargs):
    try:
        response = client.chat.completions.create(
            model=model,
            messages=messages,
            **kwargs
        )
        return response
    except Exception as e:
        if "model_not_found" in str(e):
            # Fallback to default model
            return client.chat.completions.create(
                model="deepseek-chat",
                messages=messages,
                **kwargs
            )
        raise e

Migration Guide

From OpenAI Models

OpenAI ModelDeepSeek EquivalentNotes
gpt-3.5-turbodeepseek-chatSimilar capabilities, longer context
gpt-4deepseek-chatComparable performance
code-davinci-002deepseek-coderSpecialized for coding tasks

Migration Steps

  1. Update base URL: Change to https://api.deepseek.com/v1
  2. Replace API key: Use your DeepSeek API key
  3. Update model names: Use DeepSeek model identifiers
  4. Test functionality: Verify responses meet your requirements

Future Roadmap

Upcoming Models

  • DeepSeek Vision: Multimodal image understanding
  • DeepSeek Audio: Speech and audio processing
  • DeepSeek Reasoning: Enhanced logical reasoning

Planned Features

  • Larger context windows
  • Faster inference speeds
  • Additional specialized models
  • Enhanced function calling

Getting Help

Documentation

Support


Ready to start using our models? Check out our Quick Start Guide or explore our API Reference.

基于 DeepSeek AI 大模型技术