Skip to main content

openai_interface/models/
mod.rs

1//! List and describe the various models available in the API.
2//!
3//! Submodules: `list`, `retrieve`, and `delete` for specific model operations.
4
5pub mod delete;
6pub mod list;
7pub mod retrieve;
8
9use serde::Deserialize;
10
11/// Describes an OpenAI model offering that can be used with the API.
12#[derive(Debug, Deserialize, Clone)]
13pub struct Model {
14    /// The model identifier, which can be referenced in the API endpoints.
15    pub id: String,
16    /// The Unix timestamp (in seconds) when the model was created.
17    ///
18    /// OpenAI returns this field, but some OpenAI-compatible providers omit
19    /// it (e.g. DeepSeek, verified against the live `GET /models` endpoint).
20    pub created: Option<u64>,
21    /// The object type, which is always `model`.
22    pub object: ModelObject,
23    /// The organization that owns the model.
24    pub owned_by: String,
25    /// The date when the model will shut down, or null if not announced.
26    ///
27    /// Note: OpenAI-compatible providers may omit this field.
28    pub shutdown_date: Option<String>,
29}
30
31#[derive(Debug, Deserialize, Clone, PartialEq, Eq)]
32#[serde(rename_all = "lowercase")]
33pub enum ModelObject {
34    Model,
35}
36
37crate::impl_from_str!(Model);