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
//! # llmposter
//!
//! A fixture-driven mock server for LLM APIs. Speaks OpenAI Chat Completions,
//! Anthropic Messages, Gemini generateContent, and OpenAI Responses API — both
//! streaming (SSE) and non-streaming.
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use llmposter::{ServerBuilder, Fixture};
//!
//! #[tokio::test]
//! async fn test_llm_client() {
//! let server = ServerBuilder::new()
//! .fixture(
//! Fixture::new()
//! .match_user_message("hello")
//! .respond_with_content("Hi from the mock!"),
//! )
//! .build()
//! .await
//! .unwrap();
//!
//! // Point your LLM client at server.url() instead of the real API
//! let base_url = server.url();
//! // ... your client code here ...
//! }
//! ```
//!
//! ## Features
//!
//! - **4 LLM API formats**: OpenAI, Anthropic, Gemini, OpenAI Responses
//! - **Streaming & non-streaming**: SSE and JSON-array responses
//! - **Fixture-driven**: YAML files or programmatic builder API
//! - **Failure simulation**: latency, truncation, disconnect, corruption, error codes
//! - **Stateful scenarios**: multi-turn matching via named state machines
//! - **Request capture**: verify what your client sent with `server.get_requests()`
//! - **Auth simulation**: bearer tokens, OAuth2 mock server (optional `oauth` feature)
//! - **Deterministic**: fixed IDs, sequential counters, no randomness
//!
//! ## Modules
//!
//! - [`fixture`] — fixture types, matching, YAML loading
//! - [`server`] — [`ServerBuilder`], [`MockServer`], [`CapturedRequest`]
//! - [`auth`] — bearer token and OAuth2 middleware
//! - [`cli`] — CLI binary entry point
/// Bearer token authentication and OAuth2 middleware.
pub
/// CLI binary entry point and argument parsing.
pub
/// Fixture types, matching logic, and YAML loading.
pub
pub
/// Server builder, mock server, and request capture.
pub
pub
pub
// Re-exports for convenience — these are the primary API surface.
pub use ;
pub use ;
pub use Provider;
pub use OAuthConfig;
pub use ;