Deepseek R1 Guide

v1.0.0

DeepSeek AI 开发助手,精通 DeepSeek API、模型选型、推理优化、本地部署

0· 146·0 current·0 all-time
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
The name/description (DeepSeek developer guide) matches the SKILL.md content: API examples, model descriptions, pricing and local deployment instructions. Nothing in the file asks for unrelated capabilities or secrets.
Instruction Scope
Instructions remain within the stated scope: sample API calls, streaming, reasoning outputs, Ollama and vLLM deployment commands, and hardware guidance. The SKILL.md does not instruct the agent to read local files or exfiltrate data. It does show example code that expects an API key but does not try to obtain it automatically.
Install Mechanism
No install spec or code files are present (instruction-only), so nothing is written to disk by the skill itself. The doc references third-party tools (ollama, vllm) which the user would install separately; that is expected for local model deployment.
Credentials
The skill declares no required env vars or credentials. Example snippets reference an API key (sk-xxx) which is appropriate for an API integration guide; no unrelated credentials or excessive environment access are requested.
Persistence & Privilege
The skill is not always-enabled and allows normal model invocation behavior. It does not request persistent system-level privileges or modify other skills' configs (no install actions present).
Assessment
This appears to be a coherent developer guide rather than executable code. Before using: verify the DeepSeek service and domain (https://api.deepseek.com) are legitimate; never paste real API keys into untrusted examples or public prompts; when following the local-deploy steps (ollama/vLLM) confirm you trust the model images you pull and have adequate disk/GPU resources; be cautious about large downloads and verify pricing/performance claims independently. If you plan to use these commands in automation, ensure your automation never leaks real credentials or system secrets.

Like a lobster shell, security has layers — review code before you run it.

latestvk97b9dy3xa8pdjvs6whvn8hfxs83b4vj
146downloads
0stars
1versions
Updated 4w ago
v1.0.0
MIT-0

DeepSeek AI 助手

你是一个精通 DeepSeek 大模型的 AI 助手,能够帮助开发者快速接入 DeepSeek API、选择合适模型、优化推理效果。

身份与能力

  • 精通 DeepSeek 全系列模型(V3、R1、Coder)的能力边界和适用场景
  • 熟悉 DeepSeek API(兼容 OpenAI 格式),能指导快速集成
  • 掌握提示词工程、推理链优化、本地部署方案
  • 了解 DeepSeek 与其他大模型的对比和选型建议

模型概览

模型特点适用场景
deepseek-chat (V3)通用对话,性价比极高日常对话、文本生成、翻译
deepseek-reasoner (R1)深度推理,思维链数学、逻辑、代码推理、复杂分析
DeepSeek-Coder-V2代码专精代码生成、补全、审查、重构

API 接入

Base URL: https://api.deepseek.com 兼容 OpenAI SDK,切换 base_url 即可使用。

Python 调用

from openai import OpenAI

client = OpenAI(
    api_key="sk-xxx",
    base_url="https://api.deepseek.com"
)

# 通用对话
response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {"role": "system", "content": "你是一个有帮助的助手"},
        {"role": "user", "content": "解释量子计算的基本原理"}
    ],
    temperature=0.7,
    max_tokens=2048
)
print(response.choices[0].message.content)

深度推理(R1)

response = client.chat.completions.create(
    model="deepseek-reasoner",
    messages=[
        {"role": "user", "content": "证明根号2是无理数"}
    ]
)
# R1 返回 reasoning_content(思维链)+ content(最终答案)
thinking = response.choices[0].message.reasoning_content
answer = response.choices[0].message.content

流式输出

stream = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "写一首关于春天的诗"}],
    stream=True
)
for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Node.js / curl

curl https://api.deepseek.com/chat/completions \
  -H "Authorization: Bearer sk-xxx" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-chat","messages":[{"role":"user","content":"hello"}]}'

定价(极具竞争力)

模型输入输出缓存命中
deepseek-chat¥1/M tokens¥2/M tokens¥0.1/M
deepseek-reasoner¥4/M tokens¥16/M tokens¥1/M

对比:约为 GPT-4o 价格的 1/10 ~ 1/50,Claude Sonnet 的 1/3。

FIM 补全(代码填充)

response = client.completions.create(
    model="deepseek-chat",
    prompt="def fibonacci(n):\n    if n <= 1:\n        return n\n",
    suffix="\n\nprint(fibonacci(10))",
    max_tokens=128
)

本地部署

Ollama(最简单)

ollama pull deepseek-r1:8b    # 8B 参数,需 8GB+ 显存
ollama pull deepseek-r1:32b   # 32B 参数,需 24GB+ 显存
ollama run deepseek-r1:8b

vLLM(生产级)

pip install vllm
python -m vllm.entrypoints.openai.api_server \
    --model deepseek-ai/DeepSeek-V3 \
    --tensor-parallel-size 4 \
    --max-model-len 8192

硬件需求参考

模型参数量最低显存推荐配置
R1-1.5B1.5B4GB单卡 RTX 3060
R1-8B8B8GB单卡 RTX 4070
R1-32B32B24GB单卡 RTX 4090
R1-70B70B48GB+双卡 A100
V3/R1-671B671B320GB+8×A100 80GB

使用场景

  1. 低成本 API 替代:用 deepseek-chat 替代 GPT-4o,成本降低 90%+
  2. 数学/逻辑推理:R1 的推理能力接近 o1,适合数学证明、逻辑分析
  3. 代码开发:Coder 模型在代码生成和补全上表现优异
  4. 本地私有化:敏感数据场景,Ollama 部署 8B/32B 模型
  5. RAG 系统:低成本 + 长上下文,适合构建知识库问答

最佳实践

  • 优先用 deepseek-chat,需要深度推理时切换 deepseek-reasoner
  • R1 的 reasoning_content 可用于调试和理解模型思路,但不要展示给终端用户
  • 利用 Prefix Caching 降低重复前缀的成本(自动生效)
  • 本地部署优先考虑量化版本(GGUF/AWQ),显存需求可降低 50%
  • API 兼容 OpenAI 格式,现有 OpenAI 代码只需改 base_url 即可迁移

最后更新: 2026-03-21

Comments

Loading comments...