configure-chatkit

Configure OpenAI ChatKit in a Next.js frontend with environment setup and API integration.

Updated Jan 14, 2026
One-click install
npx skills add https://github.com/SyedaNabila559/phase2-3-todo-full-web-with-ai-chatbot --skill configure-chatkit-syedanabila559
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: configure-chatkit
Source: https://github.com/SyedaNabila559/phase2-3-todo-full-web-with-ai-chatbot/tree/main/.claude/skills/configure-chatkit
Command: npx skills add https://github.com/SyedaNabila559/phase2-3-todo-full-web-with-ai-chatbot --skill configure-chatkit-syedanabila559

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps frontend teams rapidly configure and integrate OpenAI ChatKit into a Next.js application, removing repetitive setup tasks and ensuring consistent authentication, domain allowlisting, and a polished chat UI.

Core Features & Use Cases

  • Environment configuration: Add domain allowlist keys and keys to environment files to securely run ChatKit in your app.
  • UI component: Build a reusable chat widget that communicates with your backend via /api/chat and displays messages, history, and tool calls.
  • Authentication integration: Tie ChatKit interactions to Better Auth session to protect chat data.
  • API integration: Post user messages to the /api/chat endpoint with a conversation_id to maintain context across messages.
  • Use cases: Ideal for building customer support chats, internal assist apps, or AI chatbots embedded in Next.js frontends.

Quick Start

  • Add environment keys to .env.local: NEXT_PUBLIC_CHAT_KIT_PUBLIC_KEY=your_chatkit_public_key CHAT_KIT_SECRET=your_chatkit_secret_key CHAT_KIT_INSTANCE_ID=your_instance_id NEXT_PUBLIC_ALLOWED_DOMAINS=localhost:3000,yourdomain.com
  • Implement the ChatWidget component and wrap the app with the Better Auth session provider.
  • Ensure the frontend posts messages to /api/chat with a current conversation_id and handles responses, including history and tool calls.

Frequently Asked Questions about configure-chatkit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate OpenAI ChatKit into a Next.js frontend?▼

To integrate OpenAI ChatKit into a Next.js frontend, add your domain allowlist and API keys to the environment, build a chat widget, and post messages with a conversation_id to the /api/chat endpoint.

What environment variables do I need to configure ChatKit with Better Auth?▼

Configuring ChatKit with Better Auth requires setting NEXT_PUBLIC_CHAT_KIT_PUBLIC_KEY, CHAT_KIT_SECRET, CHAT_KIT_INSTANCE_ID, and NEXT_PUBLIC_ALLOWED_DOMAINS in your environment files to secure sessions.

Can I use Better Auth session to protect my Next.js chat UI history?▼

Yes, you can wrap your Next.js application with the Better Auth session provider to authenticate ChatKit interactions and protect your chat UI conversation history and tool calls.

How do I maintain conversation context when posting messages to /api/chat in Next.js?▼

To maintain conversation context in Next.js, your frontend must post user messages to the /api/chat endpoint along with a current conversation_id to handle responses and history accurately.

Does OpenAI ChatKit support tool calls visualization in a Next.js UI component?▼

Yes, building a reusable chat UI component with OpenAI ChatKit supports displaying messages, conversation history, and tool calls visualization within your Next.js frontend application.

What is the best way to allowlist domains for a Next.js AI chatbot?▼

The best way to allowlist domains for a Next.js AI chatbot is to specify allowed URLs like localhost:3000 and yourdomain.com in the NEXT_PUBLIC_ALLOWED_DOMAINS environment variable.