Skip to main content
deepseek avatar

DeepSeek V4 Pro API

Open-weight (MIT) thinking model at 1.6T parameters for hard reasoning and competitive-grade coding, with a 1,000,000-token context, tool calling and streaming over an OpenAI-compatible chat endpoint.

reasoningtool callingjson mode
$2.4 in · $4.8 out per 1M tokens
1M context
393.2K max output

Chat with this model

Chat

Try this model — replies stream in live.
You need to be logged in to run this model and view results.
Log in

Model Pricing

Pricing

This model is billed per token, at separate rates for what you send and what it produces.

Input tokens
$2.4
per 1M tokens
Cached input tokens
$0.2
per 1M tokens
Output tokens
$4.8
per 1M tokens

Every request rounds up to the nearest $0.01.

If a run reports no token usage, it bills a flat $0.02.

DeepSeek V4 Pro API

DeepSeek V4 Pro is a text-to-text AI model by deepseek. On ModelRunner it runs through a REST API or via MCP from any AI assistant with pay-per-use pricing.

POST https://queue.modelrunner.run/deepseek/v4

cURL

# Submit a request to the queue. Input fields go at the top level of the
# body. The optional reserved "metadata" object holds your own flat string
# tags — stored on the request, never sent to the model; filter later with
# GET https://queue.modelrunner.run/requests?metadata=<url-encoded JSON>.
curl -X POST https://queue.modelrunner.run/deepseek/v4 \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/v4",
    "messages": [
      {
        "role": "user",
        "content": "Given an array of n integers, find the length of the longest subsequence such that every two consecutive elements in the subsequence have an absolute difference of exactly 1. State the time and space complexity of your solution, then implement it in Python."
      }
    ],
    "max_tokens": 8000,
    "reasoning_effort": "high",
    "metadata": {
      "project": "my-project"
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/deepseek/v4/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/deepseek/v4/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("deepseek/v4", {
  input: {
    "model": "deepseek/v4",
    "messages": [
      {
        "role": "user",
        "content": "Given an array of n integers, find the length of the longest subsequence such that every two consecutive elements in the subsequence have an absolute difference of exactly 1. State the time and space complexity of your solution, then implement it in Python."
      }
    ],
    "max_tokens": 8000,
    "reasoning_effort": "high"
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/deepseek/v4",
    headers=headers,
    json={
      "model": "deepseek/v4",
      "messages": [
        {
          "role": "user",
          "content": "Given an array of n integers, find the length of the longest subsequence such that every two consecutive elements in the subsequence have an absolute difference of exactly 1. State the time and space complexity of your solution, then implement it in Python."
        }
      ],
      "max_tokens": 8000,
      "reasoning_effort": "high"
    },
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

NameTypeRequiredDescription
messagesarrayyesOpenAI-style conversation history. Each item is an object with a `role` (`system`, `user`, `assistant` or `tool`) and `content`. Text only — this model accepts no image, audio or document parts.
streambooleannoReturn the reply as a Server-Sent Events stream of deltas terminated by `data: [DONE]`. The chain of thought arrives on the same stream in a `reasoning_content` delta field. Default: false.
reasoning_effortenumnoHow hard the model thinks before answering. Defaults to `high`. Lowering it does not cut cost on this endpoint: `low` and `medium` behave as `high` and `xhigh` behaves as `max`, so `high` is the cheapest reachable setting. Thinking tokens bill as output tokens. Default: "high".
max_tokensintegernoUpper bound on generated tokens. `max_tokens` and the thinking budget share one 393,216-token ceiling, so a long chain of thought consumes the room left for the visible answer — allow generous headroom.
toolsarraynoOpenAI-format tool definitions the model may call.
tool_choiceno`auto`, `none`, `required`, or a specific tool.
response_formatobjectnoStructured-output control. Set its `type` to `json_object` to force a JSON reply.
stopnoUp to 4 stop sequences.
seedintegernoBest-effort determinism hint.

Machine-readable: OpenAPI schema · llms.txt

Use DeepSeek V4 Pro from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and DeepSeek V4 Pro becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint deepseek/v4.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run deepseek/v4 on ModelRunner to generate text”. MCP setup guide.

Model Details

Model Details

DeepSeek V4 Pro is an open-weight **thinking model** — MIT-licensed, 1.6T total parameters with 49B active per token — built for hard reasoning and code. It reasons before answering, and the brand publishes frontier-tier numbers on the model's own weights repo: **93.5% on LiveCodeBench**, a **3206 Codeforces rating**, **87.5% MMLU-Pro**, **92.6% GSM8K** and **57.9% SimpleQA-Verified**. You send `messages`, you get a chat completion.

The context window is 1,000,000 tokens, and the brand reports it is built to be worked in: at a million tokens the model needs 27% of the per-token inference FLOPs and 10% of the KV cache of the previous generation, which is what makes long-horizon work practical. One response is capped at **393,216 tokens**, and that ceiling is shared — `max_tokens` and the thinking budget draw from the same pool, so a long chain of thought eats the room left for the visible answer.

Thinking effort is set per request with `reasoning_effort`. The documented value set is `low`, `medium`, `high`, `xhigh` and `max`, defaulting to `high`; where a value is accepted, the levels collapse — `low` and `medium` behave exactly like `high`, and `xhigh` behaves like `max` — so there are only two real settings and **no cheap low-effort tier** either way, whether or not the lower values are accepted on this endpoint. Thinking tokens bill as output tokens, so effort and prompt size are both real cost levers.

## Best for - Competitive-programming-grade problems: write the algorithm, then justify its complexity - Hard multi-step reasoning and planning where the model should deliberate before answering - Reading an entire repository or document set in one prompt instead of chunking it - Tool-calling and structured-JSON agent loops that run over many turns - Work that needs open-weight, MIT-licensed capability rather than a closed model

## Choose another model when - Your input includes images, audio, video or PDFs — this model takes text only - You want the cheapest possible tokens for bulk classification, tagging or translation — every request here thinks at `high` or above, and thinking bills as output - A single reply plus its chain of thought has to exceed 393,216 tokens

Served through the OpenAI-compatible chat completions API:

``` POST https://queue.modelrunner.run/deepseek/v4/chat/completions ```

Point any OpenAI SDK or OpenAI-compatible tool at `base_url = https://queue.modelrunner.run/deepseek/v4` with your ModelRunner API key; streaming, tool calling and JSON mode all work.

```js import OpenAI from "openai";

const client = new OpenAI({ apiKey: process.env.MODELRUNNER_API_KEY, baseURL: "https://queue.modelrunner.run/deepseek/v4", });

const result = await client.chat.completions.create({ model: "deepseek/v4", messages: [ { role: "user", content: "Solve this scheduling problem in O(n log n) and prove the bound." }, ], reasoning_effort: "high", max_tokens: 4096, }); ```

Billing is per token from the model's own reported usage, thinking included; repeated prompt prefixes are cached automatically and bill at a steep discount.