APIQIKAPIQIK
Docs
Features

Prefix Completion

Continue generation from prefilled assistant content to control templates, formats, and fixed openings.

Prefix completion lets the model continue after an application-provided assistant prefix. Use it for fixed openings, code scaffolding, or a specific output format.

Not a universal OpenAI Chat Completions field. prefix is an extension supported by some platforms or models. APIQIK support, model coverage, and the exact request structure must be confirmed before publishing an integration.

Request template

{
  "model": "<prefix-capable-model-id>",
  "messages": [
    {
      "role": "user",
      "content": "Write a Python function that checks whether an integer is prime."
    },
    {
      "role": "assistant",
      "content": "def is_prime(n: int) -> bool:\n    ",
      "prefix": true
    }
  ],
  "max_tokens": 300
}

Typical use cases

ScenarioPrefix exampleGoal
Code generationFunction signature or class definitionContinue an existing interface without unrelated explanation.
Format controlFixed beginning of JSON, Markdown, or SQLImprove format consistency.
Brand copyFixed title or disclaimerKeep required content at the beginning.
Conversation guidanceOpening that establishes the assistant's toneReduce style drift.

Limitations

  • Long prefixes consume context and increase costs.
  • Prefixes must match the task to avoid semantic or syntax conflicts.
  • Code prefixes should include required indentation and line breaks; validate the result with compilation or tests.
  • If the model does not support this extension, use clear instructions or a supported FIM capability.