# DeepSeek-R1 — Open-Weight Reasoning Model Rivaling OpenAI o1 > DeepSeek-R1 is the open-weight reasoning model that matches OpenAI o1 on math, code, science benchmarks. Streaming chain-of-thought visible. MIT-licensed. ## Install Copy the content below into your project: ## Quick Use 1. Hosted: same DeepSeek API key, set `model="deepseek-reasoner"` 2. Local: `ollama pull deepseek-r1:7b && ollama run deepseek-r1:7b` 3. Print `response.message.reasoning_content` to see the full chain-of-thought --- ## Intro DeepSeek-R1 is the open-weight reasoning model that achieves o1-level performance on AIME / MATH / GPQA / Codeforces while shipping its full chain-of-thought to the user. Distilled smaller versions (1.5B, 7B, 32B, 70B) make local reasoning practical on consumer hardware. MIT license, full weights public. Best for: hard reasoning tasks (math, science, complex code) where you need a reasoning model but want open weights. Works with: DeepSeek API, Ollama (distilled), vLLM, llama.cpp. Setup time: 2 minutes. --- ### Hosted API ```python from openai import OpenAI client = OpenAI( base_url="https://api.deepseek.com/v1", api_key=os.environ["DEEPSEEK_API_KEY"], ) response = client.chat.completions.create( model="deepseek-reasoner", # R1 messages=[{"role": "user", "content": "Prove that the square root of 2 is irrational"}], ) # R1 streams reasoning + final answer for choice in response.choices: print("REASONING:", choice.message.reasoning_content) print("ANSWER:", choice.message.content) ``` Unlike o1, R1's reasoning is visible — useful for debugging, education, and trust. ### Local via Ollama (distilled) ```bash ollama pull deepseek-r1:1.5b # ~1GB, runs on a laptop ollama pull deepseek-r1:7b # ~5GB ollama pull deepseek-r1:14b # ~9GB ollama pull deepseek-r1:32b # ~20GB, M2 Max territory ollama pull deepseek-r1:70b # ~40GB, beefy server ``` The 7B distillation often outperforms GPT-4o on competition math while being free and fast on a single 4090. ### When to use R1 vs V3 | Task | Pick | |---|---| | Math proofs, competition problems | R1 | | Step-by-step debugging | R1 | | Quick chitchat, summaries | V3 (cheaper, faster) | | Tool-use heavy agent | V3 (R1's tool support is weaker) | | Need visible CoT for audit | R1 | ### Pricing | Source | Input $/1M tok | Output $/1M tok | |---|---|---| | DeepSeek API | $0.55 | $2.19 | | OpenAI o1 (compare) | $15.00 | $60.00 | | OpenAI o1-mini (compare) | $3.00 | $12.00 | | Local distilled | $0 | $0 | --- ### FAQ **Q: Why does R1 show its reasoning when o1 hides it?** A: DeepSeek published the full RL training methodology. Visible CoT is part of the value proposition — auditability, debugging, education. OpenAI considers o1's CoT a competitive moat. **Q: How much slower is R1 vs V3?** A: R1 spends extra tokens on reasoning before the final answer — typically 3-10× more output tokens, so 3-10× slower wall-clock latency on equal infra. The cost difference reflects this. **Q: Are the distilled R1 versions trained from scratch?** A: No — they're knowledge-distilled from full R1 into Llama / Qwen base models. The 7B distill is `Llama-3.1-8B + R1 distillation`, the 32B is `Qwen-2.5-32B + R1 distillation`, etc. Performance trades off with base. --- ## Source & Thanks > Built by [DeepSeek](https://github.com/deepseek-ai). Weights MIT-licensed. > > [deepseek-ai/DeepSeek-R1](https://github.com/deepseek-ai/DeepSeek-R1) — ⭐ 90,000+ --- ## 快速使用 1. 托管:用同一个 DeepSeek API key,设 `model="deepseek-reasoner"` 2. 本地:`ollama pull deepseek-r1:7b && ollama run deepseek-r1:7b` 3. 打印 `response.message.reasoning_content` 看完整 chain-of-thought --- ## 简介 DeepSeek-R1 是开源权重的推理模型,在 AIME / MATH / GPQA / Codeforces 上达到 o1 级别,同时把完整 chain-of-thought 推给用户。蒸馏的小版本(1.5B / 7B / 32B / 70B)让消费级硬件上跑本地推理变得现实。MIT 许可证,完整权重公开。适合需要推理模型又要开源权重的硬推理任务(数学、科学、复杂代码)。兼容 DeepSeek API / Ollama(蒸馏)/ vLLM / llama.cpp。装机时间 2 分钟。 --- ### 托管 API ```python from openai import OpenAI client = OpenAI( base_url="https://api.deepseek.com/v1", api_key=os.environ["DEEPSEEK_API_KEY"], ) response = client.chat.completions.create( model="deepseek-reasoner", # R1 messages=[{"role": "user", "content": "Prove that the square root of 2 is irrational"}], ) # R1 流式输出推理 + 最终答案 for choice in response.choices: print("REASONING:", choice.message.reasoning_content) print("ANSWER:", choice.message.content) ``` 不像 o1,R1 的推理过程可见 —— 对调试、教育、信任有用。 ### 本地 Ollama(蒸馏) ```bash ollama pull deepseek-r1:1.5b # ~1GB,笔记本上能跑 ollama pull deepseek-r1:7b # ~5GB ollama pull deepseek-r1:14b # ~9GB ollama pull deepseek-r1:32b # ~20GB,M2 Max 级别 ollama pull deepseek-r1:70b # ~40GB,强服务器 ``` 7B 蒸馏版在竞赛数学上常常胜过 GPT-4o,单张 4090 上免费且快。 ### R1 vs V3 怎么选 | 任务 | 选 | |---|---| | 数学证明、竞赛题 | R1 | | 逐步调试 | R1 | | 快速闲聊、摘要 | V3(更便宜、更快) | | 工具使用重的 agent | V3(R1 工具支持较弱) | | 需要可审计 CoT | R1 | ### 价格 | 来源 | 输入 $/1M tok | 输出 $/1M tok | |---|---|---| | DeepSeek API | $0.55 | $2.19 | | OpenAI o1(对比) | $15.00 | $60.00 | | OpenAI o1-mini(对比) | $3.00 | $12.00 | | 本地蒸馏 | $0 | $0 | --- ### FAQ **Q: 为啥 R1 显示推理过程而 o1 隐藏?** A: DeepSeek 公开了完整 RL 训练方法。可见 CoT 是价值主张的一部分 —— 可审计、可调试、可教育。OpenAI 把 o1 的 CoT 当成竞争壁垒。 **Q: R1 比 V3 慢多少?** A: R1 在最终答案前多花 token 推理 —— 通常输出 token 多 3-10 倍,同等基础设施下延迟 3-10 倍。价格差反映了这个。 **Q: R1 蒸馏版本是从零训练的吗?** A: 不是 —— 从完整 R1 知识蒸馏进 Llama / Qwen 基础模型。7B 蒸馏是 `Llama-3.1-8B + R1 distillation`,32B 是 `Qwen-2.5-32B + R1 distillation` 等。性能跟基础模型有取舍。 --- ## 来源与感谢 > Built by [DeepSeek](https://github.com/deepseek-ai). Weights MIT-licensed. > > [deepseek-ai/DeepSeek-R1](https://github.com/deepseek-ai/DeepSeek-R1) — ⭐ 90,000+ --- Source: https://tokrepo.com/en/workflows/deepseek-r1-open-weight-reasoning-model-rivaling-openai-o1 Author: DeepSeek