> This page is for Model APIs.

> Sarvam Voice Agents (Samvaad) is a voice AI agent platform for Indian languages: build, test and deploy AI calling agents on your own phone numbers, from ₹3 a minute. Start here: https://docs.sarvam.ai/voice-agents/why-voice-agents.
> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt. For a section index, append `/llms.txt` to any section URL (for example https://docs.sarvam.ai/voice-agents/llms.txt).
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# DeepSeek V4 Pro

> DeepSeek V4 Pro is the larger open-weight DeepSeek V4 reasoning model, with text input and output, a 1,000,000-token context window, and tool calling.

DeepSeek V4 Pro is the larger model in the DeepSeek V4 family, served on Sarvam
infrastructure as an [open-weight model](/api/token-factory/models). It supports
text input and output with a **1,000,000-token context window**.

> **Note**
>
> DeepSeek V4 Pro is in **beta**. Its behaviour, limits, and availability may change before general availability. Beta models must be enabled for your API key; without access, requests return `400 invalid_request_error` ("This model is currently in beta"). [Contact us](/api/getting-started/help) to request access. See [Beta models](/api-reference/beta-apis).

## At a glance

|                    |                                                                                                                                    |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| **Model ID**       | `deepseekv4-pro`                                                                                                                   |
| **Best for**       | Harder reasoning and agentic tasks over long text                                                                                  |
| **Context window** | 1,000,000 tokens                                                                                                                   |
| **Input → output** | Text → text                                                                                                                        |
| **Reasoning**      | **`low`**, **`high`** (default), or **`max`**; can be turned off. See [Reasoning](#reasoning)                                      |
| **Tool calling**   | Supported, including `tool_choice: "required"` and parallel tool calls                                                             |
| **APIs**           | [`POST /v2/chat/completions`](/api-reference/chat/chat-completions-v2) and [`POST /v2/responses`](/api-reference/responses/create) |
| **Pricing**        | ₹115 input · ₹4 cached input · ₹350 output per 1M tokens; reasoning is billed as output ([Pricing](/api/getting-started/pricing))  |

## Key capabilities

#### Long context

Process up to 1,000,000 tokens across the prompt, reasoning, and generated output.

#### Reasoning

Choose `low`, `high`, or `max`, or turn thinking off for direct answers.

#### Tool calling

Use OpenAI-compatible `tools` and `tool_choice`, with thinking on or off.

#### Structured output

Constrain answers with `response_format` JSON schemas.

#### Log probabilities

Request `logprobs` and `top_logprobs`.

#### Multiple choices

Generate `n` > 1 completions in one request.

> **Tip**
>
> Moving from [OpenRouter](/api/token-factory/migrations/from-openrouter/overview), [Fireworks AI](/api/token-factory/migrations/from-fireworks/overview), or [Together AI](/api/token-factory/migrations/from-together/overview)? The migration guides map model IDs and request fields to Sarvam.

## Quickstart

#### Python

```python
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

response = client.chat.completions_v2(
    model="deepseekv4-pro",
    messages=[
        {
            "role": "user",
            "content": "Explain the difference between a B-tree and a B+ tree index.",
        }
    ],
    max_tokens=2000,
)

print(response.choices[0].message.content)
```

#### JavaScript

```javascript
import { SarvamAIClient } from "sarvamai";

const client = new SarvamAIClient({
    apiSubscriptionKey: "YOUR_SARVAM_API_KEY",
});

async function main() {
    const response = await client.chat.completionsV2({
        model: "deepseekv4-pro",
        messages: [
            {
                role: "user",
                content: "Explain the difference between a B-tree and a B+ tree index.",
            },
        ],
        max_tokens: 2000,
    });

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

main();
```

#### cURL

```bash
curl -X POST https://api.sarvam.ai/v2/chat/completions \
  -H "api-subscription-key: $SARVAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseekv4-pro",
    "messages": [
      {
        "role": "user",
        "content": "Explain the difference between a B-tree and a B+ tree index."
      }
    ],
    "max_tokens": 2000
  }'
```

## Supported parameters

`model: "deepseekv4-pro"` on [Chat Completion V2](/api-reference/chat/chat-completions-v2)
and [Responses](/api-reference/responses/create). Full request/response schemas live on
those API reference pages; this table covers what's actually accepted for this model.

| Parameter                                             |                             Chat Completion V2                            |                                               Responses                                               |
| ----------------------------------------------------- | :-----------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------: |
| Streaming (`stream`)                                  |                                                                           |                                                                                                       |
| Tool calling (`tools`, `tool_choice`)                 |                                                                           |                                                                                                       |
| `parallel_tool_calls: false` enforced                 |                                                                           |                                                                                                       |
| Structured output (`response_format` / `text.format`) |                                                                           |                                                                                                       |
| Log probabilities (`logprobs`, `top_logprobs`)        |                                                                           |  send `top_logprobs` with `include: ["message.output_text.logprobs"]`; `logprobs: true` returns `400` |
| Multiple choices (`n` > 1)                            |                                                                           |                                       N/A — Responses has no `n`                                      |
| Reasoning control                                     | `reasoning_effort`: `low`, `high` (default), `max`, or `none` to turn off |                                    `reasoning.effort`: same values                                    |
| Turn reasoning off                                    |                         `reasoning_effort: "none"`                        |                                       `reasoning.effort: "none"`                                      |

> **Warning**
>
> On `POST /v2/responses`, `logprobs` is only populated when the request includes
> `"include": ["message.output_text.logprobs"]`. Without it, `output[].content[].logprobs`
> is always an empty array even if `top_logprobs` is set. Verified against the live API on
> 2026-10-22.

## Reasoning

DeepSeek V4 Pro thinks by default at **`high`** effort.

| Value                              | Behaviour                                                   |
| ---------------------------------- | ----------------------------------------------------------- |
| `"low"`, `"high"`, `"max"`         | Sets the reasoning effort. Omitting the field gives `high`. |
| `"none"`                           | Turns thinking off.                                         |
| `"minimal"`, `"medium"`, `"xhigh"` | Also accepted.                                              |
| Integer budgets                    | Not supported; return `400`.                                |

Set the value with `reasoning_effort` on [Chat Completion V2](/api-reference/chat/chat-completions-v2)
or `reasoning.effort` on [Responses](/api-reference/responses/create). You can also turn thinking
off with `thinking: {"type": "disabled"}`, sent through `extra_body` in the SDKs:

```python
response = client.chat.completions_v2(
    model="deepseekv4-pro",
    messages=[{"role": "user", "content": "What is 17 × 23?"}],
    extra_body={"thinking": {"type": "disabled"}},
    max_tokens=2000,
)
```

Read the reasoning trace from `choices[].message.reasoning_content` on chat. On Responses,
`output` starts with a `reasoning` item; read its `content[0].text` (`summary` is empty).
Reasoning tokens are billed as output tokens and count against `max_tokens` /
`max_output_tokens`.

## Tool calling

Pass OpenAI-compatible `tools`. `tool_choice` accepts `"auto"`, `"none"`, `"required"`, or a
named function (`{"type": "function", "function": {"name": "..."}}`). Tool calling works with thinking on or off. The model
can return several tool calls in one turn; set `parallel_tool_calls: false` to get at most one.

## Known limitations

* Text input only. Image, audio, and video parts return `400`.
* Reasoning and the final answer share the **`max_tokens`** / **`max_output_tokens`** budget.
* `stop` strings apply to the answer only; a match inside the reasoning doesn't end the response.
* Structured output (`response_format` on chat, `text.format` on Responses) turns reasoning off,
  even when you set an effort level.
* Set **`max_tokens`** explicitly. When it's omitted, generation isn't capped at a small
  default and long answers can run to tens of thousands of tokens.

## Limits and errors

| Area           | Limit or condition                              | API response                                               | Recommended action                                                        |
| -------------- | ----------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------- |
| Output         | `max_tokens` exceeds 1,000,000                  | `400 invalid_request_error`                                | Set `max_tokens` within the context window.                               |
| Request size   | Request body exceeds 10 MiB (10,485,760 bytes)  | `413 invalid_request_error`, with the limit in the message | Shorten the prompt.                                                       |
| Modality       | Request includes image, audio, or video input   | `400 invalid_request_error`                                | Send text input only.                                                     |
| Reasoning      | Reasoning consumes the full `max_tokens` budget | `200` with `finish_reason: "length"`                       | Raise `max_tokens` or lower the reasoning effort.                         |
| Authentication | API key is missing or invalid                   | `403 invalid_api_key_error`                                | Check the `api-subscription-key` header.                                  |
| Model          | Model ID is unknown or unavailable              | `404 not_found_error`                                      | Check the spelling; model IDs are case-sensitive.                         |
| Quota          | No credits remain                               | `402 insufficient_quota_error`                             | Add credits in the [dashboard](https://indus.sarvam.ai/billing?ref=docs). |
| Rate limit     | Request or concurrency limit is exceeded        | `429 rate_limit_exceeded_error`                            | Back off and retry.                                                       |
| Availability   | Model remains overloaded after retries          | `503 model_overloaded`                                     | Retry later.                                                              |