AiCredits
Blended Cost Check

DeepSeek Direct vs OpenRouter: Real Cost per Million Tokens

Rate cards hide the real number. Measure your own token mix, then compare DeepSeek direct, OpenRouter, and AiCredits on blended cost per million tokens.

Published 2026-09-23 Updated 2026-09-23 8 min

The rate card is not your bill

Every provider publishes a per-million-token figure, and almost nobody pays it. Your real cost per million tokens is a blend of several different prices: fresh input tokens, cached input tokens, output tokens, and whatever you spend on requests that fail and get retried. The moment your workload has a cache hit ratio above zero or an error rate above zero, the headline rate stops describing your spend.

A short prompt that returns a long answer and a long prompt that returns one word can process the same total token count and land on completely different bills. That's why 'DeepSeek direct vs OpenRouter' has no single correct answer — it's a question about your token mix and your payment reality, not about whose rate card looks smaller.

How the three routes actually differ

RouteStrong atThe catch
DeepSeek directOfficial endpoint, first access to new model names, cache and off-peak pricing applied at the sourceAccount and payment setup assumes a Chinese phone number and bank relationship, which is awkward for international teams
OpenRouterOne key across many vendors, model fallbacks, easy A/B testing without opening new accountsYou pay for a routing layer on top of the model; the effective rate depends on which upstream serves a request and failure modes can stack
AiCreditsDeepSeek-family models behind an OpenAI-compatible endpoint, card or PayPal, no Chinese phone or bank needed, plus code linting toolingFocused on the DeepSeek family rather than a large multi-vendor catalog

OpenRouter earns its reputation. If your product genuinely switches between vendors, or you want fallback routing without building it yourself, that convenience is real engineering value and worth paying for. Direct is the right call if your account logistics are already solved and you want source-of-truth pricing, with off-peak and cache treatment applied without a middle layer. AiCredits sits between them for international developers: the same OpenAI SDK you already use, model names deepseek-v4-flash and deepseek-v4-pro, billed on card or PayPal, with current rates at aicreditsapi.com/pricing.

Step 1: log what you actually send and receive

Before comparing anyone, capture usage from a real workload. The OpenAI SDK exposes token counts on every response, including a cached-input breakdown when the provider reports one.

import os
from openai import OpenAI

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

resp = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[
        {"role": "system", "content": "Answer in one short paragraph."},
        {"role": "user", "content": "Explain what context caching does to API cost."},
    ],
    temperature=0.2,
)

usage = resp.usage
details = getattr(usage, "prompt_tokens_details", None)
cached = getattr(details, "cached_tokens", 0) or 0

print(resp.choices[0].message.content)
print(f"input={usage.prompt_tokens} cached={cached} output={usage.completion_tokens}")

Run this against twenty real prompts from your application, not toy prompts. The cached count will be zero on a fresh key and climb as you reuse stable prefixes — long system prompts, retrieved documents, style guides. That one number separates cheap workloads from expensive ones far more than the published rate ever will.

Step 2: turn usage into a blended cost formula

This harness runs a batch, tallies each token class, and prints your mix as weights. Multiply each weight by a provider's published rate for that token class, add them up, and you have your own cost per million tokens — with no stale rate table and no guessing about which line item dominates.

import os
from openai import OpenAI

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

PROMPTS = [
    "Explain HTTP 429 in two sentences.",
    "Rewrite this comment in plain English: # retry with exponential backoff",
    "Write a Python one-liner that swaps a dict's keys and values.",
    "List three causes of a TCP connection reset. No preamble.",
    "Summarize the tradeoff between batching and latency in one paragraph.",
    "Give a regex that matches a 4-digit year between 1990 and 2029.",
]

def measure(model, prompts):
    totals = {"input": 0, "cached": 0, "output": 0, "calls": 0, "errors": 0}
    for prompt in prompts:
        try:
            r = client.chat.completions.create(
                model=model,
                messages=[{"role": "user", "content": prompt}],
                temperature=0.2,
            )
        except Exception as exc:
            totals["errors"] += 1
            print("failed:", exc)
            continue
        u = r.usage
        details = getattr(u, "prompt_tokens_details", None)
        totals["input"] += u.prompt_tokens
        totals["cached"] += (getattr(details, "cached_tokens", 0) or 0)
        totals["output"] += u.completion_tokens
        totals["calls"] += 1
    return totals

t = measure("deepseek-v4-flash", PROMPTS)
fresh = t["input"] - t["cached"]
grand = fresh + t["cached"] + t["output"]

print(f"calls={t['calls']} errors={t['errors']}")
print(f"fresh_input={fresh} cached_input={t['cached']} output={t['output']}")

if grand:
    print("blended cost per 1M tokens = sum of:")
    print(f"  {fresh / grand:.3f} x input_rate")
    print(f"  {t['cached'] / grand:.3f} x cached_input_rate")
    print(f"  {t['output'] / grand:.3f} x output_rate")

# Multiply each weight by the provider's published rate for that token class,

The output is a weighted sum, not a single number, and the weights come from your own traffic. Run it separately for chat, summarization and code review — the three rarely share a mix, and a provider that wins on one can lose on another.

Step 3: swap the endpoint, not the code

Because the harness only depends on the OpenAI-compatible interface, comparing routes is an environment variable change. Model strings differ per provider: on AiCredits, deepseek-v4-flash is the fast default, while deepseek-v4-pro costs more and earns its place on hard reasoning and code review.

import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ["PROVIDER_BASE_URL"],   # e.g. https://api.aicreditsapi.com/v1
    api_key=os.environ["PROVIDER_API_KEY"],
)

def ask(prompt, model=os.environ.get("MODEL_NAME", "deepseek-v4-flash")):
    r = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": prompt}],
        temperature=0.2,
    )
    return r.choices[0].message.content

What the measurements usually change

  • Output dominates. If your answers are long, the output rate is most of your bill on any route. Capping response length and tightening prompts moves the needle more than switching providers.

  • Cached input is where routing differences hide. Stable prompt prefixes are billed at the cached rate; if you reshuffle your system prompt every call, you never build cache and you pay the full input rate every time.

  • Retries are a real cost line. Track the error counter in the harness. A route that rate-limits you into double-sending requests costs more than its card suggests, and no pricing page will show it.

  • Off-peak windows matter for batch work. Nightly jobs, backfills and eval runs can move to cheaper hours where the provider passes that through — free savings, zero code risk.

  • Reserve the strong model. Sending every request to deepseek-v4-pro when deepseek-v4-flash handles most of them is the most common self-inflicted expense. Route only the hard cases upward.

A cheap rate card is expensive if half your requests retry. Measure the mix before you compare the price.

Choosing a route

If your roadmap spans several vendors and you want automatic fallbacks, OpenRouter's routing layer is worth its share. If your payments and accounts are already settled on the official platform, going direct gives you the cleanest path to source pricing and new model names.

For international teams that just want DeepSeek-family models working today with a card or PayPal — no Chinese phone number, no bank friction — AiCredits is the shortest path. The harness above runs unchanged against base_url="https://api.aicreditsapi.com/v1", and live rates live at aicreditsapi.com/pricing. If you're also shipping the code that calls the API, the linting tools are a natural add-on.

FAQ

Is OpenRouter more expensive than calling DeepSeek directly?

Not always, but you are paying for a routing layer on top of the model, and your effective rate can vary depending on which upstream serves a request. Weigh that against the value of one key across many vendors and built-in fallbacks. Run the harness on both and compare your own blended number.

Do cached tokens count toward cost per million tokens?

Yes, but they're usually billed differently from fresh input — typically cheaper. That's why the cached share matters: a workload with a high cache hit ratio behaves very differently from one that rebuilds its prompt on every call, even at the same total token count.

Why not just read the pricing page?

Because rate cards are priced per token class, while your bill is a weighted sum of those classes. The page tells you the inputs; only your traffic tells you the weights. The script in step two converts one into the other in about ten minutes.

Can I use the same code with a stronger model?

Yes. Change the model string to deepseek-v4-pro for the requests that need deeper reasoning or code review, and keep deepseek-v4-flash as the default for everything else. Your blended cost stays lower when only the hard requests hit the stronger model.

Still stuck at DeepSeek's checkout?

This article explains why the payment fails. If what you actually need is a working key today, there is a shorter path: prepaid DeepSeek credits, no subscription, key issued to your account right after checkout.

  • $9 / $19 / $29 USD one-time credit packs — 1 USD = 500K credits (so $9 = 4.5M); billed by actual usage, never expires, tax excluded
  • Card, Apple Pay, Google Pay or Alipay via Creem — no PayPal account needed
  • Email signup only — no Chinese phone number, no Chinese bank account
  • Same DeepSeek models and the same OpenAI-compatible API — change one base_url

Get a DeepSeek key → Or try it free first

Not sure how prepaid billing works? See the full DeepSeek API credits guide → — packs, usage-based billing, supported models and payment methods.

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 ×