# Source: https://docs.baseten.co/examples/models/deepseek/deepseek-r1.md

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Deepseek R1

> A state-of-the-art 671B-parameter MoE LLM with o1-style reasoning licensed for commercial use

export const DeepSeekIconCard = ({title, href}) => <Card title={title} href={href} icon={<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M21.7896 6.25856C21.5779 6.15323 21.4862 6.35453 21.3629 6.45731C21.3204 6.49043 21.2846 6.53375 21.2487 6.57282C20.9388 6.91002 20.5771 7.13086 20.1046 7.10453C19.4138 7.06546 18.8238 7.28629 18.3021 7.82479C18.1913 7.16058 17.823 6.76478 17.263 6.50997C16.9697 6.37747 16.673 6.24582 16.4672 5.95788C16.3238 5.75318 16.2847 5.5247 16.213 5.30047C16.1672 5.16457 16.1213 5.02612 15.9688 5.00319C15.8022 4.97686 15.7372 5.1187 15.6722 5.23762C15.4114 5.72345 15.3105 6.25856 15.3205 6.80045C15.343 8.02014 15.848 8.99182 16.8522 9.68236C16.9663 9.76135 16.9955 9.84119 16.9597 9.9567C16.8913 10.1945 16.8097 10.4256 16.738 10.6642C16.6922 10.8163 16.6238 10.8485 16.4638 10.7831C15.9232 10.5463 15.4322 10.2061 15.0172 9.78088C14.303 9.07761 13.6581 8.30129 12.8531 7.69314C12.6666 7.55267 12.475 7.41923 12.2789 7.29309C11.4581 6.48024 12.3873 5.81264 12.6022 5.73365C12.8272 5.65041 12.6797 5.36672 11.9531 5.37012C11.2264 5.37351 10.5615 5.62068 9.71397 5.95108C9.58804 6.00027 9.45846 6.03918 9.32648 6.06745C8.53452 5.91535 7.72455 5.88615 6.92403 5.98081C5.35322 6.15918 4.09908 6.91682 3.1766 8.2087C2.06829 9.76135 1.80746 11.5263 2.12662 13.3661C2.46245 15.306 3.4341 16.9122 4.92657 18.1675C6.47487 19.4696 8.25733 20.1075 10.2915 19.9852C11.5264 19.913 12.9022 19.744 14.453 18.4054C14.8447 18.6041 15.2547 18.6831 15.9364 18.7426C16.4613 18.7927 16.9663 18.7171 17.3572 18.6338C17.9696 18.5013 17.9271 17.9229 17.7063 17.8176C15.9105 16.9648 16.3047 17.3122 15.9455 17.0311C16.8588 15.9303 18.2338 14.7871 18.7721 11.083C18.8138 10.7882 18.778 10.6031 18.7721 10.3652C18.7688 10.2209 18.8013 10.1639 18.9638 10.1478C19.4146 10.1001 19.852 9.96309 20.2513 9.74436C21.4146 9.09629 21.8846 8.03289 21.9954 6.75713C22.0121 6.56178 21.9921 6.36133 21.7896 6.25856ZM11.6506 17.7403C9.9098 16.3456 9.06565 15.8861 8.71733 15.9057C8.39066 15.9261 8.44983 16.3057 8.5215 16.5537C8.59649 16.7984 8.69399 16.9665 8.83066 17.1814C8.92565 17.3233 8.99065 17.5348 8.73649 17.6936C8.17567 18.0469 7.20152 17.5747 7.15569 17.5518C6.02154 16.8706 5.0724 15.9719 4.40491 14.7429C3.75992 13.5597 3.38493 12.2908 3.32327 10.936C3.3066 10.6082 3.40076 10.4927 3.72076 10.4332C4.14084 10.3513 4.57126 10.3401 4.9949 10.4001C6.77153 10.6651 8.28317 11.4745 9.55148 12.7562C10.2748 13.4867 10.8223 14.359 11.3864 15.2117C11.9864 16.1172 12.6314 16.9801 13.4531 17.6868C13.7431 17.9348 13.9739 18.1234 14.1956 18.2618C13.5272 18.3383 12.4123 18.3553 11.6506 17.7403ZM12.4839 12.2704C12.4838 12.2282 12.4937 12.1866 12.5129 12.1492C12.532 12.1118 12.5598 12.0797 12.5939 12.0557C12.6279 12.0317 12.6672 12.0165 12.7083 12.0114C12.7494 12.0064 12.7911 12.0116 12.8297 12.0266C12.879 12.0446 12.9216 12.0779 12.9515 12.1217C12.9813 12.1656 12.9971 12.2178 12.9964 12.2712C12.9965 12.3057 12.9899 12.3399 12.9769 12.3717C12.964 12.4036 12.9449 12.4325 12.9208 12.4568C12.8968 12.481 12.8683 12.5002 12.8369 12.5131C12.8055 12.526 12.7719 12.5324 12.7381 12.532C12.7045 12.5321 12.6712 12.5254 12.6402 12.5122C12.6092 12.4991 12.5811 12.4798 12.5575 12.4554C12.5339 12.4311 12.5153 12.4021 12.5028 12.3704C12.4903 12.3386 12.4834 12.3046 12.4839 12.2704ZM15.0755 13.626C14.9089 13.6948 14.743 13.7542 14.5839 13.7619C14.3444 13.7704 14.1095 13.6942 13.9189 13.5461C13.6906 13.3508 13.5272 13.2421 13.4589 12.9023C13.4353 12.7363 13.4398 12.5674 13.4722 12.4029C13.5306 12.1251 13.4656 11.9468 13.2731 11.7854C13.1172 11.6529 12.9181 11.6164 12.6997 11.6164C12.625 11.6119 12.5524 11.5892 12.4881 11.5501C12.3964 11.5043 12.3214 11.3887 12.3931 11.246C12.4164 11.2002 12.5264 11.0881 12.5531 11.0677C12.8497 10.8961 13.1922 10.9522 13.5081 11.0813C13.8014 11.2036 14.0231 11.4278 14.3422 11.7455C14.668 12.1285 14.7272 12.2347 14.913 12.5218C15.0597 12.7469 15.193 12.9779 15.2839 13.2421C15.3397 13.4077 15.268 13.5427 15.0755 13.626Z" fill="#4D6BFE" />
</svg>} horizontal />;

<DeepSeekIconCard title="Deploy Deepseek R1" href="https://www.baseten.co/talk-to-us/deepseek/" />

# Example usage

DeepSeek-R1 is optimized using SGLang and uses an OpenAI-compatible API endpoint.

## Input

```python  theme={"system"}
import httpx
import os

MODEL_ID = "abcd1234"  # Replace this with your model ID
DEPLOYMENT_ID = "abcd1234"  # [Optional] Replace this with your deployment ID
API_KEY = os.environ["BASETEN_API_KEY"]

resp = httpx.post(
    f"https://model-{MODEL_ID}.api.baseten.co/environments/production/sync/v1/chat/completions",
    headers={"Authorization": f"Api-Key {API_KEY}"},
    json={
        "model": "deepseek_v3",
        "messages": [
            {"role": "system", "content": "You are a helpful AI assistant."},
            {"role": "user", "content": "What weighs more, a pound of bricks or a pound of feathers?"},
        ],
        "max_tokens": 1024,
    },
    timeout=None
)

print(resp.json())
```

## Output

```json  theme={"system"}
{
  "id": "8456fe51db3548789f199cfb8c8efd35",
  "object": "text_completion",
  "created": 1735236968,
  "model": "/models/deepseek_r1",
  "choices": [
    {
      "index": 0,
      "text": "Let's think through this step by step...",
      "logprobs": null,
      "finish_reason": "stop",
      "matched_stop": 1
    }
  ],
  "usage": {
    "prompt_tokens": 14,
    "total_tokens": 240,
    "completion_tokens": 226,
    "prompt_tokens_details": null
  }
}
```