pub mod anthropic;
pub mod google;
pub mod health;
pub mod openai;
pub mod passthrough;
use crate::ProxyState;
use axum::extract::DefaultBodyLimit;
use axum::routing::{any, get, post};
use axum::Router;
const MAX_BODY_SIZE: usize = 200 * 1024 * 1024;
pub fn build_router(state: ProxyState) -> Router {
Router::new()
.route("/health", get(health::health_handler))
.route("/stats", get(health::stats_handler))
.route("/v1/messages", post(anthropic::anthropic_handler))
.route("/v1/chat/completions", post(openai::openai_handler))
.route("/v1beta/models/{*path}", post(google::google_handler))
.route("/v1/models/{*path}", post(google::google_handler))
.fallback(any(passthrough::passthrough_handler))
.layer(DefaultBodyLimit::max(MAX_BODY_SIZE))
.with_state(state)
}