Self-hosted, Docker-based agentic troubleshooting platform: FastAPI backend + LangGraph agent, Next.js UI, tiered LLM routing (local Ollama -> Gemini -> DeepSeek -> OpenRouter), MCP server manager, encrypted device credentials, RBAC, audit log, project-memory + Obsidian integrations, and editable troubleshooting decision rules tuned for the GeneseasX vessel stack. Co-authored-by: Cursor <cursoragent@cursor.com>
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
"""Snapshots of API provider balances/usage."""
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import DateTime, Float, String, func
|
|
from sqlalchemy.dialects.postgresql import JSONB
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class BalanceSnapshot(Base):
|
|
__tablename__ = "balance_snapshots"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
provider: Mapped[str] = mapped_column(String(64), index=True) # openrouter | deepseek
|
|
total_credits: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
total_usage: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
remaining: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
currency: Mapped[str] = mapped_column(String(8), default="USD")
|
|
raw: Mapped[dict | None] = mapped_column(JSONB, nullable=True)
|
|
error: Mapped[str | None] = mapped_column(String(512), nullable=True)
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), index=True
|
|
)
|