Everything you need to start using DeepSeek V4, V3, and R1 in your applications. From setup to production-ready code examples.
Get DeepSeek API Key โSign up at AI Token to get your API key. You'll have immediate access to DeepSeek V4, V3, R1, and 8 other models.
Free tier available โ no credit card required to start.
# Install the OpenAI SDK (DeepSeek uses the same format)
# pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://eaf9553505eeb8f5-115-190-107-107.serveousercontent.com/v1",
api_key="your-api-key-here"
)
# DeepSeek V4 โ Best for coding and complex tasks
response = client.chat.completions.create(
model="deepseek-v4",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a Python function to sort a list."}
],
temperature=0.7
)
print(response.choices[0].message.content)
# DeepSeek R1 โ Chain-of-thought reasoning model
# Perfect for math, logic, and multi-step problems
response = client.chat.completions.create(
model="deepseek-r1",
messages=[
{"role": "user", "content": """
A train travels at 60 km/h for 2.5 hours,
then at 80 km/h for 1.5 hours.
What is the average speed for the entire journey?
"""}
]
)
# R1 shows its reasoning process
print(response.choices[0].message.content)
// npm install openai
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://eaf9553505eeb8f5-115-190-107-107.serveousercontent.com/v1',
apiKey: 'your-api-key-here'
});
const response = await client.chat.completions.create({
model: 'deepseek-v4',
messages: [
{ role: 'user', content: 'Explain quantum computing in simple terms' }
]
});
console.log(response.choices[0].message.content);
| Model | Best For | Speed |
|---|---|---|
| deepseek-v4 | Coding, complex tasks | Medium |
| deepseek-v3 | General purpose | Medium |
| deepseek-r1 | Math, reasoning, logic | Slow |
| deepseek-v4-flash | Quick tasks, chatbots | Fast |
# Stream responses for better UX
stream = client.chat.completions.create(
model="deepseek-v4",
messages=[{"role": "user", "content": "Write a story"}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)