DocsBlogPricingPluginsDemo
Get Codapult

Build your SaaS. Launch your MVP.

Get Codapult

Product

  • Pricing
  • Architecture
  • Modules
  • AI platform
  • Plugins

Developers

  • MCP
  • CLI
  • Documentation
  • Launch your SaaS
  • Build a B2B SaaS

Resources

  • Blog
  • FAQ

Connect

  • Contact
  • GitHub

Compare

  • SaaS template comparison
  • Codapult vs Supastarter
  • Codapult vs Makerkit
  • Codapult vs ShipFast
  • Codapult vs SaaSBold
  • Codapult vs Gravity
  • Codapult vs Nextbase
  • Codapult vs BuilderKit

Featured on

Codapult on LaunchNestCodapult on LaunchNestbetterlaunch.cobetterlaunch.coFeatured on LaunchBuffFeatured on LaunchBuffCodapult on PeerPushCodapult on PeerPushFeatured on LaunchItFeatured on LaunchIt
© 2026 Codapult·All rights reserved·Privacy Policy·Terms of Service
Built-in AI · Team-ready SaaS · One-time purchase
All articles

Getting Started

  • Introduction
  • Quick Start
  • Your First 30 Minutes
  • Project Structure
  • License and Permitted Use
  • Starter Profiles and Recipes
  • Product Recipes

Configuration

  • Environment Variables
  • App Configuration
  • Which Modules Should I Enable?
  • Provider Matrix
  • Capability Coverage

Authentication

  • Authentication
  • OAuth Providers
  • Two-Factor & Passwordless
  • Enterprise SSO (SAML)

Database

  • Database
  • Database and Provider Guide
  • Database Migrations

Teams

  • Teams & Organizations
  • Permissions & RBAC
  • SCIM Provisioning

Deployment

  • Deployment
  • Enterprise E2E Evidence
  • Enterprise Production Readiness
  • Deployment, Backup, and Restore Runbook
  • Troubleshooting

Payments

  • Payments & Billing
  • Stripe Setup
  • LemonSqueezy Setup
  • Polar Setup
  • Payment Webhooks

Api

  • API Layer
  • tRPC
  • GraphQL

Ai

  • AI Features
  • AI Runtime Architecture and Evals
  • Streaming Chat
  • RAG and Semantic Search
  • Quotas and Memory

Email

  • Email
  • Email Templates

Infrastructure

  • Infrastructure
  • Self-Hosting
  • File Storage
  • Docker
  • Background Jobs
  • Terraform & Pulumi
  • Kubernetes

Ui

  • UI & Theming

I18n

  • Internationalization

Content Management

  • Content Management

Admin

  • Admin Panel

Security

  • Security
  • Data Retention Policy

Monitoring

  • Analytics & Monitoring

Modules

  • Module Architecture
  • Waitlist
  • Welcome Page
  • Audit Log
  • White-Labeling
  • Workflow Automation
  • A/B Testing
  • Referrals
  • GDPR Export and Deletion
  • Promotions
  • Outgoing Webhooks

Plugins

  • Product plugins
  • CRM Plugin
  • Helpdesk Plugin
  • Email Marketing Plugin

Upgrading

  • Upgrading Codapult

Developer Tools

  • AI Agents & IDEs
  • MCP Server
  • Testing
  • Build Your First Feature with Codapult MCP
  • Architecture Guardrails for AI Coding Agents
Ai

Streaming Chat

How the built-in AI chat uses Vercel AI SDK, model adapters, streaming responses, and tools.

Codapult includes a working AI chat surface, not just provider configuration. The module combines a dashboard chat UI, persisted conversations, a streaming API route, provider adapters, model selection, organization quotas, and optional RAG context injection.

The connected chat surface is the production dashboard experience and owns conversation history, model selection, streaming transport, and rendering of both text and tool-call parts.

Runtime flow

  1. The user sends a message from the connected chat surface.
  2. POST /api/ai/chat authenticates the session and validates the request.
  3. The route checks rate limits and organization AI quota.
  4. The selected model is resolved through the provider adapter.
  5. RAG context is retrieved when enabled and appended to the system prompt.
  6. The response streams back through the Vercel AI SDK.
  7. Conversation and message rows are persisted for history.

The request AbortSignal is propagated from the route to the provider call, so closing or cancelling the client request can stop an in-flight stream. Output guardrails still run after the stream completes: already-delivered tokens cannot be retracted. Use the gateway's requireCompleteResponse: true option with the relevant output guardrail when PII must be blocked or redacted before any output reaches the client. The built-in /api/ai/chat surface remains interactive streaming; sensitive application-specific routes should enforce the complete-response policy server-side.

The option controls response delivery, not the guardrail definition itself. The organization must have an output rule configured with the required block or redact action.

Models

Models are declared in the model catalogue. Each entry has an ID, label, provider, SDK model ID, capabilities, and pricing. Unknown model IDs are rejected instead of being inferred from a name prefix.

To restrict the UI to a subset of models, set AI_ALLOWED_MODELS to a comma-separated list. The server page resolves the list and passes only serializable model metadata to the client component.

Tool calls

The chat route supports Vercel AI SDK tool calls. Add product-specific tools at the chat integration boundary with a Zod parameter schema and an execute function. Keep tools small and domain-specific: lookup a record, update a workflow, fetch a report, or call an internal service.

The connected surface renders tool-call parts returned by the route. It also accepts optional agent, debug, and message-cost metadata for specialized server-backed integrations; those values must be supplied by the parent integration and are not generated by the basic chat route automatically.

Configuration

SettingLocation
Default modelAI_DEFAULT_MODEL
System promptVersioned system instruction
Allowed modelsAI_ALLOWED_MODELS
OpenAI keyOPENAI_API_KEY
Anthropic keyANTHROPIC_API_KEY

For an OpenAI-compatible custom endpoint, add a model with provider: 'custom', then set CUSTOM_AI_BASE_URL and CUSTOM_AI_API_KEY. These variables configure the endpoint only; they do not create an arbitrary model entry.

Related docs

  • RAG and Semantic Search
  • Quotas and Memory
  • Environment Variables
AI Runtime Architecture and EvalsRAG and Semantic Search