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.

Its official clients are the Smarter CLI, for people at a terminal, and the Python, Node.js and Go SDKs, for software that integrates with your platform.

The whole API is described by a typed OpenAPI 3.1 document, the Smarter OpenAPI Contract, which every platform serves at /docs/openapi.json, and from which clients in any language can be generated. See Smarter APIs, SDKs and Integrations for the design that the API and its clients share.

The Smarter Framework supports multiple hosting naming schemes for the Smarter API. For example:

Smarter API Hosting Schemes

Hosting Type

Example

Default Hosting

api.example.com

Session-Based Hosting

example.com/v1/api/

Named LLMClients

stackademy.1234-5678-9012.example.com

Custom Domains

chat.yourdomain.com

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.

  • mcp/: The Smarter Project MCP server, which reads the project’s documentation and code.

  • journal/: Smarter Journal entries (superusers only).

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

    SMARTER_ENABLE_VECTORSTORE=true).

Each included URL set uses a namespace to avoid naming collisions and to keep API components logically separated.

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