feat: implement AI model API proxy service
This commit is contained in:
7
backend/app/models/__init__.py
Normal file
7
backend/app/models/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
"""Database models."""
|
||||
from .client_key import ClientKey
|
||||
from .provider import Provider
|
||||
from .provider_key import ProviderKey
|
||||
from .request_log import RequestLog
|
||||
|
||||
__all__ = ["ClientKey", "Provider", "ProviderKey", "RequestLog"]
|
||||
13
backend/app/models/client_key.py
Normal file
13
backend/app/models/client_key.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""Client API Key model."""
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class ClientKey:
|
||||
"""Client API key for authentication."""
|
||||
id: int
|
||||
key: str
|
||||
name: Optional[str]
|
||||
is_active: bool
|
||||
created_at: str
|
||||
13
backend/app/models/provider.py
Normal file
13
backend/app/models/provider.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""Provider model."""
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class Provider:
|
||||
"""Model provider configuration."""
|
||||
id: int
|
||||
name: str
|
||||
base_url: str
|
||||
api_type: str
|
||||
is_active: bool
|
||||
13
backend/app/models/provider_key.py
Normal file
13
backend/app/models/provider_key.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""Provider API Key model."""
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class ProviderKey:
|
||||
"""API key for a provider."""
|
||||
id: int
|
||||
provider_id: int
|
||||
key: str
|
||||
is_active: bool
|
||||
created_at: str
|
||||
18
backend/app/models/request_log.py
Normal file
18
backend/app/models/request_log.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""Request log model."""
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class RequestLog:
|
||||
"""Request log entry."""
|
||||
id: Optional[int]
|
||||
client_key_id: int
|
||||
provider_id: int
|
||||
model: str
|
||||
prompt_tokens: Optional[int]
|
||||
completion_tokens: Optional[int]
|
||||
latency_ms: Optional[int]
|
||||
success: bool
|
||||
error_message: Optional[str]
|
||||
created_at: Optional[str]
|
||||
Reference in New Issue
Block a user