Simple-OpenAI: A Java library with support for Assistants v2

Let me introduce Simple OpenAI a Java http client library for sending requests to and receiving responses from the OpenAI Api. It exposes a consistent interface across all the services, yet as simple as you can find in other languages like Python or NodeJs.

Simple-OpenAI uses the CleverClient library for http communication, Jackson for Json parsing, and Lombok to minimize boilerplate code.


Nice. Thanks for sharing with us. … Appreciate it!

1 Like

Hello :wave: OpenAI community !!

I would really like to get feedback/thoughts/concerns about this Java library in order to improve it or include any necessary functionality. Please feel free to drop a few lines here, I would appreciate it.

King regards


1 Like

A new release of Simple OpenAI is available. It has fixes for some minor issues and testing coverage of 95%.


New Major Release 2.0.0

I’m happy to announce that we have released a new major version of our simple-openai library.

The main change is that from now on we support the use of OpenAI with two additional providers: Azure and Anyscale. Currently, we are supporting the chat completion service for both providers.

For the original provider we have full updated support for all the OpenAI services: audio, chat completion, completion, embedding, file, fine tuning, image, model, moderation, assistant, thread.

Take a look for more detail.

New Release 2.2.0

The library has been updated with the latest changes from OpenAI:

  • Support for Assistant Stream Events. :fire:
  • Sync changes in Audio API. :fire:
  • Sync changes in FineTuning API. :fire:
  • Sync changes in Assistant API. :fire:

Other internal improvements:

  • Improve field validation. :hammer_and_wrench:
  • Split OpenAI interface. :hammer_and_wrench:
  • Automate code formatting. :hammer_and_wrench:
  • Add contribution instructions. :hammer_and_wrench:
  • Setup for deploying to Maven Central. :hammer_and_wrench:

Take a look at simple-openai.

New Release 2.3.0

Simple-OpenAI has been updated with the latest changes from OpenAI until Apr 16:

  • Support for new Batch API. :fire:
  • Support for new Project Key. :fire:
  • Enabling Assistant API for Azure. :fire:
  • Fixing SonarCloud issues. :hammer_and_wrench:

Take a look at simple-openai .


Sashi, this is some great stuff - thank you very much for this. I will be looking to test porting my existing code from another java client to yours. Would love to see you tackle Assistants V2 API as well. Keep up the good work!

1 Like

New Release 3.0.0

Simple-OpenAI has been updated with the latest changes from OpenAI until Apr 29th:

  • Full Support for Assistants API v2 :fire::fire:

    • Assistants, Threads, Messages, Runs, Run Steps. :white_check_mark:
    • File Search Tool, Vector Stores, Vector Stores Batches. :white_check_mark:
    • Full Streaming, Pooling Helpers if not using streaming. :white_check_mark:
    • Demo code using Functions, File Search and Streaming. :white_check_mark:
  • Functions & Tools code was revamped to be shared between
    Assistants and Chat Completions. :hammer_and_wrench:

  • Code for Assistants API v1 was entirely removed. :hammer_and_wrench:

Take a look at simple-openai .

New Release 3.1.0

Simple-OpenAI has been updated with the latest changes from OpenAI until May 6th, 2024:

  • Support for the stream_options parameter :fire:
    for Chat Completions and Completions APIs

Take a look at simple-openai .

“AI is like electricity. Just as electricity transformed every major industry a century ago, AI is now poised to do the same.” By Andrew Ng

New Release 3.2.0

Simple-OpenAI seeks to stay up to date with the most recent changes in OpenAI. Currently, it supports all existing features until May 9th, 2024 and will continue to update with future changes.

What’s new in this release?

  • Support for image inputs to the Assistants API :fire:
  • Fix some minor issues :hammer_and_wrench:

If you are a Java developer venturing into the world of AI, don’t miss the opportunity to take a look at simple-openai.

New Release 3.3.0

What’s new?

  • FunctionExecutor allows functions auto selection based on toolChoice :fire:
  • Conversation examples with gpt-4o with streaming and functions :fire:
  • Enable ToolFunctionDef instantiation (for custom function handlers) :fire:
  • Fix some minor issues (AssistantTool, File Path Windows, Javadoc) :hammer_and_wrench:

Take a look at simple-openai and enjoy the most up-to-date OpenAI features available for use in your Java projects.