Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeepSeek V4 Pro API with APIDot

DeepSeek V4 Pro API examples with APIDot: cURL, Node.js, request fields, responses, and production notes.

Try on APIDot | Get API Key | API Docs | Pricing | Main Examples

Why this repo exists

DeepSeek V4 Pro API for 1M-token long-context text chat, Pro-grade deep reasoning, complex coding, agentic planning, research synthesis, and OpenAI-compatible chat completions.

This repository turns that APIDot workflow into runnable server-side examples: a cURL request, a native Node.js example, request fields, response handling notes, and production integration guardrails.

Overview

DeepSeek V4 Pro is the high-depth Pro-tier model in the DeepSeek V4 text series. It is built for million-token reasoning, complex coding, full-codebase analysis, dense document review, and long-horizon planning where the task needs more depth than the Flash variant.

Choose DeepSeek V4 Pro for difficult reasoning, multi-file debugging, research synthesis, legal or financial review, and workflows where answer quality matters more than the lowest token cost. DeepSeek V4 Flash remains the better default for high-volume long-context traffic that does not need Pro-level depth.

On APIDot, use model ID deepseek-v4-pro through the existing OpenAI-compatible POST /v1/chat/completions path with Bearer authentication. The page supports streaming responses, usage fields for prompt and completion tokens, and separate APIDot input/output token pricing.

Endpoint

POST /v1/chat/completions

Send OpenAI-compatible chat completions requests to DeepSeek V4 Pro through APIDot.

Best practices

  • Use deepseek-v4-pro for 1M-token long-context text chat, complex code review, research synthesis, and long-horizon agent planning.
  • Keep reasoning-mode choices in your system prompt or user prompt. APIDot does not add a dedicated thinking_mode field for this model.
  • Read assistant text from data.choices[0].message.content when the response is wrapped by APIDot, or choices[0].message.content for raw OpenAI-compatible responses.
  • Read input and output usage from usage.prompt_tokens and usage.completion_tokens so billing can be checked separately.
  • Set stream: true only when your client is prepared to consume server-sent chat completion chunks.

Quick start

cp .env.example .env
# Edit .env and set APIDOT_API_KEY
cd node
npm start

Use curl/generate.md when you want a copy-paste cURL request instead of Node.js.

Minimal API request

Submit to APIDot:

curl --fail-with-body --request POST \
  --url https://api.apidot.ai/v1/chat/completions \
  --header "Authorization: Bearer $APIDOT_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "deepseek-v4-pro",
  "messages": [
    {
      "role": "system",
      "content": "You are a concise technical assistant."
    },
    {
      "role": "user",
      "content": "Summarize the migration risks in five bullets."
    }
  ],
  "max_tokens": 512
}'

Primary payload:

{
  "model": "deepseek-v4-pro",
  "messages": [
    {
      "role": "system",
      "content": "You are a concise technical assistant."
    },
    {
      "role": "user",
      "content": "Summarize the migration risks in five bullets."
    }
  ],
  "max_tokens": 512
}

Request variants

deepseek-v4-pro

{
  "model": "deepseek-v4-pro",
  "messages": [
    {
      "role": "system",
      "content": "You are a concise technical assistant."
    },
    {
      "role": "user",
      "content": "Summarize the migration risks in five bullets."
    }
  ],
  "max_tokens": 512
}

Request parameters

Field Type Required Description
model string yes Target model ID. Use deepseek-v4-pro.
messages object[] yes Conversation array in OpenAI-compatible chat format.
messages[].role string yes Message role. Use system, user, or assistant.
messages[].content string yes Text content for the message.
temperature number no Sampling temperature from 0 to 2 when you choose to override defaults.
top_p number no Nucleus sampling value from 0 to 1.
max_tokens integer no Maximum output tokens to return.
stream boolean no Set true to receive streaming chat completion chunks.

Response fields

Field Type Description
code integer APIDot status code when the response is wrapped. Successful calls return 200.
data.id string Chat completion response ID.
data.choices[].message.content string Generated assistant text.
data.usage.prompt_tokens integer Input token count billed at the DeepSeek V4 Pro input rate.
data.usage.completion_tokens integer Output token count billed at the DeepSeek V4 Pro output rate.
data.usage.total_tokens integer Total token count across input and output.

Example response

{
  "code": 200,
  "data": {
    "id": "chatcmpl_1234567890",
    "object": "chat.completion",
    "model": "deepseek-v4-pro",
    "choices": [{"index": 0, "message": {"role": "assistant", "content": "The key risks are..."}, "finish_reason": "stop"}],
    "usage": {"prompt_tokens": 64, "completion_tokens": 96, "total_tokens": 160}
  }
}

Error classes

Code Name Description
400 invalid_request_error The request body is missing required chat fields or includes invalid values.
401 authentication_error Missing, expired, or invalid Bearer API key.
402 insufficient_credits The account does not have enough credits for the requested token usage.
404 model_not_found The selected public model ID is not mapped in the backend vendor feature configuration.
500 service_error The model request failed or timed out.

Production notes

  • Keep APIDot API keys in server-side environment variables.
  • Persist selected model, request payload, user ID, and response metadata together for support and cost review.
  • Avoid logging API keys, private prompts, customer data, private media URLs, or internal callback URLs.
  • Validate request fields before sending traffic to APIDot.
  • Retry transient network failures with backoff, but do not retry unchanged invalid payloads.

Common mistakes

  • Committing a real API key or .env file.
  • Calling APIDot directly from browser code instead of a server-side environment.
  • Logging private prompts, customer data, API keys, or internal callback URLs.
  • Reusing request fields from another model without checking this model's docs.

FAQ

Which DeepSeek V4 Pro model ID can I send?

Send deepseek-v4-pro in the model field.

What authentication header should I use?

Use Authorization: Bearer $APIDOT_API_KEY when calling /v1/chat/completions.

Is this endpoint OpenAI-compatible?

Yes. It accepts the standard chat completions payload shape for text chat.

Can I stream responses?

Yes. Set stream: true to receive streaming chat completion chunks.

Related links

About

DeepSeek V4 Pro API examples with APIDot: cURL, Node.js, request fields, responses, and production notes.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages