Cursor에서 DeepSeek 모델 사용: 완전 설정 가이드

DeepSeek 모델은 경쟁력 있는 가격으로 강력한 추론 기능을 제공합니다. Cursor는 네이티브 API 지원부터 Ollama를 통한 로컬 배포까지 여러 방법으로 DeepSeek 통합을 지원합니다. 이 가이드에서는 Cursor 워크플로우에서 DeepSeek을 작동시키는 모든 접근 방식을 다룹니다.
사용 가능한 DeepSeek 모델
| 모델 | 컨텍스트 | 가장 적합한 용도 | Cursor 지원 |
|---|---|---|---|
| DeepSeek V3 | 64K | 일반 코딩, 채팅 | 네이티브 |
| DeepSeek R1 | 64K | 추론, 수학, 논리 | 네이티브 |
| DeepSeek V4 | 128K | 복잡한 분석 | Ollama/프록시 경유 |
| DeepSeek Coder | 16K | 코드 특정 작업 | OpenRouter 경유 |
방법 1: 네이티브 DeepSeek 지원(권장)
Cursor에는 DeepSeek V3 및 R1에 대한 내장 지원이 있습니다.
1단계: API 키 가져오기
- DeepSeek Platform 방문
- 계정을 만들거나 로그인
- "API Keys"로 이동
- 새 키를 생성하고 복사
2단계: Cursor에서 구성
- Cursor 설정 열기 (
Cmd/Ctrl + ,) - "Models" 또는 "AI Features"로 이동
- "Custom API Key" 또는 "Add Provider" 찾기
- 공급자로 "DeepSeek" 선택
- API 키 붙여넣기
- 설정 저장
3단계: DeepSeek 모델 선택
모든 채팅 또는 Composer 세션에서:
- 모델 선택기 클릭(채팅 상단)
- "DeepSeek V3" 또는 "DeepSeek R1" 선택
- 코딩 시작
방법 2: OpenRouter를 통해 DeepSeek 사용
네이티브로 지원되지 않는 모델의 경우 OpenRouter를 브리지로 사용합니다.
설정
- OpenRouter API 키 가져오기
- Cursor 설정에서 OpenRouter를 공급자로 추가:
{
"customModels": [
{
"name": "deepseek/deepseek-chat",
"provider": "openrouter",
"apiKey": "your-openrouter-key"
}
]
}
사용 가능한 OpenRouter DeepSeek 모델
deepseek/deepseek-chat # DeepSeek V3
deepseek/deepseek-reasoner # DeepSeek R1
deepseek/deepseek-coder # DeepSeek Coder
방법 3: Ollama를 사용한 로컬 DeepSeek
개인 정보 보호 및 오프라인 사용을 위해 DeepSeek을 로컬에서 실행합니다.
Ollama 설치
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# Windows
# https://ollama.com/download에서 다운로드
DeepSeek 모델 가져오기
# DeepSeek Coder(코딩에 권장)
ollama pull deepseek-coder:6.7b
# 더 큰 컨텍스트용(더 많은 RAM 필요)
ollama pull deepseek-coder:33b
Ollama용 Cursor 구성
- Ollama가 실행 중인지 확인:
ollama serve
- Cursor 설정에서 로컬 모델 추가:
{
"customModels": [
{
"name": "deepseek-coder",
"provider": "ollama",
"baseUrl": "http://localhost:11434"
}
]
}
Ollama 연결 문제 해결
Cursor가 Ollama에 연결할 수 없는 경우:
# Ollama가 실행 중인지 확인
curl http://localhost:11434/api/tags
# Ollama 호스트 환경 변수 설정
export OLLAMA_HOST=0.0.0.0
# macOS에서 네트워크 액세스 허용
launchctl setenv OLLAMA_HOST "0.0.0.0"
방법 4: LiteLLM 프록시를 통해 DeepSeek V4
DeepSeek V4 Pro(클라우드)의 경우 LiteLLM을 프록시로 사용합니다.
LiteLLM 설정
pip install litellm
litellm_config.yaml 생성:
model_list:
- model_name: deepseek-v4
litellm_params:
model: deepseek/deepseek-chat-v4
api_key: os.environ/DEEPSEEK_API_KEY
프록시 실행:
litellm --config litellm_config.yaml --port 8000
Cursor 구성
{
"customModels": [
{
"name": "deepseek-v4",
"provider": "openai-compatible",
"apiKey": "sk-any",
"baseUrl": "http://localhost:8000"
}
]
}
추론 콘텐츠 처리
DeepSeek R1은 특별한 처리가 필요한 추론 콘텐츠를 출력합니다.
문제
R1은 추론과 최종 답변을 모두 반환합니다:
{
"choices": [{
"message": {
"content": "최종 답변은 여기...",
"reasoning_content": "생각해 보겠습니다... 1단계... 2단계..."
}
}]
}
해결책: 프록시로 필터링
추론 콘텐츠를 제거하는 간단한 프록시를 사용합니다:
# deepseek_proxy.py
from flask import Flask, request, Response
import requests
app = Flask(__name__)
@app.route('/v1/chat/completions', methods=['POST'])
def proxy():
resp = requests.post(
'https://api.deepseek.com/v1/chat/completions',
headers={'Authorization': f'Bearer {API_KEY}'},
json=request.get_json()
)
data = resp.json()
# reasoning_content 제거
for choice in data.get('choices', []):
msg = choice.get('message', {})
msg.pop('reasoning_content', None)
return Response(
json.dumps(data),
mimetype='application/json'
)
코딩용 DeepSeek 최적화
시스템 프롬프트
더 나은 DeepSeek 성능을 위해 Cursor 규칙에 이것을 추가하세요:
DeepSeek 모델을 사용할 때:
- 파일 경로와 줄 번호를 명확히 지정하세요
- 복잡한 작업에는 단계별 추론을 요청하세요
- 구조화된 출력 형식(JSON, 마크다운 테이블)을 사용하세요
- 예상되는 응답 길이를 지정하세요
온도 설정
| 작업 | 권장 온도 |
|---|---|
| 코드 생성 | 0.1 - 0.3 |
| 디버깅 | 0.2 - 0.4 |
| 창의적 탐색 | 0.5 - 0.7 |
| 코드 검토 | 0.1 - 0.2 |
비용 비교
| 모델 | 입력/1M 토큰 | 출력/1M 토큰 |
|---|---|---|
| DeepSeek V3 | $0.14 | $0.28 |
| DeepSeek R1 | $0.55 | $2.19 |
| GPT-4o | $5.00 | $15.00 |
| Claude 3.5 Sonnet | $3.00 | $15.00 |
2026년 기준 가격. DeepSeek은 훨씬 더 비용 효율적입니다.
문제 해결
| 문제 | 해결책 |
|---|---|
| "모델을 사용할 수 없음" | API 키가 유효하고 크레딧이 있는지 확인 |
| 느린 응답 | 더 작은 모델을 사용하거나 스트리밍을 활성화 |
| 추론 콘텐츠 표시 | 프록시 또는 필터 사용(위 참조) |
| Ollama 연결 거부 | Ollama가 실행 중이고 포트에 접근 가능한지 확인 |
| 중국어 출력 | 프롬프트에 "Respond in English" 추가 |
빠른 참조
# DeepSeek API 테스트
curl https://api.deepseek.com/v1/chat/completions \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [{"role": "user", "content": "Hello"}]
}'
# Ollama 모델 목록
ollama list
# Ollama 상태 확인
curl http://localhost:11434/api/tags