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.llmclients/: 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.connection.const import namespace as connnection_namespace
10from smarter.apps.guardrail.api.v1 import urls as guardrail_urls
11from smarter.apps.guardrail.const import namespace as guardrail_namespace
12from smarter.apps.llmclient.api.v1 import urls as llmclient_urls
13from smarter.apps.llmclient.const import namespace as llmclient_namespace
14from smarter.apps.mcpclient.api.v1 import urls as mcpclient_urls
15from smarter.apps.mcpclient.const import namespace as mcpclient_namespace
16from smarter.apps.plugin.api.v1 import urls as plugin_urls
17from smarter.apps.plugin.const import namespace as plugin_namespace
18from smarter.apps.prompt.api.v1 import urls as prompt_urls
19from smarter.apps.prompt.const import namespace as prompt_namespace
20from smarter.apps.provider.api.v1 import urls as provider_urls
21from smarter.apps.provider.const import namespace as provider_namespace
22from smarter.apps.proxy.api.v1 import urls as proxy_urls
23from smarter.apps.proxy.const import namespace as proxy_namespace
24from smarter.apps.secret.api.v1 import urls as secret_urls
25from smarter.apps.secret.const import namespace as secret_namespace
26from smarter.apps.vectorsearch.api.v1 import urls as vectorsearch_urls
27from smarter.apps.vectorsearch.const import namespace as vectorsearch_namespace
28from smarter.apps.vectorstore.api.v1 import urls as vectorstore_urls
29from smarter.common.conf import smarter_settings
30from smarter.common.mixins.helper_mixin import SmarterReadyState
31from smarter.lib import logging
32
33from .cli.const import namespace as cli_namespace
34from .const import namespace
35
36logger = logging.getLogger(__name__)
37
38app_name = namespace
39
40# /api/v1/ is the main entry point for the API
41urlpatterns = [
42 # for LLMClients of the form https://example.3141-5926-5359.alpha.api.example.com
43 # path("", include(llmclient_urls)),
44 # -------------------------------------------
45 # the main API
46 # -------------------------------------------
47 path("accounts/", include(account_urls, namespace=account_namespace)),
48 path("llm-clients/", include(llmclient_urls, namespace=llmclient_namespace)),
49 path("mcpclients/", include(mcpclient_urls, namespace=mcpclient_namespace)),
50 path("cli/", include(cli_urls, namespace=cli_namespace)),
51 path("connections/", include(connection_urls, namespace=connnection_namespace)),
52 path("guardrails/", include(guardrail_urls, namespace=guardrail_namespace)),
53 path("plugins/", include(plugin_urls, namespace=plugin_namespace)),
54 path("prompts/", include(prompt_urls, namespace=prompt_namespace)),
55 path("providers/", include(provider_urls, namespace=provider_namespace)),
56 path("secrets/", include(secret_urls, namespace=secret_namespace)),
57 path("tests/", include(tests_urls, namespace="tests")),
58 path("vectorsearches/", include(vectorsearch_urls, namespace=vectorsearch_namespace)),
59]
60
61if smarter_settings.enable_proxy:
62 urlpatterns += [
63 path("proxy/", include(proxy_urls, namespace=proxy_namespace)),
64 ]
65 logger.info("%s Proxy API endpoints are %s.", logging.formatted_text(__name__), SmarterReadyState.READY)
66else:
67 logger.info(
68 "%s Proxy API endpoints are %s. Set env `SMARTER_ENABLE_PROXY=true` to enable.",
69 logging.formatted_text(__name__),
70 SmarterReadyState.NOT_READY,
71 )
72if smarter_settings.enable_vectorstore:
73 urlpatterns += [
74 path("vectorstores/", include(vectorstore_urls, namespace="vectorstore")),
75 ]
76 logger.info("%s Vectorstore API endpoints are %s.", logging.formatted_text(__name__), SmarterReadyState.READY)
77else:
78 logger.info(
79 "%s Vectorstore API endpoints are %s. Set env `SMARTER_ENABLE_VECTORSTORE=true` to enable.",
80 logging.formatted_text(__name__),
81 SmarterReadyState.NOT_READY,
82 )