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:

  • 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-0125-preview is the latest GPT-4 model intended to reduce cases of “laziness” where the model doesn’t complete a task.
    GPT-4 model snapshot.
    GPT-4 model snapshot.
    Currently points to GPT_4_0125_PREVIEW.
    GPT-4o ("omni") is our versatile, high-intelligence flagship model.
    GPT-4o Audio is a preview release model that accepts audio inputs and outputs and can be used in the Chat Completions REST API.
    GPT-4o-mini is a fast, affordable small model for focused tasks.
    GPT-4o-mini Audio is a preview release model that accepts audio inputs and outputs and can be used in the Chat Completions REST API.
    GPT-4 Turbo is a high-intelligence GPT model with vision capabilities, usable in Chat Completions.
    GPT-4 Turbo Preview is a high-intelligence GPT model usable in Chat Completions.
    o1 is trained with reinforcement learning to perform complex reasoning.
    o1-mini is a faster and more affordable reasoning model compared to o1.
    o1-preview is trained with reinforcement learning to perform complex reasoning.
    o3-mini is our most recent small reasoning model, providing high intelligence at the same cost and latency targets of o1-mini.
  • 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

    • O1

      public static final OpenAiApi.ChatModel O1
      o1 is trained with reinforcement learning to perform complex reasoning. It thinks before it answers, producing a long internal chain of thought before responding to the user.

      The latest o1 model supports both text and image inputs, and produces text outputs (including Structured Outputs).

      The knowledge cutoff for o1 is October, 2023.

    • O1_PREVIEW

      public static final OpenAiApi.ChatModel O1_PREVIEW
      o1-preview is trained with reinforcement learning to perform complex reasoning. It thinks before it answers, producing a long internal chain of thought before responding to the user.

      The latest o1-preview model supports both text and image inputs, and produces text outputs (including Structured Outputs).

      The knowledge cutoff for o1-preview is October, 2023.

    • 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.

      The knowledge cutoff for o1-mini is October, 2023.

    • O3_MINI

      public static final OpenAiApi.ChatModel O3_MINI
      o3-mini is our most recent small reasoning model, providing high intelligence at the same cost and latency targets of o1-mini. o3-mini also supports key developer features, like Structured Outputs, function calling, Batch API, and more. Like other models in the o-series, it is designed to excel at science, math, and coding tasks.

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

    • GPT_4_O

      public static final OpenAiApi.ChatModel GPT_4_O
      GPT-4o ("omni") is our versatile, high-intelligence flagship model. It accepts both text and image inputs and produces text outputs (including Structured Outputs).

      The knowledge cutoff for GPT-4o models is October, 2023.

    • 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, 2023.

    • GPT_4_O_AUDIO_PREVIEW

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

      The knowledge cutoff for GPT-4o Audio models is October, 2023.

    • GPT_4_O_MINI_AUDIO_PREVIEW

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

      The knowledge cutoff for GPT-4o-mini Audio models is October, 2023.

    • 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.

      The knowledge cutoff for GPT-4o-mini models is October, 2023.

    • GPT_4_TURBO

      public static final OpenAiApi.ChatModel GPT_4_TURBO
      GPT-4 Turbo is a high-intelligence GPT model with vision capabilities, usable in Chat Completions. Vision requests can now use JSON mode and function calling.

      The knowledge cutoff for the latest GPT-4 Turbo version is December, 2023.

    • GPT_4_0125_PREVIEW

      public static final OpenAiApi.ChatModel GPT_4_0125_PREVIEW
      GPT-4-0125-preview is the latest GPT-4 model intended to reduce cases of “laziness” where the model doesn’t complete a task.

      Context window: 128,000 tokens. Max output tokens: 4,096 tokens.

    • GPT_4_1106_PREVIEW

      public static final OpenAiApi.ChatModel GPT_4_1106_PREVIEW
      Currently points to GPT_4_0125_PREVIEW.

      Context window: 128,000 tokens. Max output tokens: 4,096 tokens.

    • GPT_4_TURBO_PREVIEW

      public static final OpenAiApi.ChatModel GPT_4_TURBO_PREVIEW
      GPT-4 Turbo Preview is a high-intelligence GPT model usable in Chat Completions.

      Currently points to GPT_4_0125_PREVIEW.

      Context window: 128,000 tokens. Max output tokens: 4,096 tokens.

    • 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.

      Currently points to GPT_4_0613.

      Context window: 8,192 tokens. Max output tokens: 8,192 tokens.

    • GPT_4_0613

      public static final OpenAiApi.ChatModel GPT_4_0613
      GPT-4 model snapshot.

      Context window: 8,192 tokens. Max output tokens: 8,192 tokens.

    • GPT_4_0314

      public static final OpenAiApi.ChatModel GPT_4_0314
      GPT-4 model snapshot.

      Context window: 8,192 tokens. Max output tokens: 8,192 tokens.

    • 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.

      As of July 2024, GPT_4_O_MINI should be used in place of gpt-3.5-turbo, as it is cheaper, more capable, multimodal, and just as fast. gpt-3.5-turbo is still available for use in the API.

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

    • 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.

  • 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