LLMClientCustomDomain Model

class smarter.apps.llm_client.models.LLMClientCustomDomain(*args, **kwargs)[source]

Bases: TimestampedModel

Represents a DNS host record for a customer account’s LLMClient, linked to an AWS Hosted Zone.

This model is used to manage custom domains for llm_clients within the Smarter platform. Each instance of this model corresponds to a DNS host (subdomain) that is associated with a specific customer account and is managed through AWS Route 53 Hosted Zones.

The primary purpose of this model is to enable customers to use their own branded domains for llm_client endpoints, rather than relying solely on default platform-provided domains. This allows for improved branding, trust, and integration with customer infrastructure.

Key Features

  • Associates a custom domain with a customer Account.

  • Stores the AWS Hosted Zone ID for DNS management and automation.

  • Tracks the verification status of the domain, indicating whether DNS records have been correctly configured and validated.

  • Supports caching of verified domains for efficient lookup and validation across the platform.

Usage Scenarios

  • When a customer wishes to deploy an llm_client at a custom subdomain (e.g., llm_client.example.com), an instance of this model is created to represent and manage that domain.

  • The platform uses the AWS Hosted Zone ID to automate DNS record creation and validation as part of the llm_client deployment workflow.

  • The is_verified field is updated as part of the DNS verification process, ensuring that only properly configured domains are used for llm_client endpoints.

Integration

  • This model is referenced by other llm_client-related models, such as LLMClient and LLMClientCustomDomainDNS, to provide a complete mapping between llm_clients, their domains, and DNS records.

  • The platform uses this model to enforce domain uniqueness and to prevent conflicts between customer accounts.

Notes

  • The domain name must be a valid DNS hostname and is validated upon saving.

  • Caching is used to optimize the retrieval of verified domains, reducing database load and improving performance for domain-related checks.

  • This model is intended for internal use within the Smarter platform and is not exposed directly to end users.

Example

# Create a new custom domain for an llm_client
custom_domain = LLMClientCustomDomain.objects.create(
    account=my_account,
    aws_hosted_zone_id="Z1234567890ABCDEF",
    domain_name="llm_client.example.com",
    is_verified=False,
)

# Retrieve all verified custom domains
verified_domains = LLMClientCustomDomain.get_verified_domains()
Parameters:
  • id (Unknown) – Primary key: ID

  • created_at (Unknown) – Created at

  • updated_at (Unknown) – Updated at

  • aws_hosted_zone_id (Unknown) –

    Aws hosted zone id

    The AWS Hosted Zone ID associated with this custom domain. This ID is used for DNS management via AWS Route 53. Example: “Z1234567890ABCDEF”

  • domain_name (Unknown) –

    Domain name

    The custom domain name for the LLMClient. This should be a valid DNS hostname. Example: “llm_client.example.com”

  • is_verified (Unknown) –

    Is verified

    Indicates whether the custom domain has been verified. A verified domain has the correct DNS records configured. This is managed by the asynchronous LLMClient deployment process. Example: True

Reverse relationships:

Parameters:
  • llmclientcustomdomaindns (Unknown) – All LLMClient Custom Domain DNS of this llm client custom domain (related name of custom_domain)

  • llmclient (Unknown) – The llm client of this llm client custom domain (related name of custom_domain)

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

aws_hosted_zone_id

CharField

Aws hosted zone id

The AWS Hosted Zone ID associated with this custom domain. This ID is used for DNS management via AWS Route 53. Example: “Z1234567890ABCDEF”

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

domain_name

CharField

Domain name

The custom domain name for the LLMClient. This should be a valid DNS hostname. Example: “llm_client.example.com”

Type:

Type

classmethod get_verified_domains()[source]

Get all verified custom domains from cache or database.

Returns:

List of verified domain names.

Return type:

List[str]

id

BigAutoField

Primary key: ID

Type:

Type

is_verified

BooleanField

Is verified

Indicates whether the custom domain has been verified. A verified domain has the correct DNS records configured. This is managed by the asynchronous LLMClient deployment process. Example: True

Type:

Type

llmclient

Reverse OneToOneField from LLMClient

The llm client of this llm client custom domain (related name of custom_domain)

Type:

Type

llmclientcustomdomaindns_set

Reverse ForeignKey from LLMClientCustomDomainDNS

All LLMClient Custom Domain DNS of this llm client custom domain (related name of custom_domain)

Type:

Type

objects = <django.db.models.Manager object>
save(*args, **kwargs)[source]

Save the LLMClientCustomDomain instance, validating the domain name.

Raises:

ValidationError – If the domain name is not valid.

Returns:

None

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