openai-interface 0.7.0

A low-level Rust interface for the OpenAI API
Documentation
//! List and describe the various models available in the API.
//!
//! Submodules: `list`, `retrieve`, and `delete` for specific model operations.

pub mod delete;
pub mod list;
pub mod retrieve;

use serde::Deserialize;

/// Describes an OpenAI model offering that can be used with the API.
#[derive(Debug, Deserialize, Clone)]
pub struct Model {
    /// The model identifier, which can be referenced in the API endpoints.
    pub id: String,
    /// The Unix timestamp (in seconds) when the model was created.
    ///
    /// OpenAI returns this field, but some OpenAI-compatible providers omit
    /// it (e.g. DeepSeek, verified against the live `GET /models` endpoint).
    pub created: Option<u64>,
    /// The object type, which is always `model`.
    pub object: ModelObject,
    /// The organization that owns the model.
    pub owned_by: String,
    /// The date when the model will shut down, or null if not announced.
    ///
    /// Note: OpenAI-compatible providers may omit this field.
    pub shutdown_date: Option<String>,
}

#[derive(Debug, Deserialize, Clone, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum ModelObject {
    Model,
}

crate::impl_from_str!(Model);