# deepseek-v4.1-flash — API, Pricing & Context Window | Vivgrid

> Source: https://vivgrid.com/docs/models/deepseek-v4.1-flash

deepseek-v4.1-flash on Vivgrid: DeepSeek's fast, ultra-affordable V4.1 model with image input, a 1M-token context window, and up to 384K output.

`deepseek-v4.1-flash` is the fast, ultra-affordable member of DeepSeek's V4.1 family, released in September 2026. It keeps the V4 line's **1M-token context window** and **384K-token max output**, adds native **image input**, and is priced at **\$0.31 per 1M input tokens**, **\$0.01 cached**, and **\$1.23 output**.

It is a separate model id, not an in-place upgrade: `deepseek-v4-flash` stays available and unchanged, so you can pin either one.

It is available on both OpenAI surfaces — **Chat Completions** (`/chat/completions`) and the **Responses API** (`/responses`) — so coding CLIs that expect the Responses wire format, such as [Codex](/docs/tutorials/codex) and [Pi](/docs/tutorials/pi), work against the same key.

## Specifications

| Field | Value |
| --- | --- |
| Provider | DeepSeek |
| Model ID | `deepseek-v4.1-flash` |
| Best for | Coding |
| Available on | Vibe coding, Chat Completions |
| Context window | 1,000,000 tokens |
| Max output | 384,000 tokens |
| Modalities | Text, Image |
| Tool / function calling | Yes |
| Knowledge cutoff | — |
| Acceleration | Global (centralized) |

## Pricing

Pricing in USD per 1M tokens.

| Input | Cached input | Output |
| --- | --- | --- |
| $0.31 | $0.01 | $1.23 |

### What one request costs

The rates above applied to a 20K-token prompt with a 2K-token reply — a typical single agent turn, small enough that every request is billed at the base rate.

| Request | Cost |
| --- | --- |
| Cold prompt, nothing cached | $0.00866 |
| Warm prompt, 90% of the input served from cache | $0.00326 |


## Use deepseek-v4.1-flash in your coding agent

`deepseek-v4.1-flash` works with the same Vivgrid key and `https://api.vivgrid.com/v1` endpoint as every other model in the catalog. Grab your API key from the [Vivgrid Console](https://console.vivgrid.com), then drop one of the configurations below into your agent of choice.

### OpenCode

[OpenCode](https://opencode.ai) has Vivgrid built in, so you can use `deepseek-v4.1-flash` without writing any config: open `/models`, search for `vivgrid`, paste your API key and pick the model. The [OpenCode tutorial](/docs/tutorials/opencode) walks through it step by step.

Prefer to configure it by hand? Install OpenCode:

```bash
npm i -g opencode-ai
```

Declare `deepseek-v4.1-flash` under the Vivgrid provider in your global OpenCode config, `~/.config/opencode/opencode.json`. The `@ai-sdk/openai-compatible` provider talks to Vivgrid over **Chat Completions** (`/v1/chat/completions`):

```json title="~/.config/opencode/opencode.json" lines icon="json" highlight={3,6,9,10}
{
  "$schema": "https://opencode.ai/config.json",
  "model": "vivgrid/deepseek-v4.1-flash",
  "provider": {
    "vivgrid": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Vivgrid",
      "options": {
        "baseURL": "https://api.vivgrid.com/v1",
        "apiKey": "{env:VIVGRID_API_KEY}"
      },
      "models": {
        "deepseek-v4.1-flash": {
          "name": "deepseek-v4.1-flash",
          "tool_call": true,
          "attachment": true,
          "modalities": { "input": ["text", "image"], "output": ["text"] },
          "limit": { "context": 1000000, "output": 384000 }
        }
      }
    }
  }
}
```

Export your key and launch OpenCode:

```bash
export VIVGRID_API_KEY="viv-xxxxxxxxxxxxx"
opencode
```

Use `/models` to switch between `deepseek-v4.1-flash` and other Vivgrid models mid-session. See the full [OpenCode tutorial](/docs/tutorials/opencode).

### Pi

Install [Pi](https://pi.dev):

```bash
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
```

Add `deepseek-v4.1-flash` to the Vivgrid provider in `~/.pi/agent/models.json`. Pi talks to Vivgrid over **Chat Completions** (`/v1/chat/completions`):

```json title="~/.pi/agent/models.json" lines icon="json" highlight={4,5,9}
{
  "providers": {
    "vivgrid": {
      "baseUrl": "https://api.vivgrid.com/v1",
      "apiKey": "viv-xxxxxxxxxxxxx",
      "api": "openai-completions",
      "models": [
        {
          "id": "deepseek-v4.1-flash",
          "input": ["text", "image"],
          "contextWindow": 1000000,
          "maxTokens": 384000
        }
      ]
    }
  }
}
```

Make it the model Pi starts with in `~/.pi/agent/settings.json`:

```json title="~/.pi/agent/settings.json" lines icon="json" highlight={2,3}
{
  "defaultProvider": "vivgrid",
  "defaultModel": "deepseek-v4.1-flash"
}
```

Then verify and start Pi:

```bash
pi --list-models vivgrid
pi
```

Or run a one-shot prompt without entering the TUI:

```bash
pi -p "explain the auth flow in this repo" --model vivgrid/deepseek-v4.1-flash
```

See the full [Pi tutorial](/docs/tutorials/pi).

## API surfaces

The Vivgrid Console catalogs `deepseek-v4.1-flash` on 2 surfaces, all behind the same API key. The endpoint shown is the one the Console previews for that surface.

| Surface | Primary endpoint | Use it for |
| --- | --- | --- |
| Vibe coding | `/chat/completions` | Coding CLIs and IDE agents that drive the model themselves — point the tool at Vivgrid and keep your own loop. |
| Chat Completions | `/chat/completions` | Agent projects, where Vivgrid injects the model, system prompt and tools server-side, and Model API calls that name the model per request. |

## Quick start

Get an API key from the Vivgrid Console (https://console.vivgrid.com), then call `deepseek-v4.1-flash` directly.

```bash
curl https://api.vivgrid.com/v1/chat/completions \
  -H "Authorization: Bearer $VIVGRID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [
      { "role": "user", "content": "Say hello in English, Chinese and Spanish." }
    ],
    "stream": true
  }'
```

## Choosing within the DeepSeek V4 family

Prices are USD per 1M tokens at the base rate.

| Model | Context | Max output | Input | Output |
| --- | --- | --- | --- | --- |
| [`deepseek-v4-pro`](/docs/models/deepseek-v4-pro) | 1,000,000 | 384,000 | $1.74 | $3.48 |
| `deepseek-v4.1-flash` (this page) | 1,000,000 | 384,000 | $0.31 | $1.23 |


## Ideal use cases

- Very high-volume, cost-sensitive coding and agent traffic
- Tool-calling workflows that mix text with screenshots or diagrams
- Long-context summarization and extraction over whole repositories
- First-pass steps in multi-model pipelines ahead of a flagship model

## Related models

- [deepseek-v4-pro-0813](/docs/models/deepseek-v4-pro-0813) — DeepSeek's flagship V4 coding model
