API Reference
LLMHost api/v1/llmhosts views.
LLMHosts are created and updated by applying manifests, with smarter apply, so these
views do not create or update them:
GET llmhosts/: the LLMHosts that the user may read.GET llmhosts/report/: a summary of the user’s LLMHosts: status, GPUs and cost.GET llmhosts/discover/?q=&task=&catalog=: search a model catalog, e.g. huggingface or builtin.GET llmhosts/discover/manifest/?repository=&catalog=&engine=: draft a manifest for a model.GET llmhosts/<hashed_id>/: an LLMHost that the user may read.DELETE llmhosts/<hashed_id>/: destroy and delete an LLMHost that the user owns.GET llmhosts/<hashed_id>/status/: check an LLMHost’s status, now.GET llmhosts/<hashed_id>/logs/?tail=: the inference server’s recent logs.GET llmhosts/<hashed_id>/plan/: the Kubernetes resources that deploy would apply, without secrets.POST llmhosts/<hashed_id>/deploy/andPOST llmhosts/<hashed_id>/undeploy/.
The responses are built from the models of smarter.apps.llmhost.contract.models, which the
Smarter api’s OpenAPI document publishes. Errors are Django REST framework’s {"detail": ...}.
- class smarter.apps.llmhost.api.v1.views.views.LLMHostDeployView(*args, **kwargs)[source]
Bases:
LLMHostViewBaseLaunch an LLMHost that the user owns.
- class smarter.apps.llmhost.api.v1.views.views.LLMHostDiscoverManifestView(*args, **kwargs)[source]
Bases:
SmarterAuthenticatedAPIViewDraft a manifest:
?repository=(required),?catalog=,?engine=,?name=,?tokenSecret=.
- class smarter.apps.llmhost.api.v1.views.views.LLMHostDiscoverView(*args, **kwargs)[source]
Bases:
SmarterAuthenticatedAPIViewSearch a model catalog:
?q=,?task=text-generation|embedding,?catalog=huggingface|builtin,?limit=.
- class smarter.apps.llmhost.api.v1.views.views.LLMHostListView(*args, **kwargs)[source]
Bases:
ContractListMixin,SmarterAuthenticatedListAPIViewThe LLMHosts that the user may read.
- contract_model
alias of
LLMHostApiLLMHost
- serializer_class
alias of
LLMHostSerializer
- class smarter.apps.llmhost.api.v1.views.views.LLMHostLogsView(*args, **kwargs)[source]
Bases:
LLMHostViewBaseThe recent logs of an LLMHost that the user owns.
- class smarter.apps.llmhost.api.v1.views.views.LLMHostPlanView(*args, **kwargs)[source]
Bases:
LLMHostViewBaseThe Kubernetes resources that deploy would apply, with secrets redacted.
- class smarter.apps.llmhost.api.v1.views.views.LLMHostReportView(*args, **kwargs)[source]
Bases:
SmarterAuthenticatedAPIViewA summary of the LLMHosts that the user owns: status, GPUs and cost.
- class smarter.apps.llmhost.api.v1.views.views.LLMHostStatusView(*args, **kwargs)[source]
Bases:
LLMHostViewBaseCheck an LLMHost’s status, now.
- class smarter.apps.llmhost.api.v1.views.views.LLMHostUndeployView(*args, **kwargs)[source]
Bases:
LLMHostViewBaseDestroy the Kubernetes resources of an LLMHost that the user owns.
?purge=truealso deletes its model volume.
- class smarter.apps.llmhost.api.v1.views.views.LLMHostView(*args, **kwargs)[source]
Bases:
LLMHostViewBaseRead, or destroy and delete, an LLMHost.
- delete(request, *args, **kwargs)[source]
Destroy the Kubernetes resources of an LLMHost that the user owns, then delete it.
- serializer_class
alias of
LLMHostSerializer
- class smarter.apps.llmhost.api.v1.views.views.LLMHostViewBase(*args, **kwargs)[source]
Bases:
SmarterAuthenticatedAPIViewBase class for views of one LLMHost, identified by
hashed_idorllmhost_id.get_llmhost()returns the LLMHost only if the user may read it, or, withowner=True, only if the user owns it. Otherwise it raisesHttp404, so that the LLMHosts of other accounts are not disclosed.- get_llmhost(request, owner=False, **kwargs)[source]
Return the LLMHost in the URL, if the user may read it, or own it.
- Parameters:
request (
Request) – The request.owner (
bool) – Whether the user must own the LLMHost, rather than only read it.kwargs – The URL’s kwargs:
hashed_id, orllmhost_id.
- Return type:
- Returns:
The LLMHost.
- Raises:
Http404 – if the URL names no LLMHost, or one that the user may not read, or own.
- get_service()[source]
A new instance of
service_class, which tests may replace.- Return type:
LLMHostService
- service_class
alias of
LLMHostService
- smarter.apps.llmhost.api.v1.views.views.error(message, status=HTTPStatus.BAD_REQUEST)[source]
An error response: Django REST framework’s
{"detail": ...}, as every error of the REST api.