Django ORM

All models for the LLMHost app.

class smarter.apps.llmhost.models.LLMHost(*args, **kwargs)[source]

Bases: MetaDataWithOwnershipModel

A large language model that Smarter hosts on Kubernetes.

Distinct from an LLM Provider, which is a third-party API: the account owns the LLMHost’s deployment lifecycle, i.e. launch, observe and destroy, through smarter.apps.llmhost.services.LLMHostService.

Parameters:
  • id (Unknown) – Primary key: ID

  • created_at (Unknown) – Created at

  • updated_at (Unknown) – Updated at

  • name (Unknown) – Name. Name in camelCase, e.g., ‘apiKey’, no special characters.

  • description (Unknown) – Description. A brief description of this resource. Be verbose, but not too verbose.

  • version (Unknown) – Version. Semantic version in the format MAJOR.MINOR.PATCH, e.g., ‘1.0.0’.

  • annotations (Unknown) – Annotations. Key-value pairs for annotating this resource.

  • spec (Unknown) – Spec. The manifest’s spec, in camelCase. The source of truth for launching the LLMHost.

  • model_source (Unknown) – Model source

  • model_repository (Unknown) – Model repository. e.g. ‘meta-llama/Llama-3.1-8B-Instruct’, ‘llama3.1:8b’ or ‘s3://bucket/prefix’

  • model_revision (Unknown) – Model revision. Commit SHA, branch or tag pinned for reproducible deploys.

  • model_task (Unknown) – Model task

  • served_model_name (Unknown) – Served model name. The model name that clients send in their requests.

  • license (Unknown) – License

  • model_architecture (Unknown) – Model architecture. e.g. ‘llama’, ‘mistral’, ‘qwen3’

  • parameter_count (Unknown) – Parameter count

  • context_window (Unknown) – Context window

  • quantization (Unknown) – Quantization

  • embedding_dimensions (Unknown) – Embedding dimensions. Set only for embedding models.

  • supports_streaming (Unknown) – Supports streaming

  • supports_function_calling (Unknown) – Supports function calling

  • supports_vision (Unknown) – Supports vision

  • supports_reasoning (Unknown) – Supports reasoning

  • inference_engine (Unknown) – Inference engine

  • api_format (Unknown) – Api format

  • gpu_type (Unknown) – Gpu type. e.g. ‘A10G’

  • gpu_count (Unknown) – Gpu count. GPUs per replica.

  • vram_required_gb (Unknown) – Vram required gb

  • replicas (Unknown) – Replicas

  • cost_per_hour (Unknown) – Cost per hour. The cost per hour of one replica: its share of its compute’s node.

  • status (Unknown) – Status

  • status_message (Unknown) – Status message

  • is_active (Unknown) – Is active

  • ready_replicas (Unknown) – Ready replicas

  • endpoint_url (Unknown) – Endpoint url. The base URL inside the cluster.

  • public_url (Unknown) – Public url. The base URL of the Ingress, if any.

  • health_check_url (Unknown) – Health check url

  • last_health_check_at (Unknown) – Last health check at

  • last_health_ok (Unknown) – Last health ok

  • deployed_at (Unknown) – Deployed at. When the LLMHost was last launched.

Relationship fields:

Parameters:
  • user_profile (Unknown) – User profile (related name: llmhost)

  • api_key_secret (Unknown) – Api key secret. The Smarter Secret with the API key that clients send as a Bearer token. (related name: llmhosts)

  • compute (Unknown) – Compute. The kind of node, and node group, that the LLMHost runs on: spec.compute. (related name: llmhosts)

  • tags (Unknown) – Tags. Tags for categorizing and organizing this resource. (related name: llmhost)

  • tagged_items (Unknown) – Tagged items (related name: +)

Reverse relationships:

Parameters:

events (Unknown) – All events of this llm host (related name of llmhost)

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

annotations

JSONField

Annotations. Key-value pairs for annotating this resource.

Type:

Type

api_format

CharField

Api format

Choices:

  • openai_compatible

  • huggingface

  • ollama_native

  • custom

Type:

Type

api_key_secret

ForeignKey to Secret

Api key secret. The Smarter Secret with the API key that clients send as a Bearer token. (related name: llmhosts)

Type:

Type

api_key_secret_id

Internal field, use api_key_secret instead.

compute

ForeignKey to LLMHostCompute

Compute. The kind of node, and node group, that the LLMHost runs on: spec.compute. (related name: llmhosts)

Type:

Type

compute_id

Internal field, use compute instead.

context_window

PositiveIntegerField

Context window

Type:

Type

cost_per_hour

DecimalField

Cost per hour. The cost per hour of one replica: its share of its compute’s node.

Type:

Type

created_at

DateTimeField

Created at

Timestamp indicating when the model instance was created.

This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.

Type:

Type

deployed_at

DateTimeField

Deployed at. When the LLMHost was last launched.

Type:

Type

description

TextField

Description. A brief description of this resource. Be verbose, but not too verbose.

Type:

Type

embedding_dimensions

PositiveIntegerField

Embedding dimensions. Set only for embedding models.

Type:

Type

endpoint_url

URLField

Endpoint url. The base URL inside the cluster.

Type:

Type

property estimated_cost: Decimal | None

uptime times replicas times cost_per_hour.

Type:

The cost since the LLMHost was launched

events

Reverse ForeignKey from LLMHostEvent

All events of this llm host (related name of llmhost)

Type:

Type

get_api_format_display(*, field=<django.db.models.CharField: api_format>)

Shows the label of the api_format. See get_FOO_display() for more information.

get_inference_engine_display(*, field=<django.db.models.CharField: inference_engine>)

Shows the label of the inference_engine. See get_FOO_display() for more information.

get_model_source_display(*, field=<django.db.models.CharField: model_source>)

Shows the label of the model_source. See get_FOO_display() for more information.

get_model_task_display(*, field=<django.db.models.CharField: model_task>)

Shows the label of the model_task. See get_FOO_display() for more information.

get_quantization_display(*, field=<django.db.models.CharField: quantization>)

Shows the label of the quantization. See get_FOO_display() for more information.

get_status_display(*, field=<django.db.models.CharField: status>)

Shows the label of the status. See get_FOO_display() for more information.

gpu_count

PositiveSmallIntegerField

Gpu count. GPUs per replica.

Type:

Type

gpu_type

CharField

Gpu type. e.g. ‘A10G’

Type:

Type

health_check_url

URLField

Health check url

Type:

Type

id

BigAutoField

Primary key: ID

Type:

Type

inference_engine

CharField

Inference engine

Choices:

  • vllm

  • tgi

  • sglang

  • llama_cpp

  • ollama

  • tei

  • custom

Type:

Type

is_active

BooleanField

Is active

Type:

Type

property is_deployed: bool

Whether the LLMHost’s Kubernetes resources exist, as of the last status check.

last_health_check_at

DateTimeField

Last health check at

Type:

Type

last_health_ok

BooleanField

Last health ok

Type:

Type

license

CharField

License

Type:

Type

model_architecture

CharField

Model architecture. e.g. ‘llama’, ‘mistral’, ‘qwen3’

Type:

Type

model_repository

CharField

Model repository. e.g. ‘meta-llama/Llama-3.1-8B-Instruct’, ‘llama3.1:8b’ or ‘s3://bucket/prefix’

Type:

Type

model_revision

CharField

Model revision. Commit SHA, branch or tag pinned for reproducible deploys.

Type:

Type

model_source

CharField

Model source

Choices:

  • huggingface

  • ollama

  • s3

  • url

  • pvc

Type:

Type

model_task

CharField

Model task

Choices:

  • text-generation

  • embedding

Type:

Type

name

CharField

Name. Name in camelCase, e.g., ‘apiKey’, no special characters.

Type:

Type

parameter_count

BigIntegerField

Parameter count

Type:

Type

public_url

URLField

Public url. The base URL of the Ingress, if any.

Type:

Type

quantization

CharField

Quantization

Choices:

  • none

  • fp32

  • fp16

  • bf16

  • fp8

  • mxfp4

  • int8

  • int4

  • gguf

  • awq

  • gptq

Type:

Type

ready_replicas

PositiveSmallIntegerField

Ready replicas

Type:

Type

record_event(event_type, message='', details=None)[source]

Record a lifecycle event, with the LLMHost’s current status.

Return type:

LLMHostEvent

replicas

PositiveSmallIntegerField

Replicas

Type:

Type

served_model_name

CharField

Served model name. The model name that clients send in their requests.

Type:

Type

spec

JSONField

Spec. The manifest’s spec, in camelCase. The source of truth for launching the LLMHost.

Type:

Type

status

CharField

Status

Choices:

  • provisioning

  • pending

  • downloading

  • deploying

  • active

  • degraded

  • inactive

  • error

Type:

Type

status_message

TextField

Status message

Type:

Type

supports_function_calling

BooleanField

Supports function calling

Type:

Type

supports_reasoning

BooleanField

Supports reasoning

Type:

Type

supports_streaming

BooleanField

Supports streaming

Type:

Type

supports_vision

BooleanField

Supports vision

Type:

Type

tagged_items

Reverse GenericRelation from LLMHost

All + of this tagged item (related name of tagged_items)

Type:

Type

tags = <taggit.managers._TaggableManager object>
updated_at

DateTimeField

Updated at

Timestamp indicating when the model instance was last updated.

This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.

Type:

Type

property uptime: timedelta | None

The time since the LLMHost was launched, if it is deployed.

property uptime_hours: float | None
user_profile

ForeignKey to UserProfile

User profile (related name: llmhost)

Type:

Type

user_profile_id

Internal field, use user_profile instead.

version

CharField

Version. Semantic version in the format MAJOR.MINOR.PATCH, e.g., ‘1.0.0’.

Type:

Type

vram_required_gb

PositiveIntegerField

Vram required gb

Type:

Type

class smarter.apps.llmhost.models.LLMHostCompute(*args, **kwargs)[source]

Bases: MetaDataWithOwnershipModel

A kind of node, e.g. g6.2xlarge with one NVIDIA L4, and its node group.

The node’s capacity is what the instance type provides. What pods can request, its allocatable capacity, is less: the kubelet, the operating system and the cluster’s DaemonSets reserve some of it. See allocatable_cpu_millicores and allocatable_memory_mib.

Parameters:
  • id (Unknown) – Primary key: ID

  • created_at (Unknown) – Created at

  • updated_at (Unknown) – Updated at

  • name (Unknown) – Name. Name in camelCase, e.g., ‘apiKey’, no special characters.

  • description (Unknown) – Description. A brief description of this resource. Be verbose, but not too verbose.

  • version (Unknown) – Version. Semantic version in the format MAJOR.MINOR.PATCH, e.g., ‘1.0.0’.

  • annotations (Unknown) – Annotations. Key-value pairs for annotating this resource.

  • spec (Unknown) – Spec. The manifest’s spec, in camelCase. The source of truth for the node group.

  • instance_type (Unknown) – Instance type. e.g. ‘g6.2xlarge’.

  • cpu (Unknown) – Cpu. vCPUs.

  • memory_gb (Unknown) – Memory gb. GiB.

  • gpu_type (Unknown) – Gpu type. e.g. ‘L4’.

  • gpu_count (Unknown) – Gpu count

  • gpu_memory_gb (Unknown) – Gpu memory gb. Per GPU.

  • max_nodes (Unknown) – Max nodes. The most nodes that Smarter adds.

  • price_per_hour (Unknown) – Price per hour. Of one node, e.g. its on-demand price.

  • nodegroup_status (Unknown) – Nodegroup status

  • desired_nodes (Unknown) – Desired nodes

  • ready_nodes (Unknown) – Ready nodes

  • status_message (Unknown) – Status message

  • last_reconciled_at (Unknown) – Last reconciled at

Relationship fields:

Parameters:
  • user_profile (Unknown) – User profile (related name: llmhostcompute)

  • tags (Unknown) – Tags. Tags for categorizing and organizing this resource. (related name: llmhostcompute)

  • tagged_items (Unknown) – Tagged items (related name: +)

Reverse relationships:

Parameters:

llmhosts (Unknown) – All llmhosts of this LLMHost Compute (related name of compute)

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

property allocatable_cpu_millicores: int

An estimate of the CPU that pods can request on one node.

The kubelet’s reservation, and the cluster’s DaemonSets, e.g. the CNI, kube-proxy and the NVIDIA device plugin: half a core plus 2%.

property allocatable_memory_mib: int

less 1.5 GiB plus 3%.

Type:

An estimate of the memory that pods can request on one node

property ami_type: str
annotations

JSONField

Annotations. Key-value pairs for annotating this resource.

Type:

Type

property capacity_type: str
clone(new_name=None, new_version=None, user_profile=None)[source]

Clone the LLMHostCompute’s spec, but not its node group: the clone is a new kind of node, whose node group Smarter creates when an LLMHost first needs one of its nodes.

Return type:

LLMHostCompute

cpu

PositiveIntegerField

Cpu. vCPUs.

Type:

Type

created_at

DateTimeField

Created at

Timestamp indicating when the model instance was created.

This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.

Type:

Type

description

TextField

Description. A brief description of this resource. Be verbose, but not too verbose.

Type:

Type

desired_nodes

PositiveSmallIntegerField

Desired nodes

Type:

Type

property disk_size_gb: int
gpu_count

PositiveSmallIntegerField

Gpu count

Type:

Type

gpu_memory_gb

PositiveIntegerField

Gpu memory gb. Per GPU.

Type:

Type

property gpu_resource: str
gpu_type

CharField

Gpu type. e.g. ‘L4’.

Type:

Type

property has_gpu: bool
id

BigAutoField

Primary key: ID

Type:

Type

instance_type

CharField

Instance type. e.g. ‘g6.2xlarge’.

Type:

Type

last_reconciled_at

DateTimeField

Last reconciled at

Type:

Type

llmhosts

Reverse ForeignKey from LLMHost

All llmhosts of this LLMHost Compute (related name of compute)

Type:

Type

max_nodes

PositiveSmallIntegerField

Max nodes. The most nodes that Smarter adds.

Type:

Type

memory_gb

PositiveIntegerField

Memory gb. GiB.

Type:

Type

name

CharField

Name. Name in camelCase, e.g., ‘apiKey’, no special characters.

Type:

Type

property node_spec: dict[str, Any]

Spec.node, as stored.

property nodegroup_name: str

The node group’s name, unique to the environment, e.g. smarter-alpha-12-gpu-l4-1x.

property nodegroup_spec: dict[str, Any]

Spec.nodeGroup, as stored.

nodegroup_status

CharField

Nodegroup status

Type:

Type

price_per_hour

DecimalField

Price per hour. Of one node, e.g. its on-demand price.

Type:

Type

ready_nodes

PositiveSmallIntegerField

Ready nodes

Type:

Type

rename(new_name)[source]

Rename the LLMHostCompute.

Refused while its node group exists, whose name includes the LLMHostCompute’s, or while LLMHosts use it, whose spec.compute names it.

Raises:

ValueError – if it cannot be renamed.

Return type:

LLMHostCompute

spec

JSONField

Spec. The manifest’s spec, in camelCase. The source of truth for the node group.

Type:

Type

status_message

TextField

Status message

Type:

Type

property subnet_ids: list[str]
tagged_items

Reverse GenericRelation from LLMHostCompute

All + of this tagged item (related name of tagged_items)

Type:

Type

tags = <taggit.managers._TaggableManager object>
property taint: dict[str, str]

The node group’s taint, which LLMHost pods tolerate.

updated_at

DateTimeField

Updated at

Timestamp indicating when the model instance was last updated.

This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.

Type:

Type

user_profile

ForeignKey to UserProfile

User profile (related name: llmhostcompute)

Type:

Type

user_profile_id

Internal field, use user_profile instead.

version

CharField

Version. Semantic version in the format MAJOR.MINOR.PATCH, e.g., ‘1.0.0’.

Type:

Type

class smarter.apps.llmhost.models.LLMHostEvent(*args, **kwargs)[source]

Bases: TimestampedModel

A lifecycle event of an LLMHost: launched, status changed, destroyed, or an error.

Events are the LLMHost’s audit trail, and the basis of uptime and cost reporting.

Parameters:
  • id (Unknown) – Primary key: ID

  • created_at (Unknown) – Created at

  • updated_at (Unknown) – Updated at

  • llmhost_name (Unknown) – Llmhost name. The LLMHost’s name, in case it is deleted.

  • event_type (Unknown) – Event type

  • status (Unknown) – Status

  • message (Unknown) – Message

  • details (Unknown) – Details

Relationship fields:

Parameters:

llmhost (Unknown) – Llmhost (related name: events)

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

created_at

DateTimeField

Created at

Timestamp indicating when the model instance was created.

This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.

Type:

Type

details

JSONField

Details

Type:

Type

event_type

CharField

Event type

Choices:

  • launched

  • status_changed

  • destroyed

  • nodes_scaled

  • error

Type:

Type

get_event_type_display(*, field=<django.db.models.CharField: event_type>)

Shows the label of the event_type. See get_FOO_display() for more information.

get_status_display(*, field=<django.db.models.CharField: status>)

Shows the label of the status. See get_FOO_display() for more information.

id

BigAutoField

Primary key: ID

Type:

Type

llmhost

ForeignKey to LLMHost

Llmhost (related name: events)

Type:

Type

llmhost_id

Internal field, use llmhost instead.

llmhost_name

CharField

Llmhost name. The LLMHost’s name, in case it is deleted.

Type:

Type

message

TextField

Message

Type:

Type

objects = <django.db.models.Manager object>
status

CharField

Status

Choices:

  • provisioning

  • pending

  • downloading

  • deploying

  • active

  • degraded

  • inactive

  • error

Type:

Type

updated_at

DateTimeField

Updated at

Timestamp indicating when the model instance was last updated.

This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.

Type:

Type