Skip to content

Support for New OpenAI Models (o3, o4-mini, gpt4.1) #2770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BEOKS opened this issue Apr 17, 2025 · 3 comments
Open

Support for New OpenAI Models (o3, o4-mini, gpt4.1) #2770

BEOKS opened this issue Apr 17, 2025 · 3 comments

Comments

@BEOKS
Copy link

BEOKS commented Apr 17, 2025

Expected Behavior
Spring AI should support the latest OpenAI models - o3, o4-mini, and gpt4.1. Users should be able to specify these models in their configuration and use them like any other supported model.

Example configuration:

// Example of how it should work with the new models
ChatResponse response = chatModel.call(
    new Prompt(
        "hello", 
        OpenAiChatOptions.builder()
            .temperature(1.0)
            .reasoningEffort("high")
            .model(OpenAiApi.ChatModel.GPT_4_1_MINI) // Also support O3, O4_MINI
            .build()
    )
);
System.out.println("Response: " + response.getResult().getOutput().getText());

Users should be able to make API calls to these models with the same interface used for current models, with access to any model-specific features or capabilities.

Current Behavior
Currently, Spring AI's OpenAI integration doesn't include support for these new models. When attempting to use them, users either get an error or the system defaults to an older model. The client code doesn't recognize these model names as valid options.

Context
OpenAI has recently released these new models (o3, o4-mini, gpt4.1) with improved capabilities and performance. Many applications built on Spring AI need to utilize these new models to take advantage of their enhanced features, improved reasoning capabilities, and better performance characteristics.

I'm willing to contribute to this feature if the maintainers are open to it. If given guidance on implementation approach and requirements, I can prepare and submit a pull request to add support for these new models.

@dev-jonghoonpark
Copy link
Contributor

A PR for GPT 4.1 has been created.
#2747

o3, o4-mini have not been created yet.

@BEOKS
Copy link
Author

BEOKS commented Apr 17, 2025

@dev-jonghoonpark
I've checked the PR #2747 for GPT 4.1 support. Can I submit a separate PR for o3 and o4-mini model support?

@dev-jonghoonpark
Copy link
Contributor

Of course :)
If the branch is created based on the main branch, the merge should work without any issues.

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

No branches or pull requests

2 participants