Skip to main content

ChatModel

Enum ChatModel 

Source
pub enum ChatModel {
Show 22 variants Gpt5_2, Gpt5_2ChatLatest, Gpt5_2Pro, Gpt5_1, Gpt5_1ChatLatest, Gpt5_1CodexMax, Gpt5Mini, Gpt4_1, Gpt4_1Mini, Gpt4_1Nano, Gpt4o, Gpt4oMini, Gpt4oAudioPreview, Gpt4Turbo, Gpt4, Gpt3_5Turbo, O1, O1Pro, O3, 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§

§

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 snapshot used in ChatGPT

§

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 Chat Latest - Chat-optimized GPT-5.1

§

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

§

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

§

O1

O1 - Full reasoning model for complex tasks

§

O1Pro

O1 Pro - O1 with more compute for complex problems

§

O3

O3 - Latest full reasoning model

§

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 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 · 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 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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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 Eq for ChatModel

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<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<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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

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
Source§

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