AI Module

Module

AI provider management and chatbot functionality using Vercel AI SDK.

Multi-provider support with automatic detection from environment variables. Use this module for AI chat, model selection, and provider management.

Features

Multi-Provider

OpenAI, Anthropic, Google, Mistral, Groq, Perplexity, xAI.

Auto-Detection

Providers enabled automatically from environment variables.

Streaming Chat

Real-time chat interface with conversation history.

Connection Testing

Verify provider connections with simple test prompts.

Environment Variables

# Master toggle
NEXT_PUBLIC_AI_ENABLED=true

# API Keys — set to enable provider
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_GENERATIVE_AI_API_KEY=...

# Models — comma-separated (optional)
OPENAI_MODELS=gpt-4o,gpt-4o-mini,gpt-4-turbo
ANTHROPIC_MODELS=claude-sonnet-4-20250514,claude-3-5-haiku-20241022

Public API

import {
  // Components
  ProviderCard, ProviderList, ProviderTestButton,
  ChatInterface, ModelSelector,

  // Hooks
  useAIProviders, useChatModel,

  // Lib
  getEnabledProviders, AI_PROVIDERS,

  // Types
  type AIProvider, type EnabledProvider, type ProviderId,
} from "@/modules/ai"

Try It

Full Documentation

For complete documentation including all supported providers, API endpoints, and removal instructions, see modules/ai/MODULE-AI.md