DeepSeek API

DeepSeek bills its API per 1M tokens, with a peak and an off-peak price. DeepSeek V4.1 Flash 1017 is $0.15 input and $0.60 output per 1M tokens off-peak, $0.30 and $1.20 at peak. DeepSeek V4 Pro 0813 is $0.66 input and $1.98 output off-peak, $1.32 and $3.96 at peak. From DeepSeek's pricing page, checked 25 November 2026. [1]

Updated

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.straitly.ai/v1",
    api_key=os.environ["STRAITLY_API_KEY"],
)
reply = client.chat.completions.create(
    model="deepseek/deepseek-v4-1-flash-1017",
    messages=[{"role": "user",
               "content": "Hello"}],
)

What does the DeepSeek API cost?

DeepSeek's own prices per 1M tokens: off-peak, and peak, which is twice off-peak [1].

USD per 1M tokens, input / output

ModelDeepSeek off-peakDeepSeek peak
DeepSeek V4.1 Flash 1017· deepseek/deepseek-v4-1-flash-1017$0.15 / $0.60$0.30 / $1.20
DeepSeek V4 Pro 0813· deepseek/deepseek-v4-pro-0813$0.66 / $1.98$1.32 / $3.96

Newest first: the models DeepSeek sells on its own API. Prices are its cache miss input and its output, from DeepSeek's pricing page, checked 25 November 2026; “Off-peak rates are half of the peak rates.” [1]. DeepSeek lists a 1M context length and a 384K max output for its API models [1]. Each model's rate on Straitly is on its own page.

Cache hit prices

Cache hit (cache read), USD per 1M tokens

ModelDeepSeek cache hit off-peakDeepSeek cache hit peak
DeepSeek V4.1 Flash 1017$0.003$0.006
DeepSeek V4 Pro 0813$0.022$0.044

DeepSeek bills input it already holds in its cache at the cache hit price, from its pricing page, checked 25 November 2026 [1].

When are DeepSeek peak hours?

“Peak hours are 01:00 - 04:00 and 06:00 - 10:00 UTC, Monday through Friday, excluding Chinese public holidays.” “All other hours are off-peak, including weekends and Chinese public holidays in full.” [1]

WindowHours (UTC)DaysPrice
Peak01:00 to 04:00 and 06:00 to 10:00Monday to Friday, except Chinese public holidaysDeepSeek's peak price
Off-peakAll other hoursEvery day; weekends and Chinese public holidays in fullHalf the peak price
StraitlyEvery hourEvery dayOne rate per model

Peak and off-peak hours are DeepSeek's, from its pricing page on 25 November 2026 [1]. Straitly's catalog lists one rate per model with no peak hours [7].

How do I get a DeepSeek API key?

Four steps, from DeepSeek's own docs [1-3]. Or use one Straitly key for DeepSeek and all 117 models [8][10].

  1. Sign in to the DeepSeek Platform

    At platform.deepseek.com [2].

  2. Create a key

    On the API keys page [3].

  3. Top up a balance

    Fees are deducted from a topped-up or granted balance [1].

  4. Set DEEPSEEK_API_KEY

    Base URL https://api.deepseek.com, model deepseek-flash (DeepSeek-V4.1-Flash-1017) or deepseek-v4-pro (DeepSeek-V4-Pro-0813) [1][2].

On Straitly: sign up, create a key, then set the base URL to https://api.straitly.ai/v1 and the model to deepseek/deepseek-v4-1-flash-1017, as in the sample at the top. The quickstart has the steps [10].

What happened to DeepSeek V4 Flash 0731?

DeepSeek released V4 Flash 0731 on 31 July 2026 and has since retired V4 Flash [5]. New code calls deepseek-flash [1][2], and the old names still work: “The legacy names deepseek-v4-flash and deepseek-v4-flash-vision-exp are still accepted, but the corresponding models have been retired, their requests are served by the DeepSeek-V4.1-Flash-1017 model and billed at the Flash price.” [1]

Old API nameServed byBilled atOn Straitly
deepseek-v4-flashDeepSeek-V4.1-Flash-1017Flash pricedeepseek/deepseek-v4-1-flash-1017
deepseek-v4-flash-vision-expDeepSeek-V4.1-Flash-1017Flash pricedeepseek/deepseek-v4-1-flash-1017

Old names and what serves them are DeepSeek's, from its pricing page on 25 November 2026 [1]. On Straitly, call DeepSeek V4.1 Flash 1017 by its own id for new code; older DeepSeek models Straitly still serves are on /models [8].

Can I use DeepSeek in Claude Code?

Yes. DeepSeek's own guide points Claude Code at https://api.deepseek.com/anthropic with ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN [4]. Through Straitly, the same two settings point at https://api.straitly.ai; then pick DeepSeek V4.1 Flash 1017 with /model.

export ANTHROPIC_BASE_URL="https://api.straitly.ai"
export ANTHROPIC_AUTH_TOKEN="sk-YOUR_KEY"
claude
/model deepseek/deepseek-v4-1-flash-1017

Anthropic says it “doesn’t support routing Claude Code to non-Claude models through any gateway” [6], so DeepSeek in Claude Code is a setup DeepSeek documents, not Anthropic. The Claude Code API guide has the full setup.

What else do people ask about the DeepSeek API?

Ask a question
  • The DeepSeek API is DeepSeek's paid API for its models, billed per 1M tokens. “The DeepSeek API uses an API format compatible with OpenAI/Anthropic.” [2] DeepSeek's newest model is DeepSeek V4.1 Flash 1017. On Straitly the same models are on one OpenAI-compatible key with all 117 models [8].
  • DeepSeek V4.1 Flash 1017 lists at $0.15 input and $0.60 output per 1M tokens off-peak, and $0.30 and $1.20 at peak. DeepSeek V4 Pro 0813 lists at $0.66 input and $1.98 output per 1M tokens off-peak, and $1.32 and $3.96 at peak. Those are DeepSeek's prices, matched on its pricing page on 25 November 2026. On Straitly you pay one rate per model at every hour; each model's rate is on its own page. [1][8]
  • No. DeepSeek's pricing page says: “The corresponding fees will be directly deducted from your topped-up balance or granted balance” [1]. On Straitly you pay per token from prepaid credits, with no subscription and no minimum, and a failed request costs nothing [9].
  • No. Zero data retention is on by default for every Straitly account and key: prompts and completions are never written to disk or logs and never used for training. Only billing metadata is kept: timestamp, model, key, token counts, latency, status and the amount charged [11].

Sources

Last updated: . DeepSeek changes prices and model versions often. If something here is out of date, tell us at straitly.ai/contact. Other price lists: the LLM API price index, Qwen API and Kimi API.

  1. [1]DeepSeek API docs: Models & Pricingapi-docs.deepseek.com, checked 25 November 2026
  2. [2]DeepSeek API docs: Your First API Callapi-docs.deepseek.com, checked 25 November 2026
  3. [3]DeepSeek Platform: API keysplatform.deepseek.com, checked 25 November 2026
  4. [4]DeepSeek API docs: Integrate with Claude Codeapi-docs.deepseek.com, checked 25 November 2026
  5. [5]DeepSeek API docs: Change Logapi-docs.deepseek.com, checked 25 November 2026
  6. [6]Claude Code docs: LLM gatewayscode.claude.com, checked 25 November 2026
  7. [7]Straitly model catalogstraitly.ai/api/catalog, checked 25 November 2026
  8. [8]Straitly modelsstraitly.ai/models, checked 25 November 2026
  9. [9]Straitly pricingstraitly.ai/pricing, checked 23 November 2026
  10. [10]Straitly docs: quickstartstraitly.ai/docs/quickstart, checked 23 November 2026
  11. [11]Straitly data retentionstraitly.ai/docs/data-retention, checked 23 November 2026
What each source says
DeepSeek API docs: Models & Pricing
DeepSeek's per-model prices per 1M tokens (cache hit, cache miss and output, off-peak and peak), peak hours, base URLs, context and output limits, and the retired V4 Flash names.
DeepSeek API docs: Your First API Call
The DeepSeek API uses an OpenAI and Anthropic compatible format; the base URLs, model names and the DEEPSEEK_API_KEY variable.
DeepSeek Platform: API keys
Where DeepSeek's first-call guide sends you to apply for an API key.
DeepSeek API docs: Integrate with Claude Code
DeepSeek's own steps for running Claude Code on its Anthropic-format endpoint with ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN.
DeepSeek API docs: Change Log
The 31 July 2026 entry releases DeepSeek-V4-Flash-0731 on the API. The 10 September 2026 entry retires V4 Flash and names deepseek-flash for V4.1 Flash.
Claude Code docs: LLM gateways
Anthropic does not support routing Claude Code to non-Claude models through any gateway.
Straitly model catalog
Every model Straitly serves, with its maker's own price. The model names and release days on this page are the catalog's on 25 November 2026.
Straitly models
All 117 models on one Straitly key, with ids, context windows and each model's current rate.
Straitly pricing
Billed per token from prepaid credits. Nothing is added on top. A failed request costs nothing. No subscription and no minimum.
Straitly docs: quickstart
Create a Straitly key and make a first call with the OpenAI or Anthropic SDK.
Straitly data retention
Zero data retention on by default for every account and key; prompts and completions never written to disk or logs and never used for training; only billing metadata is kept.

Start with one request.

Prepaid, per token, no subscription and no minimum.