DeepSeek-R1 추론 모델(reasoning model) API 가이드

DeepSeek-R1 추론 모델(reasoning model) API 가이드

DeepSeek API 에서 R1 을 쓰려면 모델명을 deepseek-reasoner 로 지정하면 돼요. 이러면 모델이 답을 내기 전에 추론 과정을 먼저 거치고, 응답에 그 "생각"이 같이 담겨요.

출처: https://api-docs.deepseek.com/guides/reasoning_model

base_url 과 모델명

DeepSeek API 의 베이스 URL은 그대로 유지하고, model 파라미터만 deepseek-reasoner로 바꿔요. OpenAI 호환 형식이므로 기존 클라이언트를 재사용해요.

curl https://api.deepseek.com/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEEPSEEK_API_KEY" \
  -d '{
    "model": "deepseek-reasoner",
    "messages": [{"role": "user", "content": "Hello"}],
    "max_tokens": 8000
  }'

추론 과정이 응답에 보여요

R1 의 응답은 크게 두 부분으로 나뉘어요. 추론 사슬(chain-of-thought)에 해당하는 thinking 과 최종 답변 response 입니다. 그래서 디버깅하거나 수학·논리 문제를 풀 때 어디까지 생각했는지 그대로 확인할 수 있어요.

주의할 점

  • think/response 를 함께 출력하면 토큰을 많이 써요. 응답의 reasoning_content(또는 추론 필드)를 별도 저장하거나 숨길지 설계할 때 고려해요
  • max_tokens 은 추론 과정 때문에 넉넉히 잡는 편이 안전해요

더 알아보기