from __future__ import annotations

from fastapi import APIRouter, Query

from api.services.llm_billing import get_billing_overview

router = APIRouter(prefix="/api/llm-billing", tags=["llm-billing"])


@router.get("/overview")
def llm_billing_overview(
    start_dt: str | None = Query(default=None, pattern=r"^\d{8}$"),
    end_dt: str | None = Query(default=None, pattern=r"^\d{8}$"),
    recent_limit: int = Query(default=50, ge=1, le=200),
) -> dict:
    """Daily LLM cost overview with agent/model breakdowns."""
    return get_billing_overview(
        start_dt=start_dt,
        end_dt=end_dt,
        recent_limit=recent_limit,
    )
