Skip to main content
All feature toggles and app settings live in chat.config.ts. It is parsed and exported as config from @/lib/config.

Config Structure

chat.config.ts
import type { ConfigInput } from "@/lib/config-schema";

const config: ConfigInput = {
  appName: "Your App Name",
  appPrefix: "your-app",

  organization: {
    name: "Your Company",
    contact: {
      privacyEmail: "privacy@example.com",
      legalEmail: "legal@example.com",
    },
  },

  ai: {
    gateway: "vercel", // "vercel" | "openrouter" | "openai" | "openai-compatible"
    tools: {
      webSearch: { enabled: true },
      urlRetrieval: { enabled: true },
      codeExecution: { enabled: true },
      mcp: { enabled: false },
      followupSuggestions: { enabled: true, default: "openai/gpt-5-nano" },
      image: { enabled: true },
      video: { enabled: true },
      deepResearch: {
        enabled: true,
        defaultModel: "google/gemini-2.5-flash-lite",
        finalReportModel: "google/gemini-3-flash",
        allowClarification: true,
        maxResearcherIterations: 1,
        maxConcurrentResearchUnits: 2,
        maxSearchQueries: 2,
      },
    },
  },

  features: {
    attachments: true, // File uploads (images and PDFs)
  },

  authentication: {
    google: true,
    github: true,
    vercel: false,
  },

  // ... more options
};

export default config;

AI Gateway

The ai.gateway field selects which AI backend to use. All model routing, fetching, and API calls go through the active gateway.
ValueBackendEnv Dependency
"vercel" (default)Vercel AI GatewayAI_GATEWAY_API_KEY or VERCEL_OIDC_TOKEN
"openrouter"OpenRouterOPENROUTER_API_KEY
"openai"OpenAIOPENAI_API_KEY
"openai-compatible"OpenAI CompatibleOPENAI_COMPATIBLE_BASE_URL
ai: {
  gateway: "openrouter", // Switch to OpenRouter
  // ...
},
See Gateways for detailed setup and comparison.

Features

Toggle feature flags on/off. Tool flags live under ai.tools.*.enabled. features currently contains only attachments. Missing env vars are caught at build time via bun run prebuild.
FeatureConfig KeyEnv Dependency
Code Executionai.tools.codeExecution.enabledVERCEL_OIDC_TOKEN (on Vercel) or VERCEL_TEAM_ID + VERCEL_PROJECT_ID + VERCEL_TOKEN
Web Searchai.tools.webSearch.enabledTAVILY_API_KEY or FIRECRAWL_API_KEY
URL Retrievalai.tools.urlRetrieval.enabledFIRECRAWL_API_KEY
MCP Connectorsai.tools.mcp.enabledMCP_ENCRYPTION_KEY
Image Generationai.tools.image.enabledBLOB_READ_WRITE_TOKEN
Video Generationai.tools.video.enabledBLOB_READ_WRITE_TOKEN
Deep Researchai.tools.deepResearch.enabledTAVILY_API_KEY or FIRECRAWL_API_KEY
Follow-up Suggestionsai.tools.followupSuggestions.enabledUses your configured language model provider
Attachmentsfeatures.attachmentsBLOB_READ_WRITE_TOKEN
ai: {
  tools: {
    webSearch: { enabled: true },          // Requires TAVILY_API_KEY or FIRECRAWL_API_KEY
    urlRetrieval: { enabled: false },      // Requires FIRECRAWL_API_KEY
    codeExecution: { enabled: true },      // Vercel-native
    mcp: { enabled: false },               // Requires MCP_ENCRYPTION_KEY
    image: { enabled: true },              // Requires BLOB_READ_WRITE_TOKEN
    video: { enabled: false },             // Requires BLOB_READ_WRITE_TOKEN
    deepResearch: { enabled: false },      // Requires search provider
    followupSuggestions: { enabled: true } // Uses selected provider/model
  },
},
features: {
  attachments: true, // Requires BLOB_READ_WRITE_TOKEN
},

Authentication

Set to true to enable providers. Missing env vars are caught at server startup.
authentication: {
  google: false, // Requires AUTH_GOOGLE_ID + AUTH_GOOGLE_SECRET
  github: true,  // Requires AUTH_GITHUB_ID + AUTH_GITHUB_SECRET
  vercel: false, // Requires VERCEL_APP_CLIENT_ID + VERCEL_APP_CLIENT_SECRET
},

Branding

Customize app name and organization details:
appName: "ChatJS",
appTitle: "ChatJS - The prod ready AI chat app",
appPrefix: "chatjs",

organization: {
  name: "Your Company",
  contact: {
    privacyEmail: "privacy@example.com",
    legalEmail: "legal@example.com",
  },
},

Deep Research

Configure the deep research pipeline in ai.tools.deepResearch:
ai: {
  tools: {
    deepResearch: {
      enabled: true,                   // Requires webSearch provider config
      defaultModel: "openai/gpt-5-mini",
      finalReportModel: "openai/gpt-5-mini",
      allowClarification: true,        // Ask clarifying questions before starting
      maxResearcherIterations: 1,      // Supervisor loop iterations
      maxConcurrentResearchUnits: 2,   // Topics researched in parallel
      maxSearchQueries: 2,             // Queries per research topic
    },
  },
},
See Deep Research for usage details.

Using Config in Components

Import directly in both server and client components:
import { config } from "@/lib/config";

export function MyComponent() {
  return <div>{config.appName}</div>;
}
See Config Reference for full type definitions.