As of November 2026, DeepSeek has replaced its legacy model IDs with deepseek-flash (V4.1-Flash) and deepseek-v4-pro, billing on a 2× peak vs. off-peak schedule. Through the API Hop DeepSeek provider page, you can call deepseek-v4-flash ($0.3429/$1.0286) and deepseek-v4-pro ($1.0286/$3.0857) at flat 24/7 rates using the OpenAI SDK in under 10 minutes.
Key Takeaways
- Legacy IDs are retired:
deepseek-chatanddeepseek-reasonerare no longer the primary endpoints; production workloads now run on the V4 lineup with 1M context and up to 384K output tokens. - Official peak pricing doubles your bill: DeepSeek charges 2× off-peak rates on weekdays from 01:00–04:00 and 06:00–10:00 UTC (excluding Chinese public holidays), hitting daytime APAC and European traffic directly.
- Context caching cuts input spend by over 95%: Official
deepseek-flashcache hits drop to $0.003/M (off-peak) or $0.006/M (peak), while API Hop offers flat $0.0114/M cached input ondeepseek-v4-flashwith $0 cache write fees. - Flat aggregator pricing beats official peak hours: During official peak windows, API Hop’s
deepseek-v4-pro($1.0286/$3.0857) is roughly 22% cheaper than DeepSeek’s peak rate ($1.32/$3.96) with zero time-of-day billing swings. - Low-friction prepaid access: No overseas credit card or corporate KYC is required. Top up pay-as-you-go credit starting at $10 on the API Hop Pricing page via USDT/USDC crypto or regional wallets with no monthly subscription.
2026 DeepSeek API Rate Card: Official vs. API Hop
As of 2026-11-25, DeepSeek bills across three dimensions: model tier, cache status, and peak/off-peak time window. API Hop simplifies this to flat 24/7 rates with no peak multiplier. All rates below are in USD per 1M tokens:
| Model & Channel | Context / Max Output | Cached Input | Uncached Input | Output | Peak Billing Rule |
|---|---|---|---|---|---|
Official deepseek-flash (Off-Peak) | 1M / 384K | $0.003 | $0.15 | $0.60 | Non-peak hours, weekends & Chinese public holidays |
Official deepseek-flash (Peak) | 1M / 384K | $0.006 | $0.30 | $1.20 | Weekdays 01:00–04:00 & 06:00–10:00 UTC |
API Hop deepseek-v4-flash | 1M / 384K | $0.0114 | $0.3429 | $1.0286 | Flat 24/7 rate, no peak surge |
Official deepseek-v4-pro (Off-Peak) | 1M / 384K | $0.022 | $0.66 | $1.98 | Non-peak hours, weekends & Chinese public holidays |
Official deepseek-v4-pro (Peak) | 1M / 384K | $0.044 | $1.32 | $3.96 | Weekdays 01:00–04:00 & 06:00–10:00 UTC |
API Hop deepseek-v4-pro | 1M / 384K | $0.0343 | $1.0286 | $3.0857 | Flat 24/7 rate (~22% below official peak) |
Note: API Hop charges $0 for cache writes (no extra 5-minute or 1-hour write fee). If you are running into direct billing blocks or payment failures on the official portal, see our DeepSeek API Top-Up Guide.
Prerequisites
Before running the code examples, make sure you have three things ready:
- API Key: Create an account and generate a key on the API Hop Pricing & Console page. Accounts are prepaid pay-as-you-go with a $10 minimum top-up, no overseas credit card or corporate verification required, and support USDT/USDC crypto plus regional wallets. Credits never expire.
- Runtime: Python 3.9+ with
openai>=1.0.0, or standardcurl. - Model ID Check: Query
GET /v1/modelsto confirm the exact model strings enabled for your key (deepseek-v4-flash,deepseek-v4-pro).
pip install -U openai
export APIHOP_API_KEY="sk-your-apihop-key"
Quickstart: First Call in 2 Minutes
API Hop exposes DeepSeek through an OpenAI-compatible Chat Completions endpoint. Run a quick curl check first, then test a 10-line Python snippet.
Minimal cURL Request
Send a non-streaming request to deepseek-v4-flash and inspect the returned usage object:
curl -sS "https://api.apihop.ai/v1/chat/completions" \
-H "Authorization: Bearer $APIHOP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [
{"role": "user", "content": "Summarize in three sentences why cache hits lower LLM bills."}
],
"stream": false
}'
Expected response shape (exact token counts vary with output):
{
"id": "chatcmpl_9f2a1c",
"model": "deepseek-v4-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "1. Multi-turn chats and long system prompts repeatedly send identical prefixes..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 88,
"total_tokens": 112
}
}
Python Quickstart with the OpenAI SDK
If you already use the OpenAI or official DeepSeek SDK, swap only base_url and api_key:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["APIHOP_API_KEY"],
base_url="https://api.apihop.ai/v1",
)
resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Explain how token context caching works."}],
)
print(resp.choices[0].message.content)
print("Usage:", resp.usage)
Expected output: the model’s explanation followed by Usage: CompletionUsage(completion_tokens=..., prompt_tokens=..., total_tokens=...).
Step-by-Step Guide: Controlling Costs with Caching and Streaming
Once your first request succeeds, monthly spend in production is driven mainly by prefix stability, output caps, and smart tier routing.
Step 1: Pin Static System Prompts to Trigger Prefix Caching
DeepSeek context caching activates automatically on matching prefixes without special write headers. Keep static instructions, schemas, and reference docs in the system message, and place dynamic variables in the final user turn:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["APIHOP_API_KEY"],
base_url="https://api.apihop.ai/v1",
)
STATIC_SYSTEM_PROMPT = (
"You are a senior SQL auditor. Output JSON only with keys: risk_level, reason, fixed_sql. "
+ "Company schema reference: " + "users(id, email, created_at); orders(id, user_id, amount_cents); " * 80
)
for query in ["SELECT * FROM users;", "DELETE FROM orders WHERE amount_cents = 0;"]:
resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{"role": "system", "content": STATIC_SYSTEM_PROMPT},
{"role": "user", "content": f"Audit this SQL: {query}"},
],
max_tokens=300,
)
print(query, "-> prompt_tokens:", resp.usage.prompt_tokens, "completion_tokens:", resp.usage.completion_tokens)
Expected output: both calls report similar prompt_tokens (~1,500+), while the second request reuses the identical prefix and bills the matched portion at the cached rate ($0.0114/M) instead of the uncached rate ($0.3429/M).
Step 2: Enable SSE Streaming and Set max_tokens Guardrails
Reasoning models can generate thousands of tokens on open-ended prompts. Setting stream=True reduces time-to-first-token (TTFT), while max_tokens prevents runaway outputs from burning budget:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["APIHOP_API_KEY"],
base_url="https://api.apihop.ai/v1",
)
stream = client.chat.completions.create(
model="deepseek-v4-pro",
messages=[{"role": "user", "content": "Give a zero-downtime PostgreSQL column rename checklist."}],
max_tokens=800,
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage:
print(f"\n[Final Usage] in={chunk.usage.prompt_tokens}, out={chunk.usage.completion_tokens}")
Expected output: streamed checklist lines ending with [Final Usage] in=..., out=... for your billing logs.
Complete Working Example: Cost-Aware Router with Exponential Backoff
This production-ready script routes routine tasks to deepseek-v4-flash and complex reasoning to deepseek-v4-pro, retries transient 429/5xx errors with exponential backoff, and calculates exact USD spend per request:
import os
import time
from openai import OpenAI, RateLimitError, APIStatusError, APITimeoutError
RATES_PER_M = {
"deepseek-v4-flash": {"in": 0.3429, "cache_in": 0.0114, "out": 1.0286},
"deepseek-v4-pro": {"in": 1.0286, "cache_in": 0.0343, "out": 3.0857},
}
client = OpenAI(
api_key=os.environ["APIHOP_API_KEY"],
base_url="https://api.apihop.ai/v1",
timeout=60.0,
)
def call_deepseek(prompt: str, complex_task: bool = False, max_retries: int = 3):
model = "deepseek-v4-pro" if complex_task else "deepseek-v4-flash"
for attempt in range(max_retries):
try:
resp = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": prompt}],
max_tokens=1024,
)
usage = resp.usage
cached = getattr(getattr(usage, "prompt_tokens_details", None), "cached_tokens", 0) or 0
uncached_in = max(usage.prompt_tokens - cached, 0)
r = RATES_PER_M[model]
cost = (uncached_in * r["in"] + cached * r["cache_in"] + usage.completion_tokens * r["out"]) / 1_000_000
return {"model": model, "text": resp.choices[0].message.content, "cost_usd": round(cost, 6)}
except (RateLimitError, APITimeoutError) as exc:
wait = 2 ** attempt
print(f"[Retry {attempt + 1}] {type(exc).__name__}, sleeping {wait}s...")
time.sleep(wait)
except APIStatusError as exc:
if exc.status_code in (500, 502, 503, 504) and attempt < max_retries - 1:
time.sleep(2 ** attempt)
continue
raise
raise RuntimeError("Exceeded max retries for DeepSeek API")
if __name__ == "__main__":
result = call_deepseek("Write a Python function to split a CSV into 500-row chunks while keeping headers.", complex_task=False)
print(f"Model: {result['model']} | Cost: ${result['cost_usd']:.6f}")
print(result["text"][:200], "...")
Expected output: Model: deepseek-v4-flash | Cost: $0.0003xx followed by the first 200 characters of generated Python code.
Error Handling and Troubleshooting
Map these HTTP status codes into your alerting and retry logic before shipping to production:
| HTTP Status | Common Cause | Recommended Action |
|---|---|---|
400 | Invalid model ID (such as retired deepseek-chat) or out-of-range parameter | Verify exact model IDs via GET /v1/models and ensure max_tokens is a positive integer |
401 | Missing, expired, or revoked API key | Check Authorization: Bearer ... header and environment variable |
402 | Insufficient prepaid balance | Top up credits on the API Hop Pricing page |
429 | Concurrency or rate limit exceeded | Apply 1s / 2s / 4s exponential backoff and pace batch jobs with a queue |
5xx / Timeout | Upstream transient error or long reasoning exceeding client timeout | Set client timeout to at least 60s and use stream=True for long outputs |
Common Issues and Gotchas
- Injecting timestamps at the start of the system prompt breaks caching: Even a single
Current time: 2026-11-25 19:45:01on line 1 invalidates the entire prefix hash, pushing input cost from $0.0114/M to $0.3429/M (30× higher). Always move dynamic timestamps to the finalusermessage. - Setting
max_tokenstoo low causes empty answers on reasoning models:deepseek-v4-procan count internal reasoning tokens against the output cap. Cappingmax_tokensat 256 may truncate output before the final answer starts; use at least 1,500 for complex tasks or omit the field to use the upstream default. - Budgeting with official off-peak rates while running daytime APAC traffic: Beijing/Singapore business hours (09:00–12:00 and 14:00–18:00 UTC+8) overlap directly with DeepSeek’s 01:00–04:00 and 06:00–10:00 UTC peak windows, doubling real spend. Shift batch jobs to nights/weekends or route daytime traffic through API Hop’s flat rate.
- Calling OpenAI Responses or Claude Messages endpoints with DeepSeek models: API Hop’s current DeepSeek contract supports Chat Completions (
/v1/chat/completions) only, not the Responses API format.
Cost Estimation and Real Workload Bills
Per-million token rates rarely tell the full story. Here are worked bills across four real engineering workloads (rates verified 2026-11-25):
| Workload Scenario | Usage Assumption (Per Run) | Official Off-Peak | Official Peak | API Hop Flat 24/7 |
|---|---|---|---|---|
| Running all 4 examples in this guide (Flash + Pro) | ~4K input + 1.5K output | $0.0029 | $0.0058 | $0.0041 (under half a cent) |
10-turn codebase Q&A (80% cache hit, v4-flash) | 50K cached + 12K uncached + 4K out | $0.0044 | $0.0087 | $0.0088 ($8.80 per 1,000 sessions) |
Deep architecture review (70% cache hit, v4-pro) | 70K cached + 30K uncached + 8K out | $0.0372 | $0.0744 | $0.0580 (22% cheaper than official peak) |
Support ticket triage (5,000/day = 150K/mo, v4-flash) | 1.5K cached + 0.5K uncached + 0.15K out | $25.43 / mo | $50.85 / mo | $51.42 / mo ($10 covers ~29,000 tickets) |
Formula breakdown for the deep architecture review on API Hop deepseek-v4-pro:
- Cached input:
0.07M × $0.0343 = $0.0024 - Uncached input:
0.03M × $1.0286 = $0.0309 - Output:
0.008M × $3.0857 = $0.0247 - Total per run:
$0.0024 + $0.0309 + $0.0247 = $0.0580. A $10 minimum top-up covers roughly 172 heavy architecture reviews or 1,136 10-turn codebase Q&A sessions.
What to Watch Next
deepseek-v4.1-flashrouting rollout: API Hop’s documentation reservesdeepseek-v4.1-flashas a distinct model ID (separate fromdeepseek-v4-flash). PollGET /v1/modelsto verify when it becomes active for your key, and see our DeepSeek V4.1-Flash Model Breakdown for architecture details.- Official peak window adjustments: DeepSeek has adjusted its UTC off-peak schedule before. If your cron pipelines rely on official off-peak pricing, check the official changelog monthly.
FAQ
Does DeepSeek API have a free tier?
DeepSeek does not offer a permanent commercial free API tier (the free web chat does not grant API quota); production requests require prepaid credit. On the API Hop Pricing page, there is no monthly subscription either—you can start with a $10 prepaid balance that never expires, run every example in this tutorial for under $0.01, and share that same balance across 40+ models including Claude, Gemini, and GPT.
Do deepseek-chat and deepseek-reasoner still work?
Those legacy model IDs have been retired in favor of the V4 lineup. On API Hop, use deepseek-v4-flash and deepseek-v4-pro, or check GET /v1/models for the live list enabled on your key to avoid 400 errors.
Is the DeepSeek API compatible with the OpenAI SDK?
Yes. Point base_url to https://api.apihop.ai/v1 and pass your API Hop key when initializing OpenAI(). Existing chat.completions.create, streaming, and tool-calling code works with minimal changes.
When should I pick deepseek-v4-flash vs. deepseek-v4-pro?
Use deepseek-v4-flash for summaries, ticket classification, multi-turn support chat, document extraction, or vision inputs—it costs roughly one-third as much as Pro. Route to deepseek-v4-pro for cross-file refactoring, math proofs, and deep multi-step logic verification.
How can I pay for DeepSeek API without an overseas credit card?
If you are in regions such as India, Indonesia, Brazil, Latin America, Russia, or Turkey where USD credit cards or corporate KYC create friction, you can top up pay-as-you-go credit on the API Hop Pricing page using USDT/USDC crypto or supported regional wallets with no monthly commitment.
Verification note: Official DeepSeek rate cards, peak UTC windows, and API Hop live catalog prices were verified on 2026-11-25 against DeepSeek documentation and the API Hop model catalog (account-specific discounts take precedence in the console).