AiCredits
Pricing Guide

DeepSeek API Pricing 2026: Full Breakdown and Rate Tiers

How DeepSeek API pricing works in 2026: cache hits vs misses, peak vs off-peak, flash vs pro, plus runnable code to measure and cap your spend.

Published 2026-11-14 Updated 2026-11-14 8 min

Most "DeepSeek API pricing" articles are a single table of numbers that goes stale the moment a promotion ends. That is not useful if you are shipping a product. What you actually need is the shape of the pricing model: which levers move your bill, by roughly how much, and how to verify the effect on your own traffic.

This breakdown covers the rate tiers that matter in 2026 — model tier, cache hit versus cache miss, peak versus off-peak, input versus output length — and gives you runnable Python to measure each one against your real workload. Current rates live on the pricing page at aicreditsapi.com/pricing; the mechanics below are what stay true.

What actually determines your DeepSeek bill

Five multipliers decide almost every invoice. Understanding them in advance is cheaper than optimising after the fact, because two of them (cache behaviour and peak timing) are decided by how you write the request, not by which model you pick.

  • Model tier. deepseek-v4-flash is the fast default and the cheaper option per token. deepseek-v4-pro costs more but handles harder reasoning. Most production traffic should never touch pro.

  • Cache hit vs cache miss. Input tokens that match a previously sent prefix bill at a lower cached rate; fresh tokens bill at the full input rate. A stable system prompt is the difference between the two.

  • Peak vs off-peak. Off-peak windows are discounted. Batch jobs, backfills and evaluations belong there.

  • Input vs output. Output tokens are priced higher than input tokens on every tier. Verbose answers are the most common silent cost.

  • Context length. Every turn resends history. A long conversation multiplies input tokens even when your question is one line.

The rate tiers, side by side

Rather than quoting figures that change, here is the structure. Use it to reason about your workload, then read exact rates from the pricing page.

Tier / dimensionEffect on priceHow you control it
deepseek-v4-proHigher per token than flashEscalate only after flash fails an eval
deepseek-v4-flashBaseline, cheapest general tierDefault for chat, extraction, classification, linting
Cache hit (input)Cheaper than fresh inputKeep an identical prefix; put variable text last
Cache miss (input)Full input rateAvoid timestamps or user IDs in the system prompt
Off-peak windowDiscounted versus peakSchedule batch and eval jobs
Output tokensPriced above input tokensSet max_tokens; request terse formats
Long contextMore billable tokens per callTrim or summarise history; cap turns

Step 1: measure before you optimise

Every response carries a usage object. Log it from day one — you cannot tune what you do not see. This script prints the token split for a single call.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AICREDITS_API_KEY"],
    base_url="https://api.aicreditsapi.com/v1",
)

resp = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[
        {"role": "system", "content": "Answer in one sentence."},
        {"role": "user", "content": "What is a token in an LLM?"},
    ],
)

u = resp.usage
print(f"prompt={u.prompt_tokens} completion={u.completion_tokens} total={u.total_tokens}")
print(resp.choices[0].message.content)

Run that against three representative prompts from your app. If completion tokens exceed prompt tokens, your output formatting is the first thing to fix — not the model choice.

How caching splits one prompt into two rates

Prompt caching rewards a specific request layout: a long, byte-identical prefix followed by the variable part. Put the system prompt, style rules and reference material first. Put the user's question last. Do not interpolate a timestamp, session ID or username into the system prompt — that single habit invalidates the cache on every call and quietly moves all your input to the full rate.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AICREDITS_API_KEY"],
    base_url="https://api.aicreditsapi.com/v1",
)

# Stable prefix: never interpolate dynamic values into this string.
STYLE_GUIDE = """You are a support assistant for a developer tool.
Rules:
- Answer in at most three sentences.
- Never invent endpoints or parameters. If unsure, say so.
- Plain English, no marketing tone."""

def ask(question: str) -> str:
    resp = client.chat.completions.create(
        model="deepseek-v4-flash",
        messages=[
            {"role": "system", "content": STYLE_GUIDE},
            {"role": "user", "content": question},
        ],
        max_tokens=300,
    )
    u = resp.usage
    hit = getattr(u, "prompt_cache_hit_tokens", None)
    miss = getattr(u, "prompt_cache_miss_tokens", None)
    print(f"prompt={u.prompt_tokens} completion={u.completion_tokens} "
          f"cache_hit={hit} cache_miss={miss}")
    return resp.choices[0].message.content

print(ask("How do I rotate an API key?"))
print(ask("What happens when I hit a rate limit?"))

If your usage object exposes cache counters, the first call should show a miss and the second a hit on the shared prefix. If you see misses on both, something in your prefix is changing between calls — check for timestamps, UUIDs, or a reordered dictionary being serialised into the prompt.

Peak versus off-peak: push batch work down the clock

Off-peak pricing exists because capacity is not free to hold. Interactive features — chat, autocomplete, lint-on-save — should run whenever the user does. Everything else does not need to. Nightly re-indexing, evaluation sweeps, backfilling embeddings for old documents, regenerating summaries: schedule those into the discounted window and the saving applies to work nobody was waiting for.

The practical version is a queue with a flag. Enqueue everything; let an interactive worker drain the urgent tier immediately and a batch worker drain the rest on an off-peak schedule. Two workers, one codebase, no user-visible latency change.

Flash versus pro: route instead of guessing

The expensive mistake is not using pro — it is using pro for everything because you are afraid flash will underperform. Route by task shape, then verify with a small eval set built from your own production prompts.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AICREDITS_API_KEY"],
    base_url="https://api.aicreditsapi.com/v1",
)

HARD_TASKS = ("prove", "derive", "refactor", "debug", "multi-step", "architect")

def pick_model(task: str) -> str:
    return "deepseek-v4-pro" if any(k in task.lower() for k in HARD_TASKS) else "deepseek-v4-flash"

def solve(task: str) -> str:
    model = pick_model(task)
    resp = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": task}],
        max_tokens=800,
    )
    print(f"[{model}] total_tokens={resp.usage.total_tokens}")
    return resp.choices[0].message.content

print(solve("Summarise this changelog in three bullets: ..."))
print(solve("Debug why this async loop deadlocks: ..."))

Start with pro enabled for nothing. Promote a task category to pro only when flash produces a measurably worse answer on your eval set. In most codebases that ends up being a narrow slice of traffic.

A budget guard you can drop into a pipeline

Rates change; your accounting should not care. Read the per-million-token figures from the pricing page into environment variables once, and let the code stay constant. This tracker prints a running estimate as it works.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AICREDITS_API_KEY"],
    base_url="https://api.aicreditsapi.com/v1",
)

# Fill these from aicreditsapi.com/pricing. Keep them out of source control.
IN_PER_MTOK = float(os.environ.get("PRICE_INPUT_PER_MTOK", "0"))
OUT_PER_MTOK = float(os.environ.get("PRICE_OUTPUT_PER_MTOK", "0"))

def cost_of(usage) -> float:
    return (
        usage.prompt_tokens / 1_000_000 * IN_PER_MTOK
        + usage.completion_tokens / 1_000_000 * OUT_PER_MTOK
    )

spent = 0.0
for q in ["Explain prompt caching.", "Explain tokenisation."]:
    r = client.chat.completions.create(
        model="deepseek-v4-flash",
        messages=[{"role": "user", "content": q}],
        max_tokens=200,
    )
    c = cost_of(r.usage)
    spent += c
    print(f"{q!r} -> {r.usage.total_tokens} tokens, ~{c:.6f}")

print(f"run total ~{spent:.6f}")

Rule of thumb: fix output length first, cache layout second, off-peak scheduling third, and model downgrades last. That order costs you nothing in answer quality.

Where to buy the credits

DeepSeek's own platform is the first-party option: official documentation, direct access, and the reference implementation of every feature. If your team already has the accounts and payment rails it needs, it is a perfectly good place to buy. The friction shows up for developers outside mainland China who do not have a local phone number or bank account, or who need to pay with an international card or PayPal and reconcile it against a company expense report.

AiCredits exists for exactly that gap: DeepSeek API credits purchasable internationally, with the same OpenAI-compatible endpoint you see in every snippet above — you change the base_url and the key, nothing else. AiCredits also ships code linting tools, which is why the examples here lean on clean, copy-pasteable Python.

ConsiderationDeepSeek directAiCredits
Access to deepseek-v4-flash / proYesYes
Payment methodLocal rails, card where supportedInternational card or PayPal
Chinese phone / bank requiredTypically yes for signupNo
API compatibilityNativeOpenAI SDK, same request shape
Docs and ecosystemFirst-party, deepestFocused on international onboarding
Support languagePrimarily Chinese-firstEnglish

FAQ

Is it cheaper to cache or to shorten the prompt?

Shorten first. Caching only lowers the rate on tokens you were already sending; removing tokens removes them from the bill entirely. Do both, but delete before you cache.

Do I need a Chinese phone number to use DeepSeek models?

Not through AiCredits. You sign up internationally, pay by card or PayPal, and call the same OpenAI-compatible endpoint. Direct DeepSeek signup generally expects local verification.

Should I default to deepseek-v4-pro?

No. Default to deepseek-v4-flash and promote specific task categories to pro only after they fail on an eval set you built from real prompts. Pro costs more per token and is wasted on classification, extraction and formatting work.

How do I check current rates?

Rates and tier discounts change, so read them live at aicreditsapi.com/pricing rather than trusting a cached article, then load them into the PRICE_INPUT_PER_MTOK and PRICE_OUTPUT_PER_MTOK environment variables used in the tracker above.

Why does my bill jump when conversations get long?

Every turn resends the full history as input tokens. Cap the number of turns, or summarise older messages into a short block before appending the new question.

Try Lint in 2 seconds

Wrote something? Paste it here for a free grammar check. No account needed.

More Tools →

Related Tools

💻Code Explainer

Was this article helpful?

| Share on X Reddit Copy link

服务器宕机了?别等用户告诉你

Wakeless 梦哨 帮你 30 秒监控网站 / API / SSL 证书,宕机秒级告警到邮箱、飞书、Slack。免费档 30 个监控,永久免费,无需信用卡。

免费开始监控 →
💬
反馈意见 / Feedback ×