aither-openai 0.6.0

OpenAI provider integration for aither
Documentation
//! `OpenAI` integration for the Aither framework built on top of the `zenwave`
//! HTTP client and the shared `aither-core` abstractions.
//!
//! By default this client uses the Responses API. The legacy `chat.completions`
//! endpoint is still available via [`OpenAI::builder`], but `OpenAI` has deprecated it.
//! If you must keep using `max_tokens`, enable the legacy compatibility flag on the builder.
//!
//! ```no_run
//! use aither_core::{LanguageModel, llm::{LLMRequest, Message, collect_text, model::Parameters}};
//! use aither_openai::OpenAI;
//!
//! # async fn demo() -> Result<(), Box<dyn std::error::Error>> {
//! let model = OpenAI::new(std::env::var("OPENAI_API_KEY")?)
//!     .with_model("gpt-4o-mini");
//!
//! let request = LLMRequest::new([
//!     Message::system("You are a concise assistant."),
//!     Message::user("Explain the Rust ownership model in one paragraph."),
//! ])
//! .with_parameters(Parameters::default());
//! let stream = model.respond(request);
//! let collected = collect_text(stream).await?;
//! println!("{collected}");
//! # Ok(()) }
//! ```

mod attachments;
mod audio;
mod client;
mod embedding;
mod error;
pub mod files;
mod image;
#[cfg(not(target_arch = "wasm32"))]
mod mime;
mod moderation;
mod provider;
mod request;
mod response;

pub use client::{ApiKind, Builder, OpenAI};
pub use error::OpenAIError;
pub use provider::OpenAIProvider;

mod constant;
pub use constant::*;

/// Provider tag stamped on reasoning state produced by this crate.
///
/// Reasoning state is only ever replayed to the provider that signed it, so
/// this string must stay stable across releases; changing it silently
/// invalidates state stored in existing transcripts.
pub const PROVIDER_NAME: &str = "openai";

pub(crate) const DEFAULT_MODEL: &str = GPT5_6;
pub(crate) const DEFAULT_BASE_URL: &str = OPENAI_BASE_URL;
pub(crate) const DEFAULT_EMBEDDING_MODEL: &str = EMBEDDING_SMALL;
pub(crate) const DEFAULT_EMBEDDING_DIM: usize = 1536;
pub(crate) const DEFAULT_IMAGE_MODEL: &str = IMAGE_GPT_1_5;
pub(crate) const DEFAULT_AUDIO_MODEL: &str = TTS_GPT4O_MINI;
pub(crate) const DEFAULT_AUDIO_VOICE: &str = "alloy";
pub(crate) const DEFAULT_AUDIO_FORMAT: &str = "mp3";
pub(crate) const DEFAULT_TRANSCRIPTION_MODEL: &str = STT_GPT4O;
pub(crate) const DEFAULT_MODERATION_MODEL: &str = MODERATION_LATEST;