DeepSeek
DeepSeek API integration - Access DeepSeek V3, DeepSeek Coder models through UniterRouter. OpenAI-compatible format for seamless migration from ChatGPT.
DeepSeek API
Access DeepSeek models through UniterRouter using the OpenAI-compatible API format. DeepSeek offers powerful reasoning and coding models at competitive prices.
DeepSeek-R1: The reasoning model provides extended thinking capabilities with visible reasoning chains.
Quick Start
curl https://api.uniterouter.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $UNITEROUTER_API_KEY" \
-d '{
"model": "deepseek-chat",
"messages": [
{"role": "user", "content": "Explain quantum computing"}
]
}'from openai import OpenAI
client = OpenAI(
base_url="https://api.uniterouter.ai/v1",
api_key="your_uniterouter_api_key",
)
response = client.chat.completions.create(
model="deepseek-chat",
messages=[
{"role": "user", "content": "Explain quantum computing"}
]
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.uniterouter.ai/v1",
apiKey: process.env.UNITEROUTER_API_KEY,
});
const response = await client.chat.completions.create({
model: "deepseek-chat",
messages: [
{ role: "user", content: "Explain quantum computing" }
],
});
console.log(response.choices[0].message.content);Available Models
| Model | Description | Context | Best For |
|---|---|---|---|
deepseek-chat | General chat model | 64K | Conversations, Q&A |
deepseek-coder | Code-specialized model | 64K | Coding, debugging |
deepseek-reasoner | Reasoning model (R1) | 64K | Complex reasoning, math |
DeepSeek Reasoner (R1)
The DeepSeek Reasoner model provides visible reasoning chains:
response = client.chat.completions.create(
model="deepseek-reasoner",
messages=[
{"role": "user", "content": "Solve: What is 15% of 240?"}
]
)
# The response includes reasoning in the content
print(response.choices[0].message.content)Reasoning Output
The model's response includes its reasoning process:
Let me think through this step by step:
1. 15% means 15/100 = 0.15
2. 240 Ã 0.15 = 36
Therefore, 15% of 240 is 36.Coding Tasks
DeepSeek excels at coding tasks:
response = client.chat.completions.create(
model="deepseek-coder",
messages=[
{"role": "system", "content": "You are an expert programmer."},
{"role": "user", "content": "Write a Python function to find the nth Fibonacci number using memoization"}
]
)Streaming
Enable streaming for real-time responses:
stream = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Write a poem about AI"}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")Features
- Long Context: Up to 64K tokens context window
- Reasoning: Extended thinking with visible chains
- Code Generation: Excellent at writing and debugging code
- Math: Strong mathematical reasoning capabilities
- Multilingual: Supports multiple languages including Chinese
Pricing
DeepSeek models are known for competitive pricing. Check the models page for current rates.
Related
- Chat Completions - Full API documentation
- Reasoning - Extended thinking guide
How is this guide?
Count Tokens POST
Gemini Token Counter API - Estimate token usage and costs before API calls. Calculate prompt tokens for Gemini Pro, Gemini 1.5 to optimize spending.
Mistral AI
Mistral API integration - Access Mistral Large, Mistral Medium, Codestral through UniterRouter. OpenAI-compatible format with function calling and JSON mode support.