DEV Community

Cover image for ChatCompletions vs Anthropic Messages vs Responses API: Testing DeepSeek V4 Pro's Three API Formats
Hassann
Hassann

Posted on Originally published at apidog.com

ChatCompletions vs Anthropic Messages vs Responses API: Testing DeepSeek V4 Pro's Three API Formats

DeepSeek-V4-Pro-0813 reached general availability on August 12, 2026. It is served through the evergreen deepseek-v4-pro model ID at https://api.deepseek.com, alongside the lower-cost deepseek-v4-flash (Unite.AI covered the GA announcement). It supports a 1M-token context window, 384K maximum output, tool calling, structured outputs, and three thinking modes that expose a reasoning trace in reasoning_content.

Try Apidog today

The implementation detail that matters is compatibility: the same model accepts three API dialects:

  • OpenAI Chat Completions
  • Anthropic Messages
  • DeepSeek’s Responses API

That means you can reuse an OpenAI SDK integration, redirect a Claude-oriented agent, or build a Codex-style agent loop without changing model weights—only the request format and endpoint.

This guide shows one request for each format, highlights the wire-level differences, and explains how to test all three from one Apidog project. For account setup and a first request, start with how to use the DeepSeek V4 API.

TL;DR

  • deepseek-v4-pro is GA at https://api.deepseek.com. deepseek-v4-flash uses the same API surfaces at a lower price point.
  • You can call the model through OpenAI Chat Completions, Anthropic Messages, or the DeepSeek Responses API.
  • Specs include 1M context, 384K maximum output, tool calling, structured outputs, and reasoning_content for thinking modes.
  • Pricing: $0.435/M input tokens on a cache miss, $0.003625/M on a cache hit, and $0.87/M output tokens.
  • The formats differ in system-prompt placement, max_tokens behavior, tool schemas, response shapes, and streaming events.
  • Use one Apidog project with {{DEEPSEEK_API_KEY}} and per-format base URL variables to compare raw requests and responses.

Why one model supports three API dialects

Each API format gives DeepSeek compatibility with an established tooling ecosystem:

  • Chat Completions works with OpenAI-compatible SDKs, frameworks, and internal wrappers by changing base_url.
  • Anthropic Messages supports Claude-oriented clients, agents, eval harnesses, and tools such as Claude Code.
  • Responses API targets Codex-style agent loops and stateful multi-step workflows.

V4 Pro is also available through aggregators such as the OpenRouter page for deepseek-v4-pro-0813. This article focuses on DeepSeek’s first-party API surfaces. For the broader V4 family, see how to use DeepSeek V4.

Format 1: OpenAI Chat Completions

Use Chat Completions when your application already uses the OpenAI SDK or an OpenAI-compatible framework.

The request contains a messages array. Put the system prompt in the first item with role: "system".

Python example

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_DEEPSEEK_API_KEY",
    base_url="https://api.deepseek.com",
)

response = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[
        {"role": "system", "content": "You are a precise technical writer."},
        {"role": "user", "content": "Explain idempotency keys in two sentences."}
    ],
)

print(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

For a basic migration, you only need to update:

  1. base_url to https://api.deepseek.com
  2. Your API key
  3. model to deepseek-v4-pro or deepseek-v4-flash

Tool calling uses the familiar nested function schema. Streaming uses chat.completion.chunk deltas and ends with data: [DONE].

When a thinking mode is active, account for the V4-specific reasoning_content field alongside normal content. Do not assume your parser will only receive one text field.

Use this format for:

  • Existing OpenAI SDK integrations
  • LangChain-style frameworks
  • Internal API wrappers
  • Standard chat and tool-calling workloads

The request anatomy matches testing the ChatGPT API with Apidog, with the host and model changed.

Format 2: Anthropic Messages

Use the Messages API when your tooling is already Claude-native.

It looks similar to Chat Completions, but several differences matter in implementation:

  1. The system prompt is top-level system, not a messages entry.
  2. max_tokens is required.
  3. Tools use a flat schema with name, description, and input_schema.
  4. Tool calls return as tool_use content blocks.
  5. Tool results must be sent back as tool_result blocks inside a user message.

Python example

import os
import anthropic

client = anthropic.Anthropic(
    api_key=os.environ["DEEPSEEK_API_KEY"],
    base_url="https://api.deepseek.com/anthropic",  # Confirm the current path in DeepSeek docs
)

message = client.messages.create(
    model="deepseek-v4-pro",
    max_tokens=8192,
    system="You are a precise technical writer.",
    messages=[
        {"role": "user", "content": "Explain idempotency keys in two sentences."}
    ],
)

print(message.content[0].text)
Enter fullscreen mode Exit fullscreen mode

Unlike Chat Completions, the response is a list of content blocks rather than a single message string.

Streaming uses typed SSE events such as:

message_start
content_block_delta
message_stop
Enter fullscreen mode Exit fullscreen mode

Authentication follows Anthropic header conventions rather than standard bearer-token handling. Check the DeepSeek API docs for the current compatible endpoint and header requirements.

Point Claude-oriented tooling at DeepSeek

For agents that read Anthropic environment variables, configure the endpoint, token, and model:

export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=$DEEPSEEK_API_KEY
export ANTHROPIC_MODEL=deepseek-v4-pro
Enter fullscreen mode Exit fullscreen mode

Use this format for:

  • Claude-native applications
  • Claude Code-style tooling
  • Existing Anthropic eval harnesses
  • Teams that already handle Messages content blocks and event streams

For the core request shape, see the Claude Opus 5 API guide.

Format 3: DeepSeek Responses API

Use the Responses API for agentic workflows where typed outputs and server-managed conversation state are useful.

Instead of one messages array, send:

  • instructions for top-level behavior
  • input as a string or a list of typed input items

cURL example

curl https://api.deepseek.com/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEEPSEEK_API_KEY" \
  -d '{
    "model": "deepseek-v4-pro",
    "instructions": "You are an API review agent. Be terse.",
    "input": "Review this OpenAPI diff and list any breaking changes: [diff here]",
    "stream": false
  }'
Enter fullscreen mode Exit fullscreen mode

Three implementation differences distinguish this format:

  • Server-side state: Follow-up requests can reference a prior result using previous_response_id, rather than resending the entire history.
  • Typed output items: Reasoning, text, and tool-call results are separate items rather than one assistant message.
  • Semantic streaming: Events identify lifecycle changes directly, for example response.output_text.delta and response.completed.

Tool definitions and results use Responses-style structures, including function_call and function_call_output items.

Use this format for:

  • Codex-style agents
  • Long-running multi-step workflows
  • Systems that benefit from server-managed state
  • Orchestrators that need to handle reasoning, text, and tool calls differently

For implementation details beyond the base specification, use api-docs.deepseek.com as the source of truth.

The three formats side by side

OpenAI Chat Completions Anthropic Messages DeepSeek Responses API
Endpoint POST /chat/completions on api.deepseek.com POST /v1/messages on the Anthropic-compatible /anthropic base POST /responses on api.deepseek.com
Request shape messages array; system prompt is the first message Top-level system plus user/assistant messages Top-level instructions plus input
Output cap Optional max_tokens required Optional per the Responses spec
Tool definitions Nested function object with parameters Flat tool with input_schema Flat entries per the Responses spec
Tool results role: "tool" messages tool_result content blocks function_call_output items
Streaming chat.completion.chunk deltas ending in [DONE] Typed message_* and content_block_* events Semantic response.* lifecycle events
Conversation state Client-managed history Client-managed history Can reference a previous response
Best for OpenAI-compatible apps and frameworks Claude-native tools and agents Stateful agent loops and Codex-style workflows

The model and pricing remain the same. The meaningful differences are at the API contract level.

Test all three formats in one Apidog project

Testing the same prompt through all three surfaces is the fastest way to validate assumptions about response parsing, tool calls, and streaming.

Set up one project like this:

  1. Create three folders:

    • chat-completions
    • anthropic-messages
    • responses
  2. In each folder, save requests for:

    • Plain completion
    • Tool call
    • Streaming response
  3. Define shared environment variables:

   {{DEEPSEEK_API_KEY}}
   {{BASE_URL}}
   {{ANTHROPIC_BASE}}
Enter fullscreen mode Exit fullscreen mode
  1. Send the same prompt through every format.

  2. Compare the raw response paths:

    • Chat Completions: choices[0].message.content
    • Messages: content block list
    • Responses: typed output items
  3. Enable streaming with "stream": true and inspect the SSE output:

    • Chat Completions: anonymous chunks ending in [DONE]
    • Messages: named event types
    • Responses: lifecycle-oriented response.* events
  4. Add assertions for fields your application actually consumes:

    • Text content path
    • Tool-call ID location
    • Finish reason
    • Reasoning field behavior
    • Streaming completion event

If you need an SSE refresher, see how to stream API responses with SSE.

A three-folder collection becomes useful living documentation: instead of checking a specification from memory, open a saved request and inspect a real response.

Migration notes

Migrating from OpenAI

Update these values:

base_url: https://api.deepseek.com
api_key: YOUR_DEEPSEEK_API_KEY
model: deepseek-v4-pro
Enter fullscreen mode Exit fullscreen mode

Your message construction, tool schema, and streaming logic should remain familiar.

Before shipping:

  • Test non-core parameters instead of assuming full behavioral equivalence.
  • Update parsing to tolerate reasoning_content next to content.
  • Re-run tool-call and streaming regression tests.

Migrating from Anthropic

Update the Anthropic-compatible base URL, API key, and model name.

A spec-compliant Messages client can keep its existing handling for:

  • Required max_tokens
  • Content block lists
  • Typed streaming events
  • Flat input_schema tool definitions

For environment-driven agents, the three export commands shown earlier are the migration.

Migrating to the Responses API

This is a request-layer rewrite rather than a configuration change.

Adopt it when you need its distinct features:

  • Previous-response references
  • Typed output items
  • Agent-oriented lifecycle streaming

For ordinary chat completion use cases, Chat Completions is usually simpler.

In every migration path, change the configuration first, then run your regression collection before trusting the integration.

FAQ

Which format should a new project use?

Default to Chat Completions for the broadest tooling support.

Choose Messages if your stack is Claude-native. Choose the Responses API for multi-step agents that benefit from server-managed state and typed output items.

Can I point Claude Code at DeepSeek V4 Pro?

Yes. Set ANTHROPIC_BASE_URL to DeepSeek’s Anthropic-compatible endpoint, use your DeepSeek key as the auth token, and set ANTHROPIC_MODEL to deepseek-v4-pro.

Do tool calling and structured outputs work in every format?

The model supports both. Each API exposes tool calls in its native shape:

  • Nested OpenAI-style function objects
  • Anthropic input_schema tools
  • Responses-style function-call items

Validate your actual schemas against every target surface before shipping. Compatibility differences often appear in schema edge cases, response field placement, and stream event handling.

Top comments (0)