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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! Official Rust SDK for the [Skailar](https://skailar.com) API.
//!
//! Skailar is a multi-provider LLM gateway with an OpenAI-compatible surface.
//! This crate is an async-only client built on [`reqwest`] and any reqwest-
//! compatible async runtime ([`tokio`](https://tokio.rs) recommended).
//!
//! # Quickstart
//!
//! ```no_run
//! use skailar::{ChatCompletionRequest, ChatMessage, Skailar};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = Skailar::new()?; // reads SKAILAR_API_KEY
//!
//! let response = client
//! .chat()
//! .completions()
//! .create(
//! ChatCompletionRequest::builder()
//! .model("claude-sonnet-4-6")
//! .message(ChatMessage::user("Hello!"))
//! .build()?,
//! )
//! .await?;
//!
//! println!("{}", response.choices[0].message.content);
//! Ok(())
//! }
//! ```
//!
//! # Streaming
//!
//! ```no_run
//! use futures_util::StreamExt;
//! use skailar::{ChatCompletionRequest, ChatMessage, Skailar};
//!
//! # async fn run(client: Skailar) -> Result<(), Box<dyn std::error::Error>> {
//! let mut stream = client
//! .chat()
//! .completions()
//! .create_stream(
//! ChatCompletionRequest::builder()
//! .model("claude-sonnet-4-6")
//! .message(ChatMessage::user("Count to 5"))
//! .build()?,
//! )
//! .await?;
//!
//! while let Some(chunk) = stream.next().await {
//! let chunk = chunk?;
//! if let Some(piece) = chunk.choices.first().and_then(|c| c.delta.content.as_deref()) {
//! print!("{piece}");
//! }
//! }
//! # Ok(())
//! # }
//! ```
//!
//! # Authentication
//!
//! Pass an API key explicitly via [`Skailar::builder`], or set `SKAILAR_API_KEY`
//! and use [`Skailar::new`]. Keys have the form `skl_live_<43 url-safe base64>`
//! and are sent as `Authorization: Bearer …`.
//!
//! # Errors
//!
//! Every fallible call returns [`Error`]. API-level failures are carried by
//! [`Error::Api`] wrapping an [`ApiError`] with status-predicate helpers; see
//! the [`error`] module.
//!
//! # Feature flags
//!
//! - `tracing` (off by default): emit `tracing` debug spans for requests and
//! retries.
pub use ;
pub use ;
pub use ChatCompletionStream;
pub use ;
pub use ;
pub use ;
pub use ;
pub use PingKeyResponse;
pub use ;
pub use ;