Smarter API
The Smarter API provides support for AI text prompts, the command-line interface (CLI), as well as limited support for anciallary UI features. The API is built on Django REST Framework and includes a rich set of enterprise features for enhanced security, audit capability, and performance optimization.
The Smarter Framework supports multiple hosting naming schemes for the Smarter API. For example:
Hosting Type |
Example |
|---|---|
Default Hosting |
|
Session-Based Hosting |
|
Named LLMClients |
|
Custom Domains |
|
See Django Hosts for more details.
URL configuration for Smarter API v1.
This module defines the urlpatterns for the /api/v1/ entry point and
delegates route handling to app-specific URL modules.
Routes
accounts/: User account management endpoints.llm_clients/: LLMClient CRUD and related operations.cli/: Brokered services for CLI workflows.connections/: External connection integration endpoints.plugins/: Plugin management endpoints.prompts/: Prompt and interaction endpoints.providers/: Provider integration endpoints.secrets/: Secret management endpoints.tests/: Test-only endpoints.vectorstores/: Vector store endpoints (enabled only whenSMARTER_ENABLE_VECTORSTORE=true).
Each included URL set uses a namespace to avoid naming collisions and to keep API components logically separated.
See also
1
2from django.urls import include, path
3
4from smarter.apps.account.api.v1 import urls as account_urls
5from smarter.apps.account.const import namespace as account_namespace
6from smarter.apps.api.v1.cli import urls as cli_urls
7from smarter.apps.api.v1.tests import urls as tests_urls
8from smarter.apps.connection.api.v1 import urls as connection_urls
9from smarter.apps.llm_client.api.v1 import urls as llm_client_urls
10from smarter.apps.llm_client.const import namespace as llm_client_namespace
11from smarter.apps.plugin.api.v1 import urls as plugin_urls
12from smarter.apps.plugin.const import namespace as plugin_namespace
13from smarter.apps.prompt.api.v1 import urls as prompt_urls
14from smarter.apps.prompt.const import namespace as prompt_namespace
15from smarter.apps.provider.api.v1 import urls as provider_urls
16from smarter.apps.provider.const import namespace as provider_namespace
17from smarter.apps.secret.api.v1 import urls as secret_urls
18from smarter.apps.secret.const import namespace as secret_namespace
19from smarter.apps.vectorstore.api.v1 import urls as vectorstore_urls
20from smarter.common.conf import smarter_settings
21from smarter.common.mixins.helper_mixin import SmarterReadyState
22from smarter.lib import logging
23
24from .cli.const import namespace as cli_namespace
25from .const import namespace
26
27logger = logging.getLogger(__name__)
28
29app_name = namespace
30
31# /api/v1/ is the main entry point for the API
32urlpatterns = [
33 # for LLMClients of the form https://example.3141-5926-5359.alpha.api.example.com
34 # path("", include(llm_client_urls)),
35 # -------------------------------------------
36 # the main API
37 # -------------------------------------------
38 path("accounts/", include(account_urls, namespace=account_namespace)),
39 path("llm-clients/", include(llm_client_urls, namespace=llm_client_namespace)),
40 path("cli/", include(cli_urls, namespace=cli_namespace)),
41 path("connections/", include(connection_urls, namespace="connection")),
42 path("plugins/", include(plugin_urls, namespace=plugin_namespace)),
43 path("prompts/", include(prompt_urls, namespace=prompt_namespace)),
44 path("providers/", include(provider_urls, namespace=provider_namespace)),
45 path("secrets/", include(secret_urls, namespace=secret_namespace)),
46 path("tests/", include(tests_urls, namespace="tests")),
47]
48
49if smarter_settings.enable_vectorstore:
50 urlpatterns += [
51 path("vectorstores/", include(vectorstore_urls, namespace="vectorstore")),
52 ]
53 logger.info("%s Vectorstore API endpoints are %s.", logging.formatted_text(__name__), SmarterReadyState.READY)
54else:
55 logger.info(
56 "%s Vectorstore API endpoints are %s. Set env `SMARTER_ENABLE_VECTORSTORE=true` to enable.",
57 logging.formatted_text(__name__),
58 SmarterReadyState.NOT_READY,
59 )