← Back to API Guides

Chat Prefix Completion (Beta)

Provide a partial assistant response as a prefix, and the model will continue from where you left off.

Usage

Set the last message role to "assistant" with a prefix value. The model will continue generating from that prefix. This feature requires the prefix parameter.
{
  "model": "deepseek-v4-pro",
  "messages": [
    {"role": "user", "content": "Write a poem about AI"},
    {"role": "assistant", "content": "In circuits deep", "prefix": true}
  ]
}