shift_proxy/routes/
mod.rs1pub mod anthropic;
4pub mod google;
5pub mod health;
6pub mod openai;
7pub mod passthrough;
8
9use crate::ProxyState;
10use axum::extract::DefaultBodyLimit;
11use axum::routing::{any, get, post};
12use axum::Router;
13
14const MAX_BODY_SIZE: usize = 200 * 1024 * 1024;
19
20pub fn build_router(state: ProxyState) -> Router {
22 Router::new()
23 .route("/health", get(health::health_handler))
25 .route("/stats", get(health::stats_handler))
26 .route("/v1/messages", post(anthropic::anthropic_handler))
28 .route("/v1/chat/completions", post(openai::openai_handler))
29 .route("/v1beta/models/{*path}", post(google::google_handler))
31 .route("/v1/models/{*path}", post(google::google_handler))
32 .fallback(any(passthrough::passthrough_handler))
35 .layer(DefaultBodyLimit::max(MAX_BODY_SIZE))
37 .with_state(state)
38}