Skip to main content

systemprompt_api/services/gateway/
mod.rs

1//! The AI gateway: a protocol-translating proxy in front of upstream LLM
2//! providers.
3//!
4//! Inbound requests in one wire protocol (Anthropic Messages, `OpenAI`
5//! Responses) are parsed into a canonical form, dispatched to an upstream
6//! provider via the [`protocol`] adapters, and rendered back in the caller's
7//! protocol. [`GatewayService`] orchestrates the flow; supporting modules cover
8//! [`policy`] resolution, [`quota`] enforcement, safety scanning, usage
9//! [`captures`], [`pricing`], the upstream and safety-scanner [`registry`], and
10//! the [`audit`] trail.
11//!
12//! The safety-scanner contract —
13//! [`SafetyScanner`](systemprompt_ai::SafetyScanner),
14//! [`Finding`](systemprompt_ai::Finding), the built-in scanners, and
15//! [`register_safety_scanner!`](systemprompt_ai::register_safety_scanner) —
16//! lives in `systemprompt-ai`; [`registry::SafetyScannerRegistry`] resolves the
17//! scanner names a policy selects against the built-ins plus any extension
18//! registrations.
19
20pub mod audit;
21pub mod captures;
22pub mod parse;
23pub mod policy;
24pub mod pricing;
25pub mod protocol;
26pub mod quota;
27pub mod registry;
28pub mod service;
29pub mod stream_tap;
30
31pub use audit::{GatewayAudit, GatewayRequestContext};
32pub use captures::{CapturedToolUse, CapturedUsage};
33pub use protocol::{
34    CanonicalEvent, CanonicalRequest, CanonicalResponse, InboundAdapter, OutboundAdapter,
35    OutboundAdapterRegistration, OutboundCtx, OutboundOutcome,
36};
37pub use registry::{GatewayUpstreamRegistry, SafetyScannerRegistry};
38pub use service::{DispatchInputs, GatewayService, REQUEST_ID_HEADER};