Skip to content

feat: OpenAI realtime api#935

Open
vladimir-a-sap wants to merge 33 commits into
mainfrom
feat/poc-openai-realtime-api
Open

feat: OpenAI realtime api#935
vladimir-a-sap wants to merge 33 commits into
mainfrom
feat/poc-openai-realtime-api

Conversation

@vladimir-a-sap

@vladimir-a-sap vladimir-a-sap commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Context

AI/ai-sdk-java-backlog#386.

Adds OpenAI realtime API support

Feature scope:

  • Implemented destination selection, connection and authorization logic
  • Added heartbeat functionality to correctly manage conversation connections without unintended TCP resets
  • Implemented SDK Realtime API operations
    • Text to Speech
    • Speech to Speech
    • Speech to Text (requires additional support on the core/orchestration end)
  • Added sample app interactive examples
    • Text to Speech
    • Speech to Speech
    • Speech to Text (a blocker to be resolved on the BE side)
  • Added smoke test
    • Text to Speech
    • Speech to Speech
    • Speech to Text (requires additional support on the core/orchestration end)

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Aligned changes with the JavaScript SDK
  • Documentation updated
  • Release notes updated

Comment thread sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/Application.java Outdated
Comment thread sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/Application.java Outdated
Comment thread sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/Application.java Outdated
Comment thread orchestration/pom.xml Outdated
Comment thread orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClient.java Outdated

@CharlesDuboisSAP CharlesDuboisSAP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What do we do about the previous realtime PR? Is it still valid? Why is it abandonned?

@vladimir-a-sap

vladimir-a-sap commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

What do we do about the previous realtime PR? Is it still valid? Why is it abandonned?

My current understanding is that the mentioned PR cannot be completed to a SDK realtime solution. Here is the context and outcomes of my research why I think so:

There are three ways to implement realtime API with OpenAPI:

  • WebRTC
  • Websockets
  • SIP (telephony)

The previous PR implements SIP - it is a way for client and server to communicate about a connection in order to pass data, but not to establish connection or pass data in fact. The data layer should be implemented separately from the SIP protocol.

OpenAPI SIP protocol by design works with client-side web hooks as a mean to pass data and accept incoming connections (calls). Outgoing calls (client initiated) are not seem to be possible at all using solely SIP API.

We cannot expect SDK environment to have public http endpoints accessible from the internet to expose hooks. AI Core does not implement hook functionality either AFAIK.

Given that WebRTC is difficult to support on the BE and, AFAIK, our backend only supports Websockets at the moment, Websockets seem to be the only option we have.

@vladimir-a-sap vladimir-a-sap changed the title DRAFT: Feat/poc OpenAI realtime api Feat/poc OpenAI realtime api Jul 13, 2026
@vladimir-a-sap vladimir-a-sap changed the title Feat/poc OpenAI realtime api feat: OpenAI realtime api Jul 13, 2026
@vladimir-a-sap
vladimir-a-sap marked this pull request as ready for review July 13, 2026 16:48

@Jonas-Isr Jonas-Isr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The design is very cool! Thanks a lot for the detailed investigation and work :) I am reviewing this as if it would be the beta release already because I think without too much effort we turn this into a releasable state.

The two points below (and many of my comments) concern code conventions in the team.

General points:

  • Please add @Beta to all newly introduced public API. This way we have a grace period to change the API if we overlooked something in the beginning. We periodically re-evaluate and remove these annotations later on.
  • Please don’t put hand written classes into any of the model/ packages. These are only for generated code. If possible, put the SpeechOutputParam interface and the 2 classes implementing it into the open package.

Comment thread core/src/main/java/com/sap/ai/sdk/core/model/SpeechOutputParam.java Outdated
Comment thread core/src/main/java/com/sap/ai/sdk/core/model/SpeechOutputParamTurnDetection.java Outdated
Comment thread sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/WebsocketConfig.java Outdated
Comment thread sample-code/spring-app/src/main/resources/static/index.html Outdated
@vladimir-a-sap vladimir-a-sap mentioned this pull request Jul 17, 2026
9 tasks
@vladimir-a-sap

Copy link
Copy Markdown
Contributor Author

The design is very cool! Thanks a lot for the detailed investigation and work :) I am reviewing this as if it would be the beta release already because I think without too much effort we turn this into a releasable state.

The two points below (and many of my comments) concern code conventions in the team.

General points:

  • Please add @Beta to all newly introduced public API. This way we have a grace period to change the API if we overlooked something in the beginning. We periodically re-evaluate and remove these annotations later on.
  • Please don’t put hand written classes into any of the model/ packages. These are only for generated code. If possible, put the SpeechOutputParam interface and the 2 classes implementing it into the open package.

addressed both these points in addition to your comments in the PR

@vladimir-a-sap

Copy link
Copy Markdown
Contributor Author

What do we do about the previous realtime PR? Is it still valid? Why is it abandonned?

Discussed with @n-o-u-r-h-a-n and @rpanackal.

The initial implementation was SIP based and contains only http communication endpoints (and no audio processing implementation nor a means how this processing can be implemented). SIP-based approach requires a public http hook endpoint, which we cannot expect our SDK users to implement.

Hence we made the decision to close the previous PR, that was done after discussion. We may reopen and update it later if we decide to support SIP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants