Skip to content

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

@BEOKS

Description

@BEOKS

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions