DeepSeek vs Kimi for Coding
Kimi edges out DeepSeek for coding with a 3.7% higher SWE-bench score (76.8% vs 73.1%) and image understanding for code analysis, making it the stronger technical choice. DeepSeek counters with drastically cheaper API costs and open-source weights, making it ideal for budget-conscious developers who can tolerate slightly lower performance. Choose Kimi for peak coding performance, or DeepSeek if cost and transparency are priorities.
Head-to-Head for Coding
| Criteria | DeepSeek | Kimi | Winner |
|---|---|---|---|
| Code problem-solving ability | Strong performer | Slightly stronger | Kimi |
| API pricing | Very affordable | More expensive | DeepSeek |
| Extended reasoning capability | R1 model available | Built-in reasoning | Tie |
| Open-source code availability | Fully open-source | Partially open | DeepSeek |
| Understanding diagrams/architecture | Not supported | Supported | Kimi |
Code problem-solving ability
DeepSeek
Strong performer
Kimi
Slightly stronger
API pricing
DeepSeek
Very affordable
Kimi
More expensive
Extended reasoning capability
DeepSeek
R1 model available
Kimi
Built-in reasoning
Open-source code availability
DeepSeek
Fully open-source
Kimi
Partially open
Understanding diagrams/architecture
DeepSeek
Not supported
Kimi
Supported
See Them Answer a Coding Question
We asked both models the same coding-focused prompt.
“Write a Python function that takes a nested JSON object and flattens it into a single-level dictionary with dot-notation keys, handling arrays by including the index in the key path.”
Write a Python function that takes a nested JSON object and flattens it into a single-level dictionary with dot-notation keys, handling arrays by including the index in the key path.
Here's a Python function that flattens nested JSON objects with dot notation, handling arrays by including indices in the key path:
def flatten_json(nested_json, parent_key='', sep='.'):
"""
Flatten a nested JSON object into a single-level dictionary with dot notation.
Args:
nested_json: The nested JSON object/dictionary to flatten
parent_key: Used internally for recursion (don't provide when calling)
sep: Separator for nested keys (defaults to '.')
Returns:
A flattened dictionary with dot-notation keys
Example:
Input: {'name': 'John', 'address': {'city': 'NYC', 'zip': 10001}, 'hobbies': ['reading', 'coding']}
Output: {'name': 'John', 'address.city': 'NYC', 'address.zip': 10001, 'hobbies.0': 'reading', 'hobbies.1': 'coding'}
"""
items = {}
for key, value in nested_json.items():
new_key = f"{parent_key}{sep}{key}" if parent_key else key
if isinstance(value, dict):
# Recursively flatten dictionaries
items.update(flatten_json(value, new_key, sep))
elif isinstance(value, list):
# Handle arrays by including index in key
for i, item in enumerate(value):
array_key = f"{new_key}{sep}{i}"
if isinstance(item, dict):
items.update(flatten_json(item, array_key, sep))
elif isinstance(item, list):
# Handle nested arrays
nested_array_items = {}
for j, nested_item in enumerate(item):
nested_array_key = f"{array_key}{sep}{j}"
if isinstance(nested_item, dict):
nested_array_items.update(flatten_json(nested_item, nested_array_key, sep))
else:
nested_array_items[nested_array_key] = nested_item
items.update(nested_array_items)
else:
items[array_key] = item
else:
# Base case: add the key-value pair
items[new_key] = value
return items
# Alternative implementation with a more robust approach
def flatten_json_iterative(data, sep='.'):
"""
Flatten JSON using an iterative approach (non-recursive).
Handles complex nested structures with arrays.
"""
flattened = {}
stack = [("", data)]
while stack:
prefix, current = stack.pop()
if isinstance(current, dict):
for key, value in current.items():
new_key = f"{prefix}{sep}{key}" if prefix else key
stack.append((new_key, value))
elif isinstance(current, list):
for i, item in enumerate(current):
new_key = f"{prefix}{sep}{i}" if prefix else str(i)
stack.append((new_key, item))
else:
flattened[prefix] = current
return flattened
# Helper function to handle edge cases and provide a clean interface
def flatten_json_object(nested_json, sep='.', iterative=False):
"""
Public interface for flattening JSON objects.
Args:
nested_json: JSON object/dictionary to flatten
sep: Separator for keys (default '.')
iterative: Use iterative approach (better for deep nesting)
Returns:
Flattened dictionary
"""
if not isinstance(nested_json, dict):
raise ValueError("Input must be a dictionary")
if iterative:
return flatten_json_iterative(nested_json, sep)
else:
return flatten_json(nested_json, sep='', sep_internal=sep)
# Example usage and testing
if __name__ == "__main__":
# Example 1: Simple nested object
example1 = {
"name": "John",
"address": {
"city": "NYC",
"zip": 10001
}
}
# Example 2: With arrays
example2 = {
"user": "John",
"scores": [85, 92, 78],
"details": {
"hobbies": ["reading", "coding"],
"addresses": [
{"type": "home", "city": "NYC"},
{"type": "work", "city": "Boston"}
]
}
}
# Example 3: Complex nested with arrays of arrays
example3 = {
"data": [
{"id": 1, "tags": ["A", "B"]},
{"id": 2, "tags": ["C", "D", "E"]}
]
}
print("Example 1 - Simple nested:")
print(flatten_json(example1))
print("\nExample 2 - With arrays:")
print(flatten_json(example2))
print("\nExample 3 - Complex nested arrays:")
print(flatten_json(example3))
print("\nUsing iterative approach:")
print(flatten_json_iterative(example2))
Key features of this implementation:
- Recursive flattening: Handles arbitrarily nested dictionaries
- Array support: Includes indices in the key path (e.g.,
hobbies.0) - Dot notation: Uses dots to separate nested levels
- Flexible separator: Can customize the separator character
- Two implementations:
- Recursive: Cleaner code, but may hit recursion limits with very deep nesting
- Iterative: Uses a stack, better for very deep structures
- Handles edge cases: Empty dicts, empty arrays, mixed types
Example outputs:
# Input:
{
"user": "John",
"scores": [85, 92, 78],
"details": {
"hobbies": ["reading", "coding"]
}
}
# Output:
{
"user": "John",
"scores.0": 85,
"scores.1": 92,
"scores.2": 78,
"details.hobbies.0": "reading",
"details.hobbies.1": "coding"
}
Time Complexity: O(n) where n is the total number of elements in the nested structure Space Complexity: O(n) for the output dictionary
Try coding tasks with both models
See DeepSeek and Kimi answer side by side in Multichat
Detailed Breakdown
DeepSeek and Kimi are both strong contenders for coding tasks, but they approach the problem differently — and the gap between them is meaningful for developers who push these models hard.
On raw coding benchmarks, Kimi K2.5 edges ahead. Its LiveCodeBench v6 score of 85.0% is a direct measure of practical coding ability, and its SWE-bench Verified score of 76.8% outpaces DeepSeek V3.2's 73.1%. SWE-bench specifically tests real-world software engineering tasks — fixing bugs in actual GitHub repositories — so this 3.7-point gap reflects a genuine difference in how well each model handles messy, real-world codebases rather than clean algorithmic puzzles.
DeepSeek is no slouch, though. Its AIME 2025 score of 93.1% and MMLU Pro of 85.0% confirm it handles the mathematical and logical reasoning that underpins complex programming challenges. For algorithm design, competitive programming, and systems-level thinking, DeepSeek V3.2 remains highly capable. Its dedicated reasoning variant, DeepSeek R1, is particularly worth reaching for when tackling problems that benefit from extended chain-of-thought — think debugging subtle concurrency issues or architecting a data pipeline from scratch.
Where Kimi pulls further ahead for coding workflows is multi-step task coordination. Kimi K2.5 is designed to handle parallel sub-tasks, which maps naturally onto real software engineering: running tests while analyzing errors, cross-referencing documentation while writing code, or managing dependencies across a multi-file refactor. Its image understanding capability also gives it a practical edge — developers can paste in a screenshot of an error dialog, a UI mockup they need to implement, or a database schema diagram and work directly from it.
For cost-conscious developers, DeepSeek wins on API economics: roughly $0.56 per million input tokens versus Kimi's $0.60, with a more significant gap on output ($1.68 vs $3.00). For high-volume code generation tasks, that output cost difference adds up fast. DeepSeek's fully open-source weights also matter if you need to self-host for security or compliance reasons — a common concern in enterprise engineering teams.
The recommendation depends on your workflow. If you're doing high-volume code generation, building pipelines, or self-hosting is a requirement, DeepSeek is the pragmatic choice. If you're working on complex real-world codebases, need image-to-code capabilities, or want the edge in agentic multi-step coding tasks, Kimi K2.5 is the stronger tool. For most professional developers, Kimi's benchmark lead on SWE-bench tips the balance in its favor.
Frequently Asked Questions
Other Topics for DeepSeek vs Kimi
Coding Comparisons for Other Models
Try coding tasks with DeepSeek and Kimi
Compare in Multichat — freeJoin 10,000+ professionals who use Multichat