LLMClientCustomDomain Model

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

Bases: MetaDataWithOwnershipModel

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 llmclients 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 llmclient endpoints, rather than relying solely on default platform-provided domains. This allows for improved branding, trust, and integration with customer infrastructure.

Key Features

  • Is owned by a UserProfile, like every other Smarter resource, and so has a name, description, version, tags and annotations, and may be shared with the owner’s account. Its default name is its domain name in snake_case.

  • 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 llmclient at a custom subdomain (e.g., llmclient.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 llmclient deployment workflow.

  • verification_status tracks the domain through verification: Not Verified, Verifying, Verified or Failed. A domain is Verified when its NS records are delegated to its Route53 hosted zone, and its AWS ACM TLS certificate is issued. verified_at records when, and verification_message the step that is blocking verification. Only verified domains are used for llmclient endpoints.

Integration

  • This model is referenced by other llmclient-related models, such as LLMClient and LLMClientCustomDomainDNS, to provide a complete mapping between llmclients, 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 llmclient
custom_domain = LLMClientCustomDomain.objects.create(
    user_profile=my_user_profile,
    aws_hosted_zone_id="Z1234567890ABCDEF",
    domain_name="llmclient.example.com",
)

# 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

  • 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.

  • 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” Blank until smarter deploy registers the domain with AWS.

  • domain_name (Unknown) –

    Domain name

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

  • verification_status (Unknown) –

    Verification status

    Where the custom domain is in verification. A domain is Verified when its NS records are delegated to its Route53 hosted zone, and its TLS certificate is issued.

  • verified_at (Unknown) –

    Verified at

    When the custom domain was last verified, or None if it is not verified.

  • verification_message (Unknown) –

    Verification message

    Why the custom domain is not verified yet, or why its verification failed: the verification step that is blocking it. Blank once it is verified.

Relationship fields:

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

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

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

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

class VerificationStatusChoices(*values)[source]

Bases: TextChoices

The verification status of a custom domain.

Managed by the asynchronous verify_custom_domain() task.

FAILED = 'Failed'
NOT_VERIFIED = 'Not Verified'
VERIFIED = 'Verified'
VERIFYING = 'Verifying'
annotations

JSONField

Annotations. Key-value pairs for annotating this resource.

Type:

Type

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” Blank until smarter deploy registers the domain with AWS.

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

domain_name

CharField

Domain name

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

Type:

Type

get_verification_status_display(*, field=<django.db.models.CharField: verification_status>)

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

classmethod get_verified_domains()[source]

Get all verified custom domains, from the cache or the database.

Returns:

List of verified domain names.

Return type:

list[str]

id

BigAutoField

Primary key: ID

Type:

Type

property is_verified: bool

True if the custom domain is verified.

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

name

CharField

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

Type:

Type

objects: MetaDataWithOwnershipModelManager = <smarter.apps.account.models.metadata_with_ownership.MetaDataWithOwnershipModelManager object>
save(*args, **kwargs)[source]

Save the LLMClientCustomDomain instance, validating the domain name.

A custom domain that has no name is named after its domain name.

Raises:

ValidationError – If the domain name is not valid.

Returns:

None

set_verification_status(status, message='')[source]

Save a new verification status, and when it is Verified, the time of verification.

Invalidates the cached list of verified domains.

Parameters:
Return type:

None

tagged_items

Reverse GenericRelation from LLMClientCustomDomain

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

user_profile

ForeignKey to UserProfile

User profile (related name: llmclientcustomdomain)

Type:

Type

user_profile_id

Internal field, use user_profile instead.

verification_message

CharField

Verification message

Why the custom domain is not verified yet, or why its verification failed: the verification step that is blocking it. Blank once it is verified.

Type:

Type

verification_status

CharField

Verification status

Choices:

  • Not Verified

  • Verifying

  • Verified

  • Failed

Where the custom domain is in verification. A domain is Verified when its NS records are delegated to its Route53 hosted zone, and its TLS certificate is issued.

Type:

Type

verified_at

DateTimeField

Verified at

When the custom domain was last verified, or None if it is not verified.

Type:

Type

version

CharField

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

Type:

Type