Skip to main content
Glama
llm_models.py1.81 kB
""" Pydantic models for LLM operations """ from pydantic import BaseModel, Field from typing import Optional, Dict, Any from datetime import datetime from enum import Enum class LLMProvider(str, Enum): """Supported LLM providers""" EURI = "euri" DEEPSEEK = "deepseek" GEMINI = "gemini" CLAUDE = "claude" class LLMRequest(BaseModel): """LLM generation request""" prompt: str = Field(..., description="User prompt") system_prompt: Optional[str] = Field(None, description="System prompt") temperature: float = Field(0.7, ge=0.0, le=2.0) max_tokens: int = Field(2000, ge=1, le=4096) force_provider: Optional[str] = None metadata: Dict[str, Any] = Field(default_factory=dict) class LLMResponse(BaseModel): """LLM generation response""" provider: str = Field(..., description="Provider used") content: str = Field(..., description="Generated content") usage: Dict[str, int] = Field(..., description="Token usage") cost: float = Field(..., description="Estimated cost in USD") latency: float = Field(..., description="Generation latency in seconds") model: str = Field(..., description="Model used") timestamp: datetime = Field(default_factory=datetime.now) class ProviderHealth(BaseModel): """Provider health status""" provider: str status: str success_rate: float total_calls: int successful_calls: int failed_calls: int total_cost: float last_success: datetime last_failure: Optional[datetime] circuit_breaker_state: str class LLMUsageMetrics(BaseModel): """Aggregated LLM usage metrics""" total_requests: int total_calls: int successful_calls: int failed_calls: int total_cost: float fallback_count: int per_provider: Dict[str, Dict[str, Any]]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pbulbule13/mcpwithgoogle'

If you have feedback or need assistance with the MCP directory API, please join our Discord server