Skip to main content

ChatModel

Enum ChatModel 

Source
#[non_exhaustive]
pub enum ChatModel {
Show 47 variants Gpt5_6, Gpt5_6Sol, Gpt5_6Terra, Gpt5_6Luna, Gpt5_5, Gpt5_5Pro, Gpt5_4, Gpt5_4Pro, Gpt5_4Mini, Gpt5_4Nano, Gpt5_3ChatLatest, Gpt5_3Codex, Gpt5_2Codex, Gpt5_1Codex, Gpt5SearchApi, Gpt4oSearchPreview, Gpt4oMiniSearchPreview, GptAudio, GptAudio1_5, GptAudioMini, Gpt5, Gpt5Pro, Gpt5_2, Gpt5_2ChatLatest, Gpt5_2Pro, Gpt5_1, Gpt5_1ChatLatest, Gpt5_1CodexMax, Gpt5Mini, Gpt5Nano, Gpt4_1, Gpt4_1Mini, Gpt4_1Nano, Gpt4o, Gpt4oMini, Gpt4oAudioPreview, Gpt4Turbo, Gpt4, Gpt3_5Turbo, Gpt3_5Turbo16k, O1, O1Pro, O3, O3Pro, O3Mini, O4Mini, Custom(String),
}
Expand description

Models available for Chat Completions and Responses APIs.

This enum covers all models that can be used with the Chat Completions API (/v1/chat/completions) and the Responses API (/v1/responses).

§Model Categories

§GPT-5 Series (Latest Flagship)

  • [Gpt5_2]: GPT-5.2 Thinking - flagship model for coding and agentic tasks
  • [Gpt5_2ChatLatest]: GPT-5.2 Instant - fast workhorse for everyday work
  • [Gpt5_2Pro]: GPT-5.2 Pro - smartest for difficult questions (Responses API only)
  • [Gpt5_1]: GPT-5.1 - configurable reasoning and non-reasoning
  • [Gpt5_1CodexMax]: GPT-5.1 Codex Max - powers Codex CLI
  • [Gpt5Mini]: GPT-5 Mini - smaller, faster variant

§GPT-4.1 Series

  • [Gpt4_1]: 1M context window flagship
  • [Gpt4_1Mini]: Balanced performance and cost
  • [Gpt4_1Nano]: Fastest and most cost-efficient

§GPT-4o Series

  • [Gpt4o]: High-intelligence flagship model
  • [Gpt4oMini]: Cost-effective GPT-4o variant
  • [Gpt4oAudioPreview]: Audio-capable GPT-4o

§Reasoning Models (o-series)

  • [O1], [O1Pro]: Full reasoning models
  • [O3], [O3Mini]: Latest reasoning models
  • [O4Mini]: Fast, cost-efficient reasoning

§Reasoning Model Restrictions

Reasoning models (GPT-5 series, o1, o3, o4 series) have parameter restrictions:

  • temperature: Only 1.0 supported
  • top_p: Only 1.0 supported
  • frequency_penalty: Only 0 supported
  • presence_penalty: Only 0 supported

GPT-5 models support reasoning.effort parameter:

  • none: No reasoning (GPT-5.1 default)
  • minimal: Very few reasoning tokens
  • low, medium, high: Increasing reasoning depth
  • xhigh: Maximum reasoning (GPT-5.2 Pro, GPT-5.1 Codex Max)

§Example

use openai_tools::common::models::ChatModel;

// Check if a model is a reasoning model
let model = ChatModel::O3Mini;
assert!(model.is_reasoning_model());

// GPT-5 models are also reasoning models
let gpt5 = ChatModel::Gpt5_2;
assert!(gpt5.is_reasoning_model());

// Get the API model ID string
assert_eq!(model.as_str(), "o3-mini");

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Gpt5_6

GPT-5.6 - Alias routing to GPT-5.6 Sol

§

Gpt5_6Sol

GPT-5.6 Sol - Frontier model for complex professional work

  • Context: 1.05M tokens, 128K max output
  • Knowledge cutoff: 2026-02-16
  • Supports: reasoning.effort
§

Gpt5_6Terra

GPT-5.6 Terra - Balanced model for everyday work

  • Context: 1.05M tokens, 128K max output
  • Supports: reasoning.effort
§

Gpt5_6Luna

GPT-5.6 Luna - Most cost-efficient GPT-5.6 variant

  • Context: 1.05M tokens, 128K max output
  • Supports: reasoning.effort
§

Gpt5_5

GPT-5.5 - Frontier model with 1M context

  • Context: 1.05M tokens, 128K max output
  • Supports: reasoning.effort (none, low, medium (default), high, xhigh)
§

Gpt5_5Pro

GPT-5.5 Pro - Uses more compute for consistently better answers

  • Available in Responses API only (no Chat Completions)
  • Supports: reasoning.effort (medium, high (default), xhigh)
§

Gpt5_4

GPT-5.4 - Frontier model for complex professional work

  • Context: 1.05M tokens
  • Supports: reasoning.effort (none (default), low, medium, high, xhigh)
§

Gpt5_4Pro

GPT-5.4 Pro - Uses more compute for consistently better answers

  • Available in Responses API only (no Chat Completions)
  • Supports: reasoning.effort (medium (default), high, xhigh)
§

Gpt5_4Mini

GPT-5.4 Mini - Strong mini model for coding, computer use and subagents

  • Context: 400K tokens
  • Supports: reasoning.effort
§

Gpt5_4Nano

GPT-5.4 Nano - Cheapest GPT-5.4-class model for high-volume tasks

  • Context: 400K tokens
  • Supports: reasoning.effort (none (default), low, medium, high, xhigh)
§

Gpt5_3ChatLatest

GPT-5.3 Instant - Non-reasoning chat model

Points to the GPT-5.3 Instant snapshot used in ChatGPT.

Deprecated by OpenAI - GPT-5.6 is recommended for most API usage.

§

Gpt5_3Codex

GPT-5.3 Codex - Most capable agentic coding model

  • Available in Responses API only (no Chat Completions)
  • Context: 400K tokens, 128K max output
  • Supports: reasoning.effort (low, medium, high, xhigh)
§

Gpt5_2Codex

GPT-5.2 Codex - GPT-5.2 optimized for agentic coding tasks

  • Available in Responses API only (no Chat Completions)
  • Context: 400K tokens
  • Supports: reasoning.effort (low, medium, high, xhigh)
§

Gpt5_1Codex

GPT-5.1 Codex - GPT-5 optimized for agentic coding tasks

  • Available in Responses API only (no Chat Completions)
§

Gpt5SearchApi

GPT-5 Search API - GPT-5 with built-in web search

Rejects sampling parameters and exposes no reasoning parameter.

§

Gpt4oSearchPreview

GPT-4o Search Preview - GPT-4o with built-in web search

§

Gpt4oMiniSearchPreview

GPT-4o Mini Search Preview - GPT-4o Mini with built-in web search

§

GptAudio

GPT Audio - audio-capable chat model

Requires an audio input content part or an audio output modality.

§

GptAudio1_5

GPT Audio 1.5 - newer audio-capable chat model

§

GptAudioMini

GPT Audio Mini - cost-efficient audio-capable chat model

§

Gpt5

GPT-5 - Original GPT-5 flagship reasoning model

§

Gpt5Pro

GPT-5 Pro - GPT-5 with more compute for difficult questions

  • Available in Responses API only (no Chat Completions)
§

Gpt5_2

GPT-5.2 Thinking - Flagship model for coding and agentic tasks

  • Context: 128K tokens (256K with thinking)
  • Supports: reasoning.effort (none, minimal, low, medium, high, xhigh)
  • Supports: verbosity parameter (low, medium, high)
§

Gpt5_2ChatLatest

GPT-5.2 Instant - Fast workhorse for everyday work

Points to the GPT-5.2 Instant snapshot used in ChatGPT. This is a non-reasoning model, so it accepts the full standard parameter set.

Deprecated by OpenAI - GPT-5.6 is recommended for most API usage.

§

Gpt5_2Pro

GPT-5.2 Pro - Smartest for difficult questions

  • Available in Responses API only
  • Supports: xhigh reasoning effort
§

Gpt5_1

GPT-5.1 - Configurable reasoning and non-reasoning

  • Defaults to no reasoning (effort: none)
  • Supports: reasoning.effort (none, low, medium, high)
§

Gpt5_1ChatLatest

GPT-5.1 Instant - Chat-optimized GPT-5.1

Points to the GPT-5.1 Instant snapshot used in ChatGPT. This is a non-reasoning model, so it accepts the full standard parameter set.

§

Gpt5_1CodexMax

GPT-5.1 Codex Max - Powers Codex and Codex CLI

  • Available in Responses API only
  • Supports: reasoning.effort (none, medium, high, xhigh)
§

Gpt5Mini

GPT-5 Mini - Smaller, faster GPT-5 variant

§

Gpt5Nano

GPT-5 Nano - Fastest, most cost-efficient GPT-5 variant

§

Gpt4_1

GPT-4.1 - Smartest non-reasoning model with 1M token context

§

Gpt4_1Mini

GPT-4.1 Mini - Balanced performance and cost

§

Gpt4_1Nano

GPT-4.1 Nano - Fastest and most cost-efficient

§

Gpt4o

GPT-4o - High-intelligence flagship model (multimodal)

§

Gpt4oMini

GPT-4o Mini - Cost-effective GPT-4o variant

§

Gpt4oAudioPreview

GPT-4o Audio Preview - Audio-capable GPT-4o

§

Gpt4Turbo

GPT-4 Turbo - High capability with faster responses

§

Gpt4

GPT-4 - Original GPT-4 model

§

Gpt3_5Turbo

GPT-3.5 Turbo - Fast and cost-effective

§

Gpt3_5Turbo16k

GPT-3.5 Turbo 16K - legacy extended-context GPT-3.5 Turbo

§

O1

O1 - Full reasoning model for complex tasks

§

O1Pro

O1 Pro - O1 with more compute for complex problems

§

O3

O3 - Latest full reasoning model

§

O3Pro

O3 Pro - O3 with more compute

  • Available in Responses API only (no Chat Completions)
§

O3Mini

O3 Mini - Smaller, faster reasoning model

§

O4Mini

O4 Mini - Fast, cost-efficient reasoning model

§

Custom(String)

Custom model ID for fine-tuned models or new models not yet in enum

Implementations§

Source§

impl ChatModel

Source

pub fn as_str(&self) -> &str

Returns the model identifier string for API requests.

§Example
use openai_tools::common::models::ChatModel;

assert_eq!(ChatModel::Gpt4oMini.as_str(), "gpt-4o-mini");
assert_eq!(ChatModel::O3Mini.as_str(), "o3-mini");
assert_eq!(ChatModel::Gpt5_2.as_str(), "gpt-5.2");
Source

pub fn is_reasoning_model(&self) -> bool

Checks if this is a reasoning model with parameter restrictions.

Reasoning models (GPT-5 series, o1, o3, o4 series) only support:

  • temperature = 1.0
  • top_p = 1.0
  • frequency_penalty = 0
  • presence_penalty = 0
§Example
use openai_tools::common::models::ChatModel;

assert!(ChatModel::O3Mini.is_reasoning_model());
assert!(ChatModel::Gpt5_2.is_reasoning_model());
assert!(!ChatModel::Gpt4oMini.is_reasoning_model());
assert!(!ChatModel::Gpt4_1.is_reasoning_model());
Source

pub fn is_search_model(&self) -> bool

Checks if this is a web-search model.

Search models (gpt-5-search-api, gpt-4o-search-preview, gpt-4o-mini-search-preview) reject the whole sampling parameter set - temperature, top_p, n, logprobs and the penalties - but unlike reasoning models they expose no reasoning parameter.

§Example
use openai_tools::common::models::ChatModel;

assert!(ChatModel::Gpt4oSearchPreview.is_search_model());
assert!(!ChatModel::Gpt4oSearchPreview.is_reasoning_model());
assert!(!ChatModel::Gpt4oMini.is_search_model());
Source

pub fn parameter_support(&self) -> ParameterSupport

Returns parameter support information for this model.

This method provides detailed information about which parameters are supported by the model and any restrictions that apply.

§Example
use openai_tools::common::models::{ChatModel, ParameterRestriction};

// Standard model supports all parameters
let standard = ChatModel::Gpt4oMini;
let support = standard.parameter_support();
assert_eq!(support.temperature, ParameterRestriction::Any);
assert!(support.logprobs);

// Reasoning model has restrictions
let reasoning = ChatModel::O3Mini;
let support = reasoning.parameter_support();
assert_eq!(support.temperature, ParameterRestriction::FixedValue(1.0));
assert!(!support.logprobs);
assert!(support.reasoning);
Source

pub fn custom(model_id: impl Into<String>) -> Self

Creates a custom model from a string.

Use this for fine-tuned models or new models not yet in the enum.

§Example
use openai_tools::common::models::ChatModel;

let model = ChatModel::custom("ft:gpt-4o-mini:my-org::abc123");
assert_eq!(model.as_str(), "ft:gpt-4o-mini:my-org::abc123");

Trait Implementations§

Source§

impl Clone for ChatModel

Source§

fn clone(&self) -> ChatModel

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChatModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChatModel

Source§

fn default() -> ChatModel

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ChatModel

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ChatModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ChatModel

Source§

impl From<&str> for ChatModel

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl From<String> for ChatModel

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl Hash for ChatModel

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ChatModel

Source§

fn eq(&self, other: &ChatModel) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ChatModel

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ChatModel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more