Add /v1/completions endpoint (OpenAI legacy completions API) to `transformers serve` (#44558)
Add /v1/completions endpoint (OpenAI legacy Completions API) to `transformers serve`
Adds support for the legacy text completions endpoint, which accepts a
freeform text prompt (no chat template) and returns generated text in
choices[].text. Supports both streaming and non-streaming modes, suffix
for fill-in-the-middle insertion, and proper finish_reason detection.
The implementation follows the refactored serving architecture: a new
CompletionHandler in serving/completion.py extends BaseHandler, and the
route is registered in serving/server.py.
Co-authored-by: Antigravity <bot@antigravity.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>