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

# 前缀续写

## 1. 使用场景

前缀续写中，用户提供希望输出的前缀信息，来让模型基于用户提供的前缀信息来补全其余的内容。
基于上述能力，模型能有更好的指令遵循能力，满足用户一些特定场景的指定格式的问题。

## 2. 使用方式

在请求中添加

```json theme={null}
extra_body={"prefix":"希望的前缀内容"}
```

## 3. 支持模型列表

目前[大语言类模型](https://cloud.siliconflow.cn/models?types=chat) 中非推理模型支持上述参数，推理模型中 Qwen3 系列，需要通过增加`enable_thinking=true`关闭推理后，支持上述参数，deepseek R1系列暂时不支持上述参数。

<Note>注意：支持的模型情况可能会发生变化，请查阅本文档了解最新支持的模型列表。</Note>

## 4. 使用示例

下面是基于 OpenAI 库使用前缀续写的例子：

````python theme={null}
client = OpenAI(
    api_key="您的 APIKEY", # 从https://cloud.siliconflow.cn/account/ak获取
    base_url="https://api.siliconflow.cn/v1"
)
 
messages = [
    {"role": "user", "content": "Please write quick sort code"},
]

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V2.5",
    messages=messages,
    extra_body={"prefix":"```python\n"}
)

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