44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class CreditRecordOut(BaseModel):
|
|
id: str
|
|
type: str
|
|
type_label: str = ""
|
|
amount: float
|
|
personal_amount: float = 0
|
|
team_amount: float = 0
|
|
balance_delta: float = 0
|
|
expired_amount: float = 0
|
|
balance_after: float
|
|
description: str
|
|
billing_scene: str | None = None
|
|
billing_scene_label: str | None = None
|
|
scene_name_snapshot: str | None = None
|
|
input_tokens: int | None = None
|
|
output_tokens: int | None = None
|
|
total_tokens: int | None = None
|
|
llm_call_count: int | None = None
|
|
llm_success_call_count: int | None = None
|
|
llm_failed_call_count: int | None = None
|
|
created_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class CreditBalanceOut(BaseModel):
|
|
credits: float
|
|
available_credits: float
|
|
personal_credits: float = 0
|
|
team_available_credits: float = 0
|
|
team_frozen_credits: float = 0
|
|
next_expiring_credits: float = 0
|
|
next_expires_at: datetime | None = None
|
|
next_last_usable_at: datetime | None = None
|
|
records: list[CreditRecordOut] = Field(default_factory=list)
|
|
total: int = 0
|