pub enum OpenAiApiFormat {
Auto,
Completions,
Responses,
}Expand description
Which OpenAI-family API format to use when talking to the LLM.
Auto(default): Auto-detects from the model name. Codex models use Responses API, everything else uses Chat Completions.Completions: Forces the Chat Completions API (/v1/chat/completions)Responses: Forces the Responses API (/v1/responses)
Most OpenAI models (GPT-4o, GPT-4.1, GPT-5, o1, etc.) support both APIs.
Codex models (codex-*, *-codex) are Responses API only.
OpenAI recommends the Responses API for new projects (better caching, reasoning).
Can be set at the model_settings level in agent definitions:
[model_settings]
model = "codex-mini-latest"
api_format = "responses" # or "completions" or "auto"Variants§
Auto
Auto-detect based on model name (codex models → Responses, everything else → Completions)
Completions
Chat Completions API (/v1/chat/completions)
Responses
Responses API (/v1/responses) — required for Codex models, recommended for new projects
Implementations§
Source§impl OpenAiApiFormat
impl OpenAiApiFormat
Sourcepub fn resolve(&self, model: &str) -> ResolvedOpenAiApiFormat
pub fn resolve(&self, model: &str) -> ResolvedOpenAiApiFormat
Resolve the effective format given a model name.
When Auto, inspects the model name to decide.
Trait Implementations§
Source§impl Clone for OpenAiApiFormat
impl Clone for OpenAiApiFormat
Source§fn clone(&self) -> OpenAiApiFormat
fn clone(&self) -> OpenAiApiFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenAiApiFormat
impl Debug for OpenAiApiFormat
Source§impl Default for OpenAiApiFormat
impl Default for OpenAiApiFormat
Source§fn default() -> OpenAiApiFormat
fn default() -> OpenAiApiFormat
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for OpenAiApiFormat
impl<'de> Deserialize<'de> for OpenAiApiFormat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 JsonSchema for OpenAiApiFormat
impl JsonSchema for OpenAiApiFormat
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for OpenAiApiFormat
impl PartialEq for OpenAiApiFormat
Source§impl Serialize for OpenAiApiFormat
impl Serialize for OpenAiApiFormat
impl StructuralPartialEq for OpenAiApiFormat
Auto Trait Implementations§
impl Freeze for OpenAiApiFormat
impl RefUnwindSafe for OpenAiApiFormat
impl Send for OpenAiApiFormat
impl Sync for OpenAiApiFormat
impl Unpin for OpenAiApiFormat
impl UnsafeUnpin for OpenAiApiFormat
impl UnwindSafe for OpenAiApiFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more