> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# DeepSeek V4 Flash

> DeepSeek V4 Flash via Anyfast OpenAI-compatible API. Fast, capable, and easy to integrate.

DeepSeek V4 Flash is available through Anyfast via an OpenAI-compatible interface. It features thinking mode, function calling, and JSON mode support.

## Key capabilities

* **OpenAI-compatible** — Works as a drop-in replacement with the OpenAI SDK
* **Thinking mode** — Supports reasoning with configurable effort levels
* **Function calling** — Call tools and functions natively
* **JSON mode** — Structured output via `response_format`
* **Long context** — Handles large documents and multi-turn conversations
* **Streaming** — Supports real-time token streaming via SSE
* **Prompt caching** — Automatic cache with hit/miss token reporting

## Quick example

<CodeGroup>
  ```bash cURL theme={null}
  curl https://www.anyfast.ai/v1/chat/completions \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "deepseek-v4-flash",
      "messages": [
        { "role": "user", "content": "Explain quantum entanglement in simple terms." }
      ]
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://www.anyfast.ai/v1"
  )

  response = client.chat.completions.create(
      model="deepseek-v4-flash",
      messages=[
          {"role": "user", "content": "Explain quantum entanglement in simple terms."}
      ]
  )

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

  ```python Streaming theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://www.anyfast.ai/v1"
  )

  stream = client.chat.completions.create(
      model="deepseek-v4-flash",
      messages=[
          {"role": "user", "content": "Write a short poem about the sea."}
      ],
      stream=True
  )

  for chunk in stream:
      print(chunk.choices[0].delta.content or "", end="")
  ```
</CodeGroup>

## Parameters

| Parameter         | Type            | Required | Description                                                                                                                            |
| ----------------- | --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `model`           | string          | Yes      | Must be `deepseek-v4-flash`                                                                                                            |
| `messages`        | array           | Yes      | List of `{ role, content }` objects. Supports `system`, `user`, `assistant`, `tool` roles.                                             |
| `thinking`        | object          | No       | Enable/disable thinking: `{"type": "enabled"}` or `{"type": "disabled"}`. Optional `reasoning_effort`: `high`, `max`, `low`, `medium`. |
| `max_tokens`      | integer         | No       | Maximum tokens to generate                                                                                                             |
| `temperature`     | float           | No       | `0`–`2`. Controls randomness. Default: `1`                                                                                             |
| `stream`          | boolean         | No       | Enable SSE streaming. Default: `false`                                                                                                 |
| `stream_options`  | object          | No       | `{"include_usage": true}` includes token usage in the final streaming chunk                                                            |
| `top_p`           | float           | No       | Nucleus sampling threshold. Default: `1`                                                                                               |
| `stop`            | string / array  | No       | Sequences that stop generation (up to 16)                                                                                              |
| `response_format` | object          | No       | `{"type": "json_object"}` for JSON mode                                                                                                |
| `tools`           | array           | No       | List of function tools for function calling                                                                                            |
| `tool_choice`     | string / object | No       | Control tool selection: `none`, `auto`, `required`, or specific function                                                               |
| `user_id`         | string          | No       | Custom user ID for content safety and KVCache isolation                                                                                |

<Card title="API Reference" icon="code" href="/api-reference/model-api/deepseek/deepseek-v4-flash">
  View the interactive API playground for DeepSeek V4 Flash.
</Card>

<script src="/feedback.js" />
