Skip to content

Conversation

kebe7jun
Copy link
Contributor

@kebe7jun kebe7jun commented Aug 21, 2025

Related issue #23225

Purpose

Support logprobs for Response API (non-stream).

Stream mode is currently divided into several cases:
gpt-oss models use Harmony, as they use a custom parser, and logprobs are not implemented yet. gpt-5-mini also does not support logprobs.

➜  ~ curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-proj-xxx" \
  -d '{
    "include": ["message.output_text.logprobs"],
    "model": "gpt-5-mini",
    "input": "hello, ",
    "store": true,
    "top_logprobs": 3
  }'

{
  "error": {
    "message": "logprobs are not supported with reasoning models.",
    "type": "invalid_request_error",
    "param": "include",
    "code": "unsupported_parameter"
  }
}

Other models have not yet fully implemented the Response Streaming API, so support is temporarily unavailable.

if not isinstance(context, StreamingHarmonyContext):
raise NotImplementedError(
"Streaming is not supported for responses API without Harmony."
)

Test Plan

Added unit tests.

Test Result

See CI.

(Optional) Documentation Update


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

@kebe7jun kebe7jun force-pushed the feature/response-api-logprobs branch from 44b8826 to 7479a9b Compare August 21, 2025 07:41
@kebe7jun kebe7jun marked this pull request as ready for review August 21, 2025 07:43
@kebe7jun kebe7jun requested a review from aarnphm as a code owner August 21, 2025 07:43
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@kebe7jun kebe7jun force-pushed the feature/response-api-logprobs branch 3 times, most recently from 1ff92d4 to b1bcf37 Compare August 21, 2025 08:58
@kebe7jun kebe7jun force-pushed the feature/response-api-logprobs branch from b1bcf37 to 4a82547 Compare August 21, 2025 08:59
Copy link
Collaborator

@heheda12345 heheda12345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the contribution.

@heheda12345 heheda12345 enabled auto-merge (squash) August 21, 2025 21:08
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 21, 2025
@heheda12345
Copy link
Collaborator

BTW I think there are still some todos like logprobs + harmony and streaming, so I change "fix xxx" to "related issue xxx". Can you also help on those parts?

@heheda12345 heheda12345 merged commit 5368f76 into vllm-project:main Aug 21, 2025
49 checks passed
@kebe7jun kebe7jun deleted the feature/response-api-logprobs branch August 22, 2025 15:59
@kebe7jun
Copy link
Contributor Author

BTW I think there are still some todos like logprobs + harmony and streaming, so I change "fix xxx" to "related issue xxx". Can you also help on those parts?

Glad to do it.

Xu-Wenqing pushed a commit to Xu-Wenqing/vllm that referenced this pull request Aug 23, 2025
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
juuice-lee pushed a commit to juuice-lee/vllm-moe.code that referenced this pull request Aug 28, 2025
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
dumb0002 pushed a commit to dumb0002/vllm that referenced this pull request Aug 28, 2025
@charlotte12l
Copy link

@kebe7jun, is non-stream + harmony supported? I saw

if self.use_harmony and request.is_include_output_logprobs():
return self.create_error_response(
err_type="invalid_request_error",
message="logprobs are not supported with gpt-oss models",
status_code=HTTPStatus.BAD_REQUEST,
)

@kebe7jun
Copy link
Contributor Author

@kebe7jun, is non-stream + harmony supported? I saw

if self.use_harmony and request.is_include_output_logprobs():
return self.create_error_response(
err_type="invalid_request_error",
message="logprobs are not supported with gpt-oss models",
status_code=HTTPStatus.BAD_REQUEST,
)

no, gpt-oss models not support logprobs.

2015aroras pushed a commit to 2015aroras/vllm that referenced this pull request Aug 29, 2025
mengxingkongzhouhan pushed a commit to mengxingkongzhouhan/vllm that referenced this pull request Aug 30, 2025
mengxingkongzhouhan pushed a commit to mengxingkongzhouhan/vllm that referenced this pull request Aug 30, 2025
mengxingkongzhouhan pushed a commit to mengxingkongzhouhan/vllm that referenced this pull request Aug 30, 2025
mengxingkongzhouhan pushed a commit to mengxingkongzhouhan/vllm that referenced this pull request Aug 30, 2025
mengxingkongzhouhan pushed a commit to mengxingkongzhouhan/vllm that referenced this pull request Aug 30, 2025
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend ready ONLY add when PR is ready to merge/full CI is needed v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants