Skip to content

/v1/completions with a token-id prompt and echo: true fails with a TypeError #22233

Open

Description

@sohailshk

System Info

Current main (486bf35). Post-processing logic only, no GPU needed.

Who can help?

OpenAI-compatible serving (code owners of the touched files).

Reproduction

Request: {"model": ..., "prompt": [1, 2, 3], "echo": true, "max_tokens": 5} (the completions API takes the prompt as text or as token ids).

The route (openai_server.py, if request.echo: postproc_args.prompt = prompt) stores the prompt as sent, here a list of ints. Driving completion_response_post_processor with CompletionPostprocArgs(prompt=[1, 2, 3], echo=True, ...) and one output:

TypeError: can only concatenate list (not "str") to list

completion_stream_post_processor fails the same way on its first iteration (delta_text = args.prompt + delta_text). Only the post-processors were exercised, with stand-in outputs; no server was started, so the HTTP status the route turns this into was not observed.

Expected behavior

The reply starts with the prompt as text, i.e. the token ids decoded. vLLM and SGLang decode a token-id prompt for echo (vLLM keeps special tokens, SGLang skips them); following the request's skip_special_tokens (default True) would be consistent with the rest of the request.

actual behavior

Both post-processors add the list to the completion text.

additional notes

Open #21640 copies the postproc_args.prompt = prompt route code into the new serving class unchanged. I have a fix with a test and can open a PR.

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.

Activity

  1. added
    LLM API
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    LLM API

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions