DeepSeek V4 is DeepSeek's new-generation model series, focused on Chinese, code, and cost-effectiveness. Many teams use it for customer service, content, code, and data analysis.

This guide explains how to obtain and call the DeepSeek V4 API, and what to watch during migration from an older model.

Note: DeepSeek is a trademark of its owner. This article reflects common versions as of October 2026; model names and prices follow the model pricing page.

1. What DeepSeek V4 Is Good For

  • Chinese question answering, customer service, and knowledge bases.
  • Code generation, explanation, and review.
  • Long-document summaries and structured extraction.
  • Reasoning nodes inside agents and workflows.
  • Batch content processing.

The model family is a good default for teams that need strong Chinese output and code assistance at a predictable price. As with any model, the right choice depends on the task: a short classification request and a long reasoning chain place very different demands on the model.

Model variants within a family often differ in context length, speed, and price. Match the variant to the job. A fast, cheaper model is usually enough for high-volume classification, short replies, and extraction, while the larger variant is better for multi-step reasoning, code review, and long documents. This single decision often affects cost more than prompt micro-optimization.

2. Getting a Key

Official DeepSeek

Register on the DeepSeek open platform, create a key, and top up. This route suits teams that can use the official platform directly.

ZSQH AI Gateway

  1. Register for the ZSQH AI Gateway.
  2. Create a key and set a quota.
  3. Top up the account.
  4. Call the API with the OpenAI SDK.

Using a gateway keeps the integration stable when you add other models later. The same key can serve multiple model families, and usage appears in one billing view.

3. Base URL and Model Names

The gateway's OpenAI-compatible address is:

https://ai.zhongshangqihang.com/v1

Model names follow the pricing page. Common forms include deepseek-v4 and deepseek-chat. Do not copy model names from an older guide without checking them, because a retired name can return a 404 even when the rest of the request is correct.

4. curl Test

export DEEPSEEK_API_KEY="sk-your-key"

curl "https://ai.zhongshangqihang.com/v1/chat/completions" \
  -H "Authorization: Bearer $DEEPSEEK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4",
    "messages": [{"role": "user", "content": "Reply with OK only"}]
  }'

Run this before writing application code. It isolates authentication, endpoint, and model-name problems from your own logic.

5. Python Call

from openai import OpenAI

client = OpenAI(
    api_key="sk-your-key",
    base_url="https://ai.zhongshangqihang.com/v1",
)

resp = client.chat.completions.create(
    model="deepseek-v4",
    messages=[{"role": "user", "content": "Write a Python example that reads a CSV file"}],
)
print(resp.choices[0].message.content)

Keep the Base URL and model name in one configuration file, and set them per environment instead of hard-coding them across the codebase. That makes a model migration a configuration change rather than a search-and-replace, and it prevents a staging key from accidentally reaching production.

6. Migrating from an Older Version

  1. Confirm the new model name and context length.
  2. Compare output quality with a fixed test set.
  3. Check whether tool calling and JSON output remain compatible.
  4. Roll out gradually over 3 to 7 days.
  5. Keep the old model available as a fallback.

Do not switch everything at once. A model upgrade can change output style and parameter support, and those differences may matter more than benchmark scores. Build a regression set from real prompts, including the edge cases your team has already fixed, and score the old and new model on the same inputs. During the canary period, watch latency, error rate, token usage per request, and the share of answers that require a human correction. Roll back if any of those metrics move in the wrong direction.

7. Cost and Rate Limits

  • Input and output token prices follow the pricing page.
  • Long context amplifies cost quickly.
  • Peak periods may rate-limit requests; production needs retries and a backup model.
  • Batch jobs should run asynchronously or through a queue.

Log the model name with every request. When a bill changes unexpectedly, the first question is usually which model and prompt produced the increase, and that answer is hard to recover without per-request metadata. Set a daily budget per key as a backstop, and alert on sudden changes in token volume rather than waiting for the monthly invoice.

FAQ

What is the difference between DeepSeek V4 and V3?

Version, context, capabilities, and price may differ. Refer to the official model documentation and the pricing page for the current details.

Can one key call Claude as well?

On a gateway, one key can call multiple enabled models. An official DeepSeek key can only call DeepSeek models.

Why do I get a 404?

The most common causes are an outdated model name or an incorrect Base URL. Check the model names on the pricing page first.

Next Steps

If you need stable access from mainland China or a unified entry point for several models, you can register for the ZSQH AI Gateway, run a small test, and then migrate. Model names and prices are listed on the model pricing page.

Related reading: