In this article
OpenRouter assistant prefill supplies continuation context through the endpoint’s input structure; check route support, output validity and client assembly separately.
Assistant prefill places a partial assistant response at the end of the conversation so a supported model can continue it. In OpenRouter, this belongs to the input context. The mechanism becomes clearer when separated from ordinary user instructions, predicted output content and the client’s final assembly of the displayed answer.
A partial answer sets a continuation context
Imagine asking for a short comparison and supplying the opening phrase that establishes its tone. The API reference describes a final assistant-role item in the relevant input array for prefill. That item is different from a user message quoting the same phrase as reference material. Its role and position make it part of the assistant continuation context. The intended use should remain explicit in the request, so the developer can explain why the partial answer belongs there.
The request shape follows the endpoint
The reference shows input for Responses API and messages for Chat Completions. Treat these as distinct request containers instead of changing the base URL while leaving incompatible fields behind. Provider and model support also matter: a shared gateway does not make every upstream accept every conversation pattern identically. For the comparison example, check the chosen route’s behavior with a bounded sample. The result establishes compatibility for that request arrangement, not universal support inferred from the availability of a model name.
A prefix does not replace output validation
Starting an answer with a chosen phrase can guide continuation, but it does not prove that the remaining comparison is correct. If the application expects a structured record, it still needs the relevant supported format controls and validation. A partial opening brace is not evidence that the eventual artifact satisfies a schema. This is an engineering distinction between influencing generation context and establishing an accepted output contract. The acceptance check must evaluate the result the application will actually consume.
Assemble the user-visible answer deliberately
A client should verify how its chosen interface returns a continuation and how the existing prefix is displayed. Blindly prepending or deduplicating text can produce a repeated phrase or remove legitimate content. Test the exact combination using a recognizable partial answer, then document the assembly behavior in the client. Prediction remains a separate field for expected output content. Keeping context, route compatibility and display assembly distinct gives the developer a reproducible explanation when the model continuation looks different from the final rendered message.
Primary sources
Related context: Provider routing; Tool-calling integration.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.