Enum Class OpenAiApi.ChatModel

java.lang.Object
java.lang.Enum<OpenAiApi.ChatModel>
org.springframework.ai.openai.api.OpenAiApi.ChatModel
All Implemented Interfaces:
Serializable, Comparable<OpenAiApi.ChatModel>, Constable, ChatModelDescription, ModelDescription
Enclosing class:
OpenAiApi

public static enum OpenAiApi.ChatModel extends Enum<OpenAiApi.ChatModel> implements ChatModelDescription
OpenAI Chat Completion Models.

This enum provides a selective list of chat completion models available through the OpenAI API, along with their key features and links to the official OpenAI documentation for further details.

The models are grouped by their capabilities and intended use cases. For each model, a brief description is provided, highlighting its strengths, limitations, and any specific features. When available, the description also includes information about the model's context window, maximum output tokens, and knowledge cutoff date.

References: OpenAI Models Documentation

  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The chatgpt-4o-latest model ID continuously points to the version of GPT-4o used in ChatGPT.
    GPT-3.5 Turbo models can understand and generate natural language or code and have been optimized for chat using the Chat Completions API but work well for non-chat tasks as well.
    GPT-3.5 Turbo Instruct has similar capabilities to GPT-3 era models.
    GPT-4 is an older version of a high-intelligence GPT model, usable in Chat Completions.
    GPT-4.1 is the flagship model for complex tasks.
    GPT-4.1-mini provides a balance between intelligence, speed, and cost that makes it an attractive model for many use cases.
    GPT-4.1-nano is the fastest, most cost-effective GPT-4.1 model.
    GPT-4o (“o” for “omni”) is the versatile, high-intelligence flagship model.
    GPT-4o Audio Preview represents a preview release of models that accept audio inputs and outputs via the Chat Completions REST API.
    GPT-4o-mini is a fast, affordable small model for focused tasks.
    GPT-4o-mini Audio Preview is a preview release model that accepts audio inputs and outputs and can be used in the Chat Completions REST API.
    GPT-4o mini Search Preview is a specialized model for web search in Chat Completions.
    GPT-4o Search Preview is a specialized model for web search in Chat Completions.
    GPT-4 Turbo is the next generation of GPT-4, an older high-intelligence GPT model.
    GPT-4o-mini Realtime model, is capable of responding to audio and text inputs in realtime over WebRTC or a WebSocket interface.
    GPT-4o Realtime model, is capable of responding to audio and text inputs in realtime over WebRTC or a WebSocket interface.
    The o1 series of models are trained with reinforcement learning to perform complex reasoning.
    o1-mini is a faster and more affordable reasoning model compared to o1.
    The o1-pro model, part of the o1 series trained with reinforcement learning for complex reasoning, uses more compute to think harder and provide consistently better answers.
    o3 is a well-rounded and powerful model across domains.
    o3-mini is a small reasoning model, providing high intelligence at cost and latency targets similar to o1-mini.
    o4-mini is the latest small o-series model.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the name of the model.
     
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.ai.model.ModelDescription

    getDescription, getVersion
  • Enum Constant Details

    • O4_MINI

      public static final OpenAiApi.ChatModel O4_MINI
      o4-mini is the latest small o-series model. It's optimized for fast, effective reasoning with exceptionally efficient performance in coding and visual tasks.

      Context window: 200,000 tokens. Max output tokens: 100,000 tokens. Knowledge cutoff: June 1, 2024.

      Model ID: o4-mini

      See: o4-mini

    • O3

      public static final OpenAiApi.ChatModel O3
      o3 is a well-rounded and powerful model across domains. It sets a new standard for math, science, coding, and visual reasoning tasks. It also excels at technical writing and instruction-following. Use it to think through multi-step problems that involve analysis across text, code, and images.

      Context window: 200,000 tokens. Max output tokens: 100,000 tokens. Knowledge cutoff: June 1, 2024.

      Model ID: o3

      See: o3

    • O3_MINI

      public static final OpenAiApi.ChatModel O3_MINI
      o3-mini is a small reasoning model, providing high intelligence at cost and latency targets similar to o1-mini. o3-mini supports key developer features, like Structured Outputs, function calling, Batch API.

      The knowledge cutoff for o3-mini models is October, 2023.

      Context window: 200,000 tokens. Max output tokens: 100,000 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: o3-mini

      See: o3-mini

    • O1

      public static final OpenAiApi.ChatModel O1
      The o1 series of models are trained with reinforcement learning to perform complex reasoning. o1 models think before they answer, producing a long internal chain of thought before responding to the user.

      Context window: 200,000 tokens. Max output tokens: 100,000 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: o1

      See: o1

    • O1_MINI

      public static final OpenAiApi.ChatModel O1_MINI
      o1-mini is a faster and more affordable reasoning model compared to o1. o1-mini currently only supports text inputs and outputs.

      Context window: 128,000 tokens. Max output tokens: 65,536 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: o1-mini

      See: o1-mini

    • O1_PRO

      public static final OpenAiApi.ChatModel O1_PRO
      The o1-pro model, part of the o1 series trained with reinforcement learning for complex reasoning, uses more compute to think harder and provide consistently better answers.

      Note: o1-pro is available in the Responses API only to enable support for multi-turn model interactions and other advanced API features.

      Context window: 200,000 tokens. Max output tokens: 100,000 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: o1-pro

      See: o1-pro

    • GPT_4_1

      public static final OpenAiApi.ChatModel GPT_4_1
      GPT-4.1 is the flagship model for complex tasks. It is well suited for problem solving across domains.

      Context window: 1,047,576 tokens. Max output tokens: 32,768 tokens. Knowledge cutoff: June 1, 2024.

      Model ID: gpt-4.1

      See: gpt-4.1

    • GPT_4_O

      public static final OpenAiApi.ChatModel GPT_4_O
      GPT-4o (“o” for “omni”) is the versatile, high-intelligence flagship model. It accepts both text and image inputs, and produces text outputs (including Structured Outputs). It is considered the best model for most tasks, and the most capable model outside of the o-series models.

      Context window: 128,000 tokens. Max output tokens: 16,384 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: gpt-4o

      See: gpt-4o

    • CHATGPT_4_O_LATEST

      public static final OpenAiApi.ChatModel CHATGPT_4_O_LATEST
      The chatgpt-4o-latest model ID continuously points to the version of GPT-4o used in ChatGPT. It is updated frequently when there are significant changes to ChatGPT's GPT-4o model.

      Context window: 128,000 tokens. Max output tokens: 16,384 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: chatgpt-4o-latest

      See: chatgpt-4o-latest

    • GPT_4_O_AUDIO_PREVIEW

      public static final OpenAiApi.ChatModel GPT_4_O_AUDIO_PREVIEW
      GPT-4o Audio Preview represents a preview release of models that accept audio inputs and outputs via the Chat Completions REST API.

      Context window: 128,000 tokens. Max output tokens: 16,384 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: gpt-4o-audio-preview

      See: gpt-4o-audio-preview

    • GPT_4_1_MINI

      public static final OpenAiApi.ChatModel GPT_4_1_MINI
      GPT-4.1-mini provides a balance between intelligence, speed, and cost that makes it an attractive model for many use cases.

      Context window: 1,047,576 tokens. Max output tokens: 32,768 tokens. Knowledge cutoff: June 1, 2024.

      Model ID: gpt-4.1-mini

      See: gpt-4.1-mini

    • GPT_4_1_NANO

      public static final OpenAiApi.ChatModel GPT_4_1_NANO
      GPT-4.1-nano is the fastest, most cost-effective GPT-4.1 model.

      Context window: 1,047,576 tokens. Max output tokens: 32,768 tokens. Knowledge cutoff: June 1, 2024.

      Model ID: gpt-4.1-nano

      See: gpt-4.1-nano

    • GPT_4_O_MINI

      public static final OpenAiApi.ChatModel GPT_4_O_MINI
      GPT-4o-mini is a fast, affordable small model for focused tasks. It accepts both text and image inputs and produces text outputs (including Structured Outputs). It is ideal for fine-tuning, and model outputs from a larger model like GPT-4o can be distilled to GPT-4o-mini to produce similar results at lower cost and latency.

      Context window: 128,000 tokens. Max output tokens: 16,384 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: gpt-4o-mini

      See: gpt-4o-mini

    • GPT_4_O_MINI_AUDIO_PREVIEW

      public static final OpenAiApi.ChatModel GPT_4_O_MINI_AUDIO_PREVIEW
      GPT-4o-mini Audio Preview is a preview release model that accepts audio inputs and outputs and can be used in the Chat Completions REST API.

      Context window: 128,000 tokens. Max output tokens: 16,384 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: gpt-4o-mini-audio-preview

      See: gpt-4o-mini-audio-preview

    • GPT_4O_REALTIME_PREVIEW

      public static final OpenAiApi.ChatModel GPT_4O_REALTIME_PREVIEW
      GPT-4o Realtime model, is capable of responding to audio and text inputs in realtime over WebRTC or a WebSocket interface.

      Context window: 128,000 tokens. Max output tokens: 4,096 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: gpt-4o-realtime-preview

      See: gpt-4o-realtime-preview

    • GPT_4O_MINI_REALTIME_PREVIEW

      public static final OpenAiApi.ChatModel GPT_4O_MINI_REALTIME_PREVIEW
      GPT-4o-mini Realtime model, is capable of responding to audio and text inputs in realtime over WebRTC or a WebSocket interface.

      Context window: 128,000 tokens. Max output tokens: 4,096 tokens. Knowledge cutoff: October 1, 2023.

      Model ID: gpt-4o-mini-realtime-preview

      See: gpt-4o-mini-realtime-preview

    • GPT_4_TURBO

      public static final OpenAiApi.ChatModel GPT_4_TURBO
      GPT-4 Turbo is the next generation of GPT-4, an older high-intelligence GPT model. It was designed to be a cheaper, better version of GPT-4. Today, we recommend using a newer model like GPT-4o.

      Context window: 128,000 tokens. Max output tokens: 4,096 tokens. Knowledge cutoff: Dec 01, 2023.

      Model ID: gpt-4-turbo

      See: gpt-4-turbo

    • GPT_4

      public static final OpenAiApi.ChatModel GPT_4
      GPT-4 is an older version of a high-intelligence GPT model, usable in Chat Completions. Vision capabilities may not be available.

      Context window: 128,000 tokens. Max output tokens: 4,096 tokens. Knowledge cutoff: Dec 01, 2023.

      Model ID: gpt-4

      See: gpt-4

    • GPT_3_5_TURBO

      public static final OpenAiApi.ChatModel GPT_3_5_TURBO
      GPT-3.5 Turbo models can understand and generate natural language or code and have been optimized for chat using the Chat Completions API but work well for non-chat tasks as well. Generally lower cost but less capable than GPT-4 models.

      As of July 2024, GPT-4o mini is recommended over gpt-3.5-turbo for most use cases.

      Context window: 16,385 tokens. Max output tokens: 4,096 tokens. Knowledge cutoff: September, 2021.

      Model ID: gpt-3.5-turbo

      See: gpt-3.5-turbo

    • GPT_3_5_TURBO_INSTRUCT

      public static final OpenAiApi.ChatModel GPT_3_5_TURBO_INSTRUCT
      GPT-3.5 Turbo Instruct has similar capabilities to GPT-3 era models. Compatible with the legacy Completions endpoint and not Chat Completions.

      Context window: 4,096 tokens. Max output tokens: 4,096 tokens. Knowledge cutoff: September, 2021.

    • GPT_4_O_SEARCH_PREVIEW

      public static final OpenAiApi.ChatModel GPT_4_O_SEARCH_PREVIEW
      GPT-4o Search Preview is a specialized model for web search in Chat Completions. It is trained to understand and execute web search queries. See the web search guide for more information.
    • GPT_4_O_MINI_SEARCH_PREVIEW

      public static final OpenAiApi.ChatModel GPT_4_O_MINI_SEARCH_PREVIEW
      GPT-4o mini Search Preview is a specialized model for web search in Chat Completions. It is trained to understand and execute web search queries. See the web search guide for more information.
  • Field Details

    • value

      public final String value
  • Method Details

    • values

      public static OpenAiApi.ChatModel[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static OpenAiApi.ChatModel valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public String getValue()
    • getName

      public String getName()
      Description copied from interface: ModelDescription
      Returns the name of the model.
      Specified by:
      getName in interface ModelDescription
      Returns:
      the name of the model