AiCredits
Migration Guide

Migrate to deepseek-v4-flash: Complete Guide for the Retired Chat & Reasoning Aliases

The legacy chat alias was retired on 2026-07-24. A step-by-step migration to deepseek-v4-flash, with real, runnable audit, JSON-parsing and routing code.

Published 2026-09-24 Updated 2026-09-24 7 min

Why Your Calls Stopped Working on 2026-07-24

On 2026-07-24 the legacy DeepSeek chat alias was retired outright, not quietly deprecated. Requests that used to return completions now fail, and anything wrapped in a silent retry loop is busy filling your logs instead of your database. The supported surface is two model names: deepseek-v4-flash, the fast default for essentially all production traffic, and deepseek-v4-pro, the stronger and costlier option for genuinely hard prompts.

The good news is that the model swap itself is one line of code. The bad news is that the one-line swap is where most migrations stop, leaving three classes of bug behind: parameters the old alias tolerated and the new endpoint rejects, system prompts that over-specify behaviour now that instruction following is tighter, and JSON parsing that assumed perfectly clean output.

Flash or Pro: Choose a Default in One Minute

Dimensiondeepseek-v4-flashdeepseek-v4-pro
Default forAlmost all production trafficPrompts that flash demonstrably fails
Typical strengthsExtraction, classification, summarization, tool calling, lint explanations, interactive chatMulti-step reasoning, long analysis, tricky code refactors
CostCheaper; cache hits and off-peak requests cost less stillCosts more per request than flash
SpeedFast responses, suited to user-facing UISlower, better for background jobs than autocomplete
How to adoptRoute everything here on day oneAdd only after an eval shows a real win

Start every workload on flash and keep it there until you have evidence it is not enough. Teams that begin with pro as a blanket default usually spend weeks trimming it back down; teams that start on flash add pro deliberately for a handful of prompt shapes and never look back.

Step 1: Repoint Your Client

Both models are served through the same OpenAI-compatible endpoint, so your SDK, auth header and retry middleware all stay put. If you are outside mainland China and do not have a Chinese phone number or bank card, AiCredits issues keys payable by card or PayPal against base_url https://api.aicreditsapi.com/v1 — the snippet below is the entire client change:

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': 'You are a concise technical assistant.'},
        {'role': 'user', 'content': 'Explain cache hits vs cache misses to a new backend engineer.'},
    ],
    temperature=0.2,
    max_tokens=300,
)

print(resp.choices[0].message.content)
print(resp.usage)

Run it once by hand. If it prints text and a usage object, your key and network path are fine and everything else is plain code cleanup.

Step 2: Audit the Whole Repo, Not Just the Obvious Call Site

Most projects keep the model name in more than one place: a config default, an environment fallback, a test fixture, a background worker, and a mobile client someone shipped last year. This script walks every Python file and flags any DeepSeek model name that is not one of the two supported ones:

import pathlib
import re

ALLOWED = {'deepseek-v4-flash', 'deepseek-v4-pro'}
SKIP_DIRS = {'.git', '.venv', 'venv', 'node_modules', '__pycache__', 'dist', 'build'}
TOKEN = re.compile(r'deepseek[-_.a-z0-9]*', re.IGNORECASE)

findings = []
for path in pathlib.Path('.').rglob('*.py'):
    if SKIP_DIRS.intersection(path.parts):
        continue
    text = path.read_text(encoding='utf-8', errors='ignore')
    for lineno, line in enumerate(text.splitlines(), 1):
        for token in TOKEN.findall(line):
            if token.lower() not in ALLOWED:
                findings.append((str(path), lineno, token))

for path, lineno, token in findings:
    print(f'{path}:{lineno}  {token}')

print(f'{len(findings)} stale reference(s) found.' if findings else 'Clean: no stale model names.')

Then repeat the sweep for other surfaces: grep your YAML, Terraform, docker-compose, notebook and TypeScript files for the string deepseek and check every hit by hand. Watch out for environment fallbacks such as os.getenv('MODEL', ...) — the default hides from a plain text search.

Step 3: Fix the Things That Actually Break

  • Parameters: start from the OpenAI-compatible minimum — model, messages, temperature, max_tokens, stream, tools. Remove anything exotic you carried over from the old alias and re-add it only if the current API reference lists it.

  • System prompts: newer models follow instructions literally, so long chains of never-do-X rules often regress after a migration. Rewrite them as short positive instructions plus one example of the exact output shape you want.

  • Streaming and timeouts: keep stream=True for UIs, but add a test for the empty final delta, and give any pro-routed call a longer client timeout so it never blocks a user-facing request.

  • Retries: use exponential backoff on timeouts and connection errors only. Retrying a malformed request just fails again, more slowly.

Step 4: Make Structured Output Boring Again

The most common post-migration bug is json.loads() on a response that came back wrapped in a markdown code fence. Ask for JSON in the system prompt and parse defensively, so a small formatting drift never takes down a request handler:

import json
import os
import re

from openai import OpenAI

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

SCHEMA_HINT = 'Return ONLY a JSON object with keys title (string) and tags (array of strings).'


def extract_json(text: str) -> dict:
    text = text.strip()
    text = re.sub(r'^```(?:json)?|```$', '', text, flags=re.MULTILINE).strip()
    return json.loads(text)


resp = client.chat.completions.create(
    model='deepseek-v4-flash',
    messages=[
        {'role': 'system', 'content': SCHEMA_HINT},
        {'role': 'user', 'content': 'Draft a title and three tags for a post about API rate limiting.'},
    ],
    temperature=0,
)

data = extract_json(resp.choices[0].message.content)
print(data['title'], data['tags'])

Keep schema instructions short: two named keys stated once parse more reliably than a paragraph of prose about formatting. If a parse fails, log the raw string rather than the exception only — that is what tells you whether the prompt drifted or the parser did.

Step 5: Let an Eval Decide Where Pro Earns Its Keep

Do not guess which prompts need the stronger model. Pull a few dozen real prompts from production logs, run each through both models, and read the outputs side by side. It is the cheapest routing experiment you will ever run:

import os

from openai import OpenAI

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


def complete(model: str, prompt: str) -> str:
    resp = client.chat.completions.create(
        model=model,
        messages=[{'role': 'user', 'content': prompt}],
        temperature=0,
    )
    return resp.choices[0].message.content.strip()


prompts = [
    'Summarize this support thread in two sentences: ...',
    'Extract the invoice total and due date from: ...',
    'Explain why this migration fails on large payloads: ...',
]

for prompt in prompts:
    print('PROMPT:', prompt)
    print('flash :', complete('deepseek-v4-flash', prompt))
    print('pro   :', complete('deepseek-v4-pro', prompt))
    print('-' * 60)

Route by evidence, not by category. Teams that send whole features to the expensive model typically discover that only a handful of prompt shapes ever needed it.

Step 6: Cost Hygiene After the Migration

Check the current numbers at aicreditsapi.com/pricing before you commit to a routing split. The levers that matter, in order of impact:

  • Cache hits cost less. Keep the stable prefix — system prompt, tool schemas, few-shot examples — byte-identical across requests so it can be reused instead of reprocessed.

  • Off-peak requests cost less. Move batch jobs, nightly indexing and evaluation runs into the cheaper window rather than firing them at peak.

  • Pro costs more than flash by design. Never leave pro as the default in a wrapper function or framework plugin, or every trivial call pays a premium.

  • Cap max_tokens and log usage per call, tagged with the model name, so a cost regression shows up as a query instead of a surprise at the end of the month.

Migration Checklist for Your Pull Request

#ActionDone when
1Replace every model string with deepseek-v4-flashAudit script reports clean
2Delete parameters the retired alias acceptedCalls succeed on the minimal parameter set
3Rewrite system prompts as positive instructionsExisting tests still pass
4Add fence-stripping around JSON parsingBad output raises a caught error, not a crash
5Run a flash-vs-pro comparison on real promptsOnly the prompts that need it reach pro
6Re-check timeouts, retries and streaming handlersNo user-facing path blocks on a slow call

FAQ

Do I need a new API key after the migration?

No. The key, base URL and SDK stay the same; only the model value changes. On AiCredits, one key works for both deepseek-v4-flash and deepseek-v4-pro.

Is deepseek-v4-flash worse than the old chat model?

Treat it as a new baseline rather than a downgrade. Run a few dozen of your real prompts through flash and pro, then route by evidence. For extraction, classification, summarization and tool calling, flash is usually all you need.

What about the other retired alias, the reasoning one?

It is retired as well and has no drop-in replacement. Anything that called it must be rewritten against one of the two supported models, and any reasoning-specific parameter sitting in your config should be removed so the request validates.

Can I pay for credits without a Chinese phone number or bank card?

Yes. AiCredits is built for international developers: pay by card or PayPal, get a key, and call the same OpenAI-compatible endpoint. Current rates live at aicreditsapi.com/pricing.

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 ×