Expose x-request-id in SSE streaming responses for Java SDK
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 1.5k
- Forks
- 264
- Avg merge
- 9h 46m
- Merged PRs (30d)
- 96
Description
Description
We need access to the x-request-id header to debug API requests with the OpenAI team, as described in the official docs:
👉 https://platform.openai.com/docs/api-reference/debugging-requests
Although x-request-id can be obtained when using:
OpenAIClientAsync.withRawResponse()
We are using SSE streaming in our project, below is example code:
OpenAIClientAsync currentClient = OpenAIOkHttpClientAsync.builder().build();
currentClient.responses().createStreaming(params)
.subscribe(event -> {
// business logic
})
.onCompleteFuture()
.thenAccept(result -> {
// handle completion
})
.exceptionally(ex -> {
// handle error
return null;
});
Feature request
Please provide a way to access the x-request-id header in SSE streaming responses (e.g., via callback, metadata, or event property).
This would make debugging and support much easier without requiring a full switch to withRawResponse().
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names OpenAIClientAsync and responses().createStreaming, but no implementation files or tests. Start by tracing createStreaming through SSE response handling and compare it with withRawResponse() header access. Done means callers can reliably read x-request-id from streaming responses, with tests covering the exposed access path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100