1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! `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(()) }
//! ```
pub use ;
pub use OpenAIError;
pub use OpenAIProvider;
pub use *;
/// 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 const DEFAULT_MODEL: &str = GPT5_6;
pub const DEFAULT_BASE_URL: &str = OPENAI_BASE_URL;
pub const DEFAULT_EMBEDDING_MODEL: &str = EMBEDDING_SMALL;
pub const DEFAULT_EMBEDDING_DIM: usize = 1536;
pub const DEFAULT_IMAGE_MODEL: &str = IMAGE_GPT_1_5;
pub const DEFAULT_AUDIO_MODEL: &str = TTS_GPT4O_MINI;
pub const DEFAULT_AUDIO_VOICE: &str = "alloy";
pub const DEFAULT_AUDIO_FORMAT: &str = "mp3";
pub const DEFAULT_TRANSCRIPTION_MODEL: &str = STT_GPT4O;
pub const DEFAULT_MODERATION_MODEL: &str = MODERATION_LATEST;