calute.api_server.models#
Request and response models for the OpenAI-compatible API.
This module provides Pydantic models for the API server’s request and response handling. It includes: - Model information and listing responses - Health check response models - OpenAI-compatible data structures
All models follow the OpenAI API specification for compatibility with existing OpenAI client libraries and tools.
Example
>>> from calute.api_server.models import ModelInfo, ModelsResponse
>>> model = ModelInfo(id="my-agent", created=1234567890)
>>> response = ModelsResponse(data=[model])
- class calute.api_server.models.HealthResponse(*, status: str, agents: int)[source]#
Bases:
BaseModelHealth check response model.
Response format for the
/healthendpoint, providing basic health status information about the API server and its registered agents. Used by load balancers and monitoring systems to verify server availability.- status#
Health status string (e.g.,
"healthy","degraded").- Type
str
- agents#
Number of registered agents currently available for serving chat completion requests.
- Type
int
Example
>>> from calute.api_server.models import HealthResponse >>> health = HealthResponse(status="healthy", agents=3) >>> health.status 'healthy'
- agents: int#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- status: str#
- class calute.api_server.models.ModelInfo(*, id: str, object: str = 'model', created: int, owned_by: str = 'calute')[source]#
Bases:
BaseModelInformation about an available model/agent.
Represents metadata for a single model or agent registered with the Calute API server. Follows the OpenAI model object specification for compatibility with the
/v1/modelsendpoint.- id#
Unique identifier for the model/agent. This is the value clients use in the
modelfield of chat completion requests.- Type
str
- object#
Object type, always
"model"for OpenAI compatibility.- Type
str
- created#
Unix timestamp (seconds since epoch) indicating when the model entry was created.
- Type
int
- owned_by#
Owner identifier for the model. Defaults to
"calute".- Type
str
Example
>>> from calute.api_server.models import ModelInfo >>> info = ModelInfo(id="my-agent", created=1700000000) >>> info.object 'model' >>> info.owned_by 'calute'
- created: int#
- id: str#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- object: str#
- owned_by: str#
- class calute.api_server.models.ModelsResponse(*, object: str = 'list', data: list[calute.api_server.models.ModelInfo])[source]#
Bases:
BaseModelResponse containing a list of available models/agents.
Standard response format for the
/v1/modelsendpoint, providing a list of all registered agents. Follows the OpenAI list response specification.- object#
Object type, always
"list"for OpenAI compatibility.- Type
str
- data#
List of
ModelInfoobjects representing all available agents and models registered with the server.- Type
Example
>>> from calute.api_server.models import ModelInfo, ModelsResponse >>> model = ModelInfo(id="assistant", created=1700000000) >>> response = ModelsResponse(data=[model]) >>> response.object 'list' >>> len(response.data) 1
- data: list[calute.api_server.models.ModelInfo]#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- object: str#