API Workflows

A practical DeepSeek API guide for developers using deepseek-chat, deepseek-reasoner, Thinking, Tool Calls, and JSON output.

DeepSeek API Workflows

This section is for developers.
If you only want a chat experience, start with the web entry and prompt patterns.
If you are integrating DeepSeek into a product, the concepts below matter first.

1. Understand the three layers

Website and chat entry

Good for manual usage and quick testing.

API documentation

Use it for parameters, response structure, tool calling, and sample code.

API endpoint

Actual requests go to https://api.deepseek.com.
The /v1 path in examples is mostly for compatibility and should not be confused with a model version.

2. Common models and modes

The official docs currently center most developer usage around:

  • deepseek-chat
  • deepseek-reasoner

Some behavior can also be switched via the thinking parameter rather than by changing the model name alone.

3. Minimal request example

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.DEEPSEEK_API_KEY,
  baseURL: 'https://api.deepseek.com'
});

const response = await client.chat.completions.create({
  model: 'deepseek-chat',
  messages: [
    { role: 'system', content: 'You are a structured output assistant.' },
    { role: 'user', content: 'Summarize this material into five key points.' }
  ]
});

console.log(response.choices[0].message.content);

4. What matters in Thinking mode

Thinking mode is useful because:

  • it fits more complex reasoning tasks
  • it may emit reasoning_content
  • multi-turn flows need better context handling
  • Tool Calls mixed with reasoning need careful implementation

Do not enable it by default for every simple rewrite or summary task.

5. When Tool Calls are worth it

Tool Calls usually make sense when the task needs external actions, such as:

  • searching an index
  • querying a database
  • calling internal functions
  • reading structured outputs from another tool

6. When to force JSON output

If the result will be consumed by code, do not rely on free-form text.

Typical cases:

  • moderation results
  • field extraction
  • FAQ storage
  • workflow-to-workflow data passing

7. A more stable production habit

Before the call

  • define the goal
  • choose the mode
  • constrain the output
  • set field expectations

During the call

  • log requests and failures
  • detect truncation
  • handle empty or malformed responses

After the call

  • validate fields
  • add human review for critical paths
  • track cost and success rate
  1. Start with deepseek-chat
  2. Add Thinking only where it helps
  3. Introduce Tool Calls
  4. Add structured output and retries last

If you try everything at once, debugging becomes much harder.