DeepSeek prefix completion
deepseek_prefixForces a model response to start with your supplied text, then continues generation so you can pin output formats, resume truncated answers, or steer refusal-prone completions.
Instructions
Beta prefix completion: force the model's reply to begin with text you supply, then let it continue. Use it to pin output format (start with '```python' to guarantee a code block), to resume a truncated answer, or to steer a refusal-prone completion. The prefix is included in the returned text.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prefix": "<prefix>"
},
"name": "deepseek_prefix"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stop | No | Up to 16 stop sequences. A single string is also accepted. | |
| extra | No | ||
| model | No | ||
| top_p | No | Nucleus sampling, 0-1. Ignored by deepseek-reasoner. | |
| prefix | Yes | The exact text the assistant reply must start with. | |
| prompt | No | The user message. | |
| stream | No | ||
| system | No | ||
| logprobs | No | Return log probabilities. deepseek-chat only. | |
| messages | No | Full message array, OpenAI-compatible. Use this instead of `prompt` when you need multi-turn control. Roles: system, user, assistant, tool. | |
| max_tokens | No | Maximum output tokens. Omit for the server-side maximum (8192 for deepseek-chat, 65536 for deepseek-reasoner). No client-side cap is applied. | |
| timeout_ms | No | ||
| temperature | No | 0.0-2.0. DeepSeek's own guidance: 0.0 for code and maths, 1.0 for general conversation and data analysis, 1.3 for creative writing. Ignored by deepseek-reasoner. | |
| raw_response | No | ||
| top_logprobs | No | 0-20, requires logprobs. deepseek-chat only. | |
| presence_penalty | No | -2.0 to 2.0. Ignored by deepseek-reasoner. | |
| frequency_penalty | No | -2.0 to 2.0. Ignored by deepseek-reasoner. |