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

# DeepSeek-V4.1-Flash

> Model IDs, limits, thinking controls and supported parameters for DeepSeek-V4.1-Flash.

## Model IDs

| Model ID |
| - |
| `deepseek-ai/DeepSeek-V4.1-Flash` |
| `deepseek-ai/DeepSeek-V4.1-Flash-fast` |
| `deepseek-ai/DeepSeek-V4.1-Flash-ultra` |

All three IDs serve the same model and accept the same parameters. Each ID has its own
rates and [rate limits](https://docs.lithosai.com/rate-limits.md), listed on the [Models](https://console.lithosai.cloud/models)
and [Limits](https://console.lithosai.cloud/limits) pages.

## Limits

| Limit | Tokens |
| - | - |
| Context length | 1,048,576 |
| Max output | 393,216 |

The context length covers the input and `max_tokens` together. A request whose input plus
`max_tokens` exceeds it returns 400. A `max_tokens` above 393,216 is accepted, but output
stops at 393,216 tokens.

A request that sets no `max_tokens` gets a default by mode:

| Mode | Default `max_tokens` |
| - | - |
| Thinking off | 8,192 |
| Thinking on | 65,536 |
| Thinking on, effort `max` | 131,072 |

If the prompt leaves less room than that in the context length, the default is the room left. A request
with images and no `max_tokens` can use up to the max output.
These limits and defaults match DeepSeek's official API. Long reasoning on a large input can need
more than the default, so set `max_tokens` when you use effort `max` or long documents.

## Thinking

Thinking is on by default at effort `high`, as on DeepSeek's official API. Control it with
`reasoning_effort` or with a DeepSeek-style `thinking` object.

| Request | Thinking |
| - | - |
| Neither field | On, effort `high` |
| `"reasoning_effort": "none"` | Off |
| `"reasoning_effort": "high"` | On, at the effort you set |
| `"thinking": {"type": "disabled"}` | Off |
| `"thinking": {"type": "enabled"}` | On, effort `high` |
| `"thinking": {"type": "enabled", "effort": "max"}` | On, at the effort you set |

`reasoning_effort` and `thinking.effort` accept `none`, `minimal`, `low`, `medium`, `high`,
`xhigh`, `max` and `ultra`. As on DeepSeek's API, some run as another effort:

| Requested | Runs as |
| - | - |
| `none` | Thinking off |
| `minimal`, `low` | `low` |
| `medium`, `high`, `xhigh` | `high` |
| `max`, `ultra` | `max` |

Any other value returns 400.

```python Python theme={null}
import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["LITHOSAI_API_KEY"],
    base_url="https://api.lithosai.cloud/v1",
)

# Thinking off
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4.1-Flash",
    messages=[{"role": "user", "content": "What is 17 * 23?"}],
    reasoning_effort="none",
)

# Thinking on, effort max
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4.1-Flash",
    messages=[{"role": "user", "content": "What is 17 * 23?"}],
    extra_body={"thinking": {"type": "enabled", "effort": "max"}},
)
print(response.choices[0].message.reasoning_content)
print(response.choices[0].message.content)
```

```bash curl theme={null}
curl https://api.lithosai.cloud/v1/chat/completions \
  -H "Authorization: Bearer $LITHOSAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-ai/DeepSeek-V4.1-Flash",
    "messages": [{"role": "user", "content": "What is 17 * 23?"}],
    "thinking": {"type": "disabled"}
  }'
```

The reasoning arrives in `message.reasoning_content`, or in `delta.reasoning_content` when
streaming, separate from `content`. `usage.completion_tokens_details.reasoning_tokens`
counts it. Reasoning tokens are part of `completion_tokens` and are billed as output.

`max_tokens` covers the reasoning and the answer together. If the reasoning uses the whole
budget, the response ends with `finish_reason: "length"` and an empty `content`. Stop
sequences are matched in the reasoning too, so a match there ends the response before the
answer starts.

## Parameters

| Parameter | Notes |
| - | - |
| `max_tokens`, `max_completion_tokens` | Cover reasoning and answer together. Default by mode, see [Limits](#limits). |
| `temperature` | 0 to 2. |
| `top_p` | Greater than 0, up to 1. |
| `top_k`, `presence_penalty`, `frequency_penalty` | Accepted. |
| `stop` | Also matched in the reasoning. |
| `seed` | Accepted, but does not make output reproducible. |
| `stream`, `stream_options` | Every stream ends with a usage chunk, with or without `include_usage`. |
| `tools`, `tool_choice` | `auto`, `required`, `none` or a named function. |
| `response_format` | `text`, `json_object` and `json_schema`. |
| `reasoning_effort`, `thinking` | See [Thinking](#thinking). |
| `user` | Accepted. |

With `tool_choice: "none"`, the tools are left out of the prompt, as on DeepSeek's API, so the model answers
in plain text.

These return 400:

| Parameter | `error.code` | `error.message` |
| - | - | - |
| `n` other than `1` | `unsupported_n` | `n must be 1` |
| `logprobs`, even `false` | `unsupported_parameter` | ``the parameter `logprobs` is not supported`` |
| `top_logprobs` | `unsupported_parameter` | ``the parameter `top_logprobs` is not supported`` |
| `logit_bias` | `unsupported_parameter` | ``the parameter `logit_bias` is not supported`` |
| Fields the API does not define, such as `chat_template_kwargs` | `unknown_parameter` | `unrecognized request argument supplied: chat_template_kwargs` |

```json theme={null}
{
  "error": {
    "message": "the parameter `logprobs` is not supported",
    "type": "invalid_request_error",
    "param": null,
    "code": "unsupported_parameter"
  }
}
```

Out-of-range values, such as `temperature: 3` or `top_p: 0`, also return 400.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.