Back to Blog
EnglishTutorial

DeepSeek V4 Pro Pricing: Test Peak, Off-Peak and Cached-Input Estimates

A current deepseek-v4-pro gateway rate check, two live JSON requests and five Decimal fixtures separate usage estimates from actual billing and untested discounts.

B
Boluo Z
October 11, 2026 / 365 views
Share:
DeepSeek V4 Pro Pricing: Test Peak, Off-Peak and Cached-Input Estimates

To estimate deepseek-v4-pro API cost, keep ordinary input, cached input and output separate, then apply the exact route and account-group rate. This guide checks the public configuration and runs two small requests; calculated amounts are estimates, not retrieved account charges.

Crazyrouter was the gateway for this 2-case experiment: 2 cases met the declared complete-output criterion; the results below retain the failures and their limits.

By Boluo Z · Tested November 3, 2026

DeepSeek V4 API pricing and how to call it#

The gateway exposes separate off-peak rates of USD 0.67 input, USD 0.03 cached input and USD 2 output, and peak rates of USD 1.34, USD 0.05 and USD 4 per million tokens. The native DeepSeek page checked for this revision lists different V4 Pro figures: off-peak USD 0.66/USD 0.022/USD 1.98 and peak USD 1.32/USD 0.044/USD 3.96 in the same order. These are separate services with separate schedules; do not transfer one service’s calendar exceptions into the other.

November 3 experiment and observed results#

The scripts ran on Windows with Python 3.10.2 and synthetic inputs. Gateway generation and catalog requests use https://api.crazyrouter.com; paths and complete payloads appear in the code. Each result describes this run only. A test program exiting successfully means its observations were recorded, not that every model response passed.

Requested model IDVisible to this credential
deepseek-v4-proYes
Service / groupTierInput USD / 1MCached input USD / 1MOutput USD / 1M
Crazyrouter / defaultoff_peak0.670.032
Crazyrouter / defaultpeak1.340.054
Route / caseHTTP or turnsFinish / outcomeAcceptedObserved output or error
deepseek-v4-pro / short answer200stopYes{"quantity":4}
deepseek-v4-pro / empty record200stopYes{"quantity":0}
CasePromptCompletionReported cachedCalculated USD by rate scenario
short answer91330off_peak = 0.00012697; peak = 0.00025394
empty record91340off_peak = 0.00012897; peak = 0.00025794

Observed successful-envelope response IDs (failed acceptance can still have an ID):

text
02c69fb5-8f38-47a7-a5b1-033e642109ef
7eabd0d9-17c1-4b0c-a64c-82a1f195001f
Executed local caseExpected behavior met
uncachedYes
cached subsetYes
emptyYes
cached exceeds inputYes
boolean rejectedYes

Inspected default-group rates: Public gateway configuration; not an account invoice

What the live usage actually shows#

The two JSON calls passed and reported 91 input tokens with 33 and 34 completion tokens. Applying both gateway rate scenarios gives USD 0.00012697/USD 0.00025394 for the first and USD 0.00012897/USD 0.00025794 for the second, off-peak/peak respectively. These are scenario calculations; the script does not query the actual charged ledger or infer holiday handling.

Calculate from counters without inventing extra usage#

The estimator computes (prompt minus cached) × input rate + cached × cache rate + completion × output rate, then divides by one million. Cached tokens are a subset of prompt tokens in this contract. Completion reasoning counters are diagnostic subsets and are not added again.

Five local cases check ordinary usage, a cached subset, zero usage, cached tokens exceeding the prompt and boolean values masquerading as integer counters. The last two are rejected. Missing cached-token details are treated as zero for this estimate; if your billing source reports cache usage separately, reconcile that source rather than assuming this fallback is a proven cache miss.

Know when this estimate stops applying#

The rate loader reads the default group. Another account group, custom arrangement or changed billing rule can produce a different result. The program recognizes only the inspected billing modes and static expression shape. It never executes a remote pricing expression with eval.

No tool charges, taxes, storage, retries or separately billed services were exercised. Two correct small JSON outputs do not validate long context, streaming, tools, vision or workload-wide quality. Verify those features and reconcile actual usage against the ledger before using the estimate as an invoice forecast.

Reproduce the experiment#

Install requests, set CRAZYROUTER_API_KEY in the process environment, save this complete script and run it with Python 3.10 or later. Requests use your authorized credential and can consume usage. Authorization headers are not printed.

python
import json
import os
import time
import requests

BASE = "https://api.crazyrouter.com/v1"

def catalog(models):
    with requests.Session() as s:
        s.trust_env=False
        r=s.get(BASE+"/models",headers={"Authorization":"Bearer "+os.environ["CRAZYROUTER_API_KEY"]},timeout=(10,40),allow_redirects=False)
        r.raise_for_status();names={x["id"] for x in r.json()["data"]}
    return {m:m in names for m in models}

def chat(model,prompt,**options):
    payload={"model":model,"messages":[{"role":"user","content":prompt}],**options}
    record={"model":model,"request":payload};start=time.perf_counter()
    try:
        with requests.Session() as s:
            s.trust_env=False
            r=s.post(BASE+"/chat/completions",headers={"Authorization":"Bearer "+os.environ["CRAZYROUTER_API_KEY"]},json=payload,timeout=(10,65),allow_redirects=False)
        record["http"]=r.status_code
        if r.status_code==200:
            d=r.json();c=d["choices"][0];record.update(response_id=d.get("id"),output=c["message"].get("content"),finish=c.get("finish_reason"),usage=d.get("usage",{}))
        else:record["error"]="HTTP_"+str(r.status_code)
    except (requests.RequestException,ValueError,KeyError,IndexError) as e:record["error"]=type(e).__name__
    record["seconds"]=round(time.perf_counter()-start,3)
    return record

def parsed(row):
    if row.get("finish")!="stop":return None
    try:return json.loads(row.get("output") or "null")
    except (ValueError,TypeError):return None

def emit(**data):print(json.dumps(data,ensure_ascii=False))

from decimal import Decimal as D
import re
MODEL='deepseek-v4-pro'
LEGACY=None

def rates(document,model):
    row=next(x for x in document["data"] if x["model_name"]==model)
    factor=D(str(document["group_ratio"]["default"]))*D(str(row["group_discounts"]["default"]))
    mode=row.get("billing_mode","")
    if mode=="time_tiered":
        tiers={k:{"input":str(D(str(v["input_per_1m_tokens"]))*factor),"output":str(D(str(v["output_per_1m_tokens"]))*factor),"cache":str(D(str(v["cache_read_per_1m_tokens"]))*factor)} for k,v in row["time_pricing"].items() if k in ["off_peak","peak"]}
    elif mode=="tiered_expr":
        # Recognize only these inspected static rule shapes, never eval a remote expression.
        match=re.fullmatch(r'tier\("standard", p \* ([0-9.]+) \+ cr \* ([0-9.]+)(?: \+ cc \* 0)? \+ c \* ([0-9.]+)\)',row["billing_expr"])
        if not match:raise ValueError("Unreviewed pricing expression")
        a,b,c=match.groups();tiers={"standard":{"input":str(D(a)*factor),"cache":str(D(b)*factor),"output":str(D(c)*factor)}}
    elif mode in ("","per_token"):
        base=D(str(row["model_ratio"]))*2*factor
        tiers={"standard":{"input":str(base),"cache":str(base*D(str(row["cache_ratio"]))),"output":str(base*D(str(row["completion_ratio"])))}}
    else:raise ValueError("Unreviewed billing mode")
    return row,tiers

def estimate(usage,rate):
    prompt=usage.get("prompt_tokens");completion=usage.get("completion_tokens")
    cached=usage.get("prompt_tokens_details",{}).get("cached_tokens",0)
    if any(type(x) is not int or x<0 for x in [prompt,completion,cached]) or cached>prompt:raise ValueError("Invalid usage")
    return (D(prompt-cached)*D(rate["input"])+D(cached)*D(rate["cache"])+D(completion)*D(rate["output"]))/D(1000000)

fixture={"input":"2","cache":"0.5","output":"8"};tests=[]
for name,usage,expected in [("uncached",{"prompt_tokens":100,"completion_tokens":10},"0.00028"),("cached subset",{"prompt_tokens":100,"completion_tokens":10,"prompt_tokens_details":{"cached_tokens":40}},"0.00022"),("empty",{"prompt_tokens":0,"completion_tokens":0},"0")]:
    assert estimate(usage,fixture)==D(expected);tests.append({"case":name,"passed":True})
for name,usage in [("cached exceeds input",{"prompt_tokens":2,"completion_tokens":0,"prompt_tokens_details":{"cached_tokens":3}}),("boolean rejected",{"prompt_tokens":True,"completion_tokens":0})]:
    try:estimate(usage,fixture);raise AssertionError("invalid usage accepted")
    except ValueError:tests.append({"case":name,"passed":True})
with requests.Session() as s:
    s.trust_env=False;r=s.get("https://crazyrouter.com/api/pricing",timeout=(10,40));r.raise_for_status();document=r.json()
row,tiers=rates(document,MODEL);available=catalog([MODEL]+([LEGACY] if LEGACY else []));rows=[]
if available[MODEL]:
    for name,prompt,expected in [("short answer",'Return only JSON {"quantity":4}.',{"quantity":4}),("empty record",'Return only JSON {"quantity":0}.',{"quantity":0})]:
        options={"max_completion_tokens":1024,"reasoning_effort":"minimal"} if MODEL.startswith("gpt-5") else {"max_tokens":2048}
        rec=chat(MODEL,prompt,**options);rec.update(case=name,passed=parsed(rec)==expected)
        if rec.get("usage"):
            try:rec["estimated_usd_by_tier"]={k:str(estimate(rec["usage"],v)) for k,v in tiers.items()}
            except ValueError:rec["estimate_error"]="Unsupported usage counters"
        rows.append(rec)
emit(local_tests=tests,catalog=available,requests=rows,rates_usd_per_million=tiers,pricing_row=row,pricing_group="default",scope="Public rate arithmetic, not a ledger debit; reasoning not added twice to completion tokens; no claim of cache hit")

Calculated request estimates: Returned usage multiplied by the inspected rate scenarios

Sources checked November 3, 2026: Official model or pricing reference, Crazyrouter public pricing configuration, Python Decimal. Official descriptions and gateway observations are separate evidence.

FAQ#

Are these actual charged amounts?#

No. They are calculations from public configuration and returned usage; no account ledger was queried.

Which account group is used?#

The default group and its published discount configuration.

Were both model requests successful?#

Both returned the expected complete JSON in this run; the result table preserves their usage.

Was a cache hit measured?#

No cache hit is established by these small requests. The cached-rate row is configuration evidence.

Should I add reasoning tokens to completion tokens?#

Not for these envelopes, where reasoning is already represented within the reported completion total.

What happens when pricing rules change?#

Fetch and review the new configuration, rerun the calculation checks and verify the applicable route before relying on old estimates.

Last actually tested: November 3, 2026. This API-dependent article is due for review December 3, 2026.

Implementation Guides

Podcast

AI Dev Tools: The Crazyrouter Podcast

Short episodes for developers on AI APIs, gateways, cost control and coding tools.

Latest episodes

  • EP196 · Oct 29, 2026 · 6:53

    AI API Security Posture — Turn Controls Into Continuous Evidence

    A practical guide to AI API security posture: inventory exposure, verify controls continuously, protect keys and data, constrain tools, and turn security assumptions into evidence that operators can act on.

  • EP195 · Oct 28, 2026 · 7:21

    AI API Policy Drift — Detect When Production Rules Stop Matching Intent

    A practical guide to policy drift in AI APIs: version routing and safety rules, detect stale enforcement, compare intended and observed behavior, and restore control before small gaps become incidents.

Episodes with written show notes →

Topics

API GuidesTutorial

Related Articles

Gemini 2.5 Flash API Pricing and How to Call ItTutorial

Gemini 2.5 Flash API Pricing and How to Call It

Compare Gemini 2.5 Flash input, output, and cached-token prices, estimate a request budget, and make an OpenAI-compatible call with Python, Node.js, or cURL.

Oct 17
Midjourney API Without Discord: How to Generate AI Images ProgrammaticallyTutorial

Midjourney API Without Discord: How to Generate AI Images Programmatically

"Learn how to use Midjourney's image generation through an API without Discord. Complete guide with Python code examples, pricing, and alternatives."

Feb 21
Codex CLI Installation Guide 2026: macOS, Linux, Windows, Proxies, and CITutorial

Codex CLI Installation Guide 2026: macOS, Linux, Windows, Proxies, and CI

A developer-focused June 2026 guide to Codex CLI installation, alternatives, implementation patterns, pricing tradeoffs, and when to use Crazyrouter for unified AI API access.

Jun 4
How to Get a Claude API Key: Step-by-Step GuideTutorial

How to Get a Claude API Key: Step-by-Step Guide

"Step-by-step guide to getting a Claude API key from Anthropic or through Crazyrouter. Includes setup instructions, code examples, and pricing comparison."

Feb 15
Enterprise AI Management with LiteLLM: Teams, Model Access and CostsTutorial

Enterprise AI Management with LiteLLM: Teams, Model Access and Costs

Manage enterprise AI across departments with LiteLLM and Crazyrouter: separate virtual keys, model permissions, team budgets, rate limits, usage tracking and billing reconciliation. Includes configuration exports, API test records and a deployment checklist.

Oct 27
AI Future Baby Prediction with GPT-image-2 — See What Your Child Might Look LikeTutorial

AI Future Baby Prediction with GPT-image-2 — See What Your Child Might Look Like

Use GPT-image-2 via Crazyrouter API to generate realistic predictions of what your future baby might look like. Full code in Python, curl, and Node.js.

May 1