openai / openai/codex

Feature request: Official Java SDK for Codex

Open
#43,469 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app-server CLI enhancement
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

CLI

What feature would you like to see?

Feature request: Official Java SDK for Codex

Summary

It would be very useful to have an official Java SDK for Codex, similar to the existing SDK support available in other languages.

We are integrating Codex into a Java-based agentic software engineering platform, and today the available integration options require either:

  • spawning and managing codex app-server as an external process and implementing the JSON-RPC protocol manually;
  • introducing a separate Python service only to access the Codex SDK;
  • or relying on lower-level/internal integration approaches.

An official Java SDK would significantly simplify this kind of integration.

Use case

Our application is primarily Java-based and implements a multi-agent software engineering workflow.

We would like to use Codex programmatically for capabilities such as:

  • ChatGPT account authentication;
  • starting and resuming threads;
  • starting turns;
  • streaming model responses and events;
  • configuring model, working directory, sandbox and approval policies;
  • handling tool calls and approvals;
  • retrieving account and model information;
  • managing conversation/session lifecycle.

Ideally, the Java API could expose abstractions similar to:

try (CodexClient codex = CodexClient.builder()
        .workingDirectory(projectPath)
        .build()) {

    codex.loginWithChatGPT();

    CodexThread thread = codex.startThread();

    CodexTurn turn = thread.startTurn(
        "Analyze this project and identify the main architectural components."
    );

    turn.onTextDelta(System.out::print);
    turn.awaitCompletion();
}
Why a Java SDK would be valuable

Java is still widely used for enterprise applications, developer tools, IDE integrations, backend platforms and large software modernization projects.

Without an official Java SDK, Java applications currently need to reproduce a substantial amount of infrastructure around codex app-server, including:

  • process lifecycle management;
  • JSON-RPC request/response correlation;
  • event streaming;
  • authentication flows;
  • reconnection and error handling;
  • protocol evolution and compatibility.

A supported SDK would also insulate applications from changes in the underlying App Server protocol.

Suggested scope

Even an initial lightweight SDK covering the main App Server APIs would already be extremely useful:

  • initialize
  • account/login/start
  • account/read
  • thread/start
  • thread/resume
  • thread/fork
  • turn/start
  • turn/interrupt
  • event / notification streaming
  • models listing
  • approval handling

It could internally use codex app-server, so the Java SDK would not necessarily need to reimplement the Codex runtime itself.

Alternative

If a full Java SDK is not currently planned, an officially supported Java client library for the Codex App Server protocol would already solve most of the integration problem.

Thanks for considering it.

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Codex app-server JSON-RPC surface and the listed APIs, including authentication, threads, turns, event streaming, models, and approvals. Done would mean an officially supported Java SDK or client library covering the proposed integration scope and insulating callers from protocol changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.