All insights

Pricing and plans

DeepSeek API: Access, Integration and Costs

Choose direct DeepSeek access or a documented Cloudflare gateway route, make a first request, check current model IDs, and estimate token costs with peak and off-peak rates.

Illustration for DeepSeek API: Access, Integration and Costs

For a direct API call, create a DeepSeek API key, use https://api.deepseek.com, and send the key as a Bearer token. DeepSeek’s pricing page lists deepseek-flash and deepseek-v4-pro, with separate per-token rates and peak/off-peak prices. Its September routing announcement described a temporary change for V4 Pro; later official documentation lists V4 Pro API service and a separate V4 Pro pricing row, so don’t treat that earlier notice as a definitive statement of current routing. DeepSeek quick start · Current model and pricing table · DeepSeek V4 Pro update

Direct DeepSeek API or an API platform?

Choose the direct route to send requests to DeepSeek with a key created through the DeepSeek Platform. Its API documentation requires an API key and shows Bearer authentication. The documented OpenAI-compatible base URL is https://api.deepseek.com; the Anthropic-compatible base URL is https://api.deepseek.com/anthropic. DeepSeek API documentation

Choose a platform or gateway route when you want that service between your application and DeepSeek. The endpoint and credential depend on the service. Cloudflare AI Gateway, for example, documents both passing a DeepSeek provider token in the request and storing a DeepSeek key with its BYOK feature. In the stored-key flow, the request uses a Cloudflare gateway token while the gateway supplies the stored DeepSeek key. That is Cloudflare’s specific arrangement—not a rule for every platform. Cloudflare’s DeepSeek integration · Cloudflare BYOK setup

Route Credential used in the request Request goes to
Direct DeepSeek DeepSeek API key, sent as a Bearer token api.deepseek.com
Cloudflare Gateway with provider key DeepSeek token, sent as a Bearer token Your Cloudflare Gateway URL
Cloudflare Gateway with stored-key BYOK Cloudflare AI Gateway authorization token; the gateway supplies the stored DeepSeek key Your Cloudflare Gateway URL

Make your first direct API request

  1. Create a DeepSeek API key.
  2. Add funds or confirm you have granted balance available. DeepSeek says model fees are deducted from topped-up or granted balance, using granted balance first when both are available. DeepSeek pricing and deduction rules
  3. Set the key in DEEPSEEK_API_KEY or your application’s secret manager; don’t commit it to source code.
  4. Send a chat-completions request:
curl https://api.deepseek.com/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
  -d '{
    "model": "deepseek-flash",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ],
    "stream": false
  }'

This uses the documented direct endpoint, Bearer authentication, model field, and messages format. DeepSeek’s fuller example also includes thinking and reasoning_effort fields; they are not needed for this minimal request. Its OpenAI SDK examples read the answer from response.choices[0].message.content. DeepSeek also says stream can be set to true for streamed output. DeepSeek quick start

Example: route through Cloudflare AI Gateway

This is a Cloudflare-specific URL pattern, not a direct DeepSeek endpoint. Cloudflare’s integration lists an account ID, gateway name, active DeepSeek API token, and model name as prerequisites.

Model support caveat before using the pattern below: Cloudflare’s provider-specific example uses deepseek-chat; the captured integration instructions do not confirm that this route accepts the current deepseek-flash ID. DeepSeek’s own model guidance identifies deepseek-flash for its direct route. Use the direct request above for a documented first Flash call. The following is only the Cloudflare URL and authentication pattern; the model placeholder is intentionally not a claim of a verified, callable model ID. Cloudflare DeepSeek integration · DeepSeek model guidance

For an authenticated Cloudflare Gateway, create an authentication token in that gateway’s Settings and save it securely; Cloudflare says it will not be displayed again. For provider-native URLs at gateway.ai.cloudflare.com, send that token in cf-aig-authorization. Cloudflare authenticated gateway setup

curl "https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/chat/completions" \
  -H "Content-Type: application/json" \
  -H "cf-aig-authorization: Bearer ${CF_AIG_TOKEN}" \
  -d '{
    "model": "<model ID confirmed for this Cloudflare route>",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Cloudflare also documents a provider-key arrangement: use the same provider-specific route and send the DeepSeek key as Authorization: Bearer ${DEEPSEEK_TOKEN}. Do not send both credential patterns as if they were interchangeable. Cloudflare DeepSeek integration

For stored-key BYOK, add the DeepSeek key in the Cloudflare dashboard: select your account, open AI > AI Gateway, choose a gateway, go to Provider Keys, select Add API Key, choose DeepSeek, enter the key, and save. Then omit the provider Authorization header and use the Cloudflare token in cf-aig-authorization. Cloudflare says the gateway substitutes the stored provider key when the provider authorization header is absent. Cloudflare BYOK instructions

You can create a gateway in the Cloudflare dashboard under AI > AI Gateway. Cloudflare also documents automatic creation of a gateway named default on the first authenticated request to that default gateway; other gateway names must be created first. Gateway setup

DeepSeek API model names and versions

Use the API model ID in your request, and distinguish that ID from the underlying model version serving it.

API model ID Officially listed model version or status Practical guidance
deepseek-flash DeepSeek-V4.1-Flash-1017 Use this documented ID for the direct Flash route.
deepseek-v4-pro The current pricing table lists DeepSeek-V4-Pro-0813 and separate Pro rates. The September 10 announcement described routing V4 Pro requests to V4.1-Flash at Flash rates until V4.1-Pro launched. Later official updates say V4 Pro API service continued after September 14, and the current pricing table again lists a Pro version and rates. The public update trail does not clearly state the exact current live routing behavior; verify model identity and billing for your use case.
deepseek-v4-flash and deepseek-v4-flash-vision-exp Legacy names remain accepted, but the corresponding models are retired; requests route to V4.1-Flash and are billed at the Flash price. Prefer deepseek-flash for new integrations.
deepseek-chat and deepseek-reasoner DeepSeek’s V4 announcement said these names would become inaccessible after July 24, 2026, 15:59 UTC. Don’t use them for a new integration.

Check DeepSeek’s pricing page and change log for updated identifiers and routing before implementation. Current model details · V4 announcement · September routing announcement · October change log

DeepSeek API pricing and a cost estimate

DeepSeek lists prices in USD per 1 million tokens and bills based on input and output token counts. Peak hours are 01:00–04:00 and 06:00–10:00 UTC, Monday through Friday, excluding Chinese public holidays. All other times—including weekends and Chinese public holidays—are off-peak; off-peak rates are half the peak rates. Official pricing table and schedule

Model and rate category Peak, per 1M tokens Off-peak, per 1M tokens
Flash input, cache hit $0.006 $0.003
Flash input, cache miss $0.30 $0.15
Flash output $1.20 $0.60
V4 Pro input, cache hit $0.044 $0.022
V4 Pro input, cache miss $1.32 $0.66
V4 Pro output $3.96 $1.98

Worked Flash example: For 100,000 uncached input tokens and 10,000 output tokens at peak rates:

  • Input: 100,000 ÷ 1,000,000 × $0.30 = $0.030
  • Output: 10,000 ÷ 1,000,000 × $1.20 = $0.012
  • Total: $0.042

At off-peak rates, the same token counts cost approximately $0.021. If input tokens qualify for the cache-hit rate, the estimate changes. Actual charges depend on token use, cache treatment, the model route, and the rates in force when the request runs. DeepSeek says prices may change, so check its pricing page before budgeting.

What a Cloudflare route adds to the cost

Cloudflare says AI Gateway’s core features are free on all plans, and provider inference pricing is passed through without markup. If you use Cloudflare Unified Billing, it applies a 5% fee to credits purchased; Cloudflare also notes that some log exports follow separate Logpush pricing. These are Cloudflare terms, distinct from DeepSeek’s token rates. Cloudflare AI Gateway pricing

Which route should you choose?

  • Use the direct API for a direct request to DeepSeek: create a DeepSeek key, ensure you have balance, and use the official endpoint and model ID.
  • Use a gateway when you need that gateway’s own routing or credential-management features. Follow its endpoint and authentication instructions; Cloudflare’s BYOK flow is not a universal platform pattern.
  • For new direct Flash requests, use deepseek-flash. For V4 Pro, the current price table lists separate Pro rates, but the September routing notice and later updates make it important to verify the live model route for your account.

For model-family comparisons, see the DeepSeek models guide.

Sources

Models & Pricing | DeepSeek API Docs

DeepSeek-V4.1-Flash: Smarter, Faster, More Efficient

DeepSeek-V4-Pro GA Release

Change Log | DeepSeek API Docs

DeepSeek V4 Preview Release

Your First API Call | DeepSeek API Docs

DeepSeek API | DeepSeek API Docs

DeepSeek · Cloudflare AI Gateway docs

BYOK (Store Keys) · Cloudflare AI Gateway docs

Authenticated Gateway · Cloudflare AI Gateway docs

Manage gateways · Cloudflare AI Gateway docs

Pricing · Cloudflare AI Gateway docs

Contact us