Skip to main content

ferrum_server/
lib.rs

1//! # Ferrum Server
2//!
3//! HTTP API server abstractions for LLM inference services.
4//!
5//! ## Overview
6//!
7//! This module defines the core traits for implementing HTTP API servers
8//! that can serve LLM inference requests with OpenAI API compatibility.
9//!
10//! ## Design Principles
11//!
12//! - **Framework Agnostic**: Abstract interfaces that work with any HTTP framework
13//! - **OpenAI Compatible**: Support for OpenAI Chat Completions API
14//! - **Middleware Support**: Pluggable middleware for auth, logging, rate limiting
15//! - **Streaming Support**: Server-Sent Events for streaming responses
16//! - **Monitoring**: Built-in metrics and health checks
17
18pub mod axum_server;
19pub mod middleware;
20pub mod openai;
21pub mod traits;
22pub mod types;
23
24// Re-exports
25pub use traits::{
26    AuthProvider, HttpServer, MiddlewareStack, RateLimiter as ServerRateLimiter, RequestHandler,
27    ResponseBuilder, StreamingHandler,
28};
29
30pub use types::{
31    ApiVersion, Headers, HealthStatus, HttpMethod, HttpRequest, HttpResponse, RequestContext,
32    ServerConfig, ServerMetrics, StatusCode,
33};
34
35pub use openai::{
36    ChatCompletionsRequest, ChatCompletionsResponse, ChatMessage, CompletionsRequest,
37    CompletionsResponse, ModelListResponse, OpenAiError, OpenAiErrorType, OpenAiResponseFormat,
38};
39
40pub use middleware::{
41    AuthConfig, CompressionConfig, CorsConfig, LoggingConfig, MiddlewareConfig,
42    RateLimitConfig as MiddlewareRateLimitConfig,
43};
44
45pub use axum_server::{init_prometheus_recorder, AxumServer};