Agent skill
nextjs-chatkit
Integrate OpenAI ChatKit in Next.js 15 App Router with domain allowlist, authentication, and API connections. Use when building chat interfaces or ChatKit integration.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/nextjs-chatkit
SKILL.md
Next.js ChatKit Integration
Environment Setup
NEXT_PUBLIC_OPENAI_DOMAIN_KEY=your_domain_key
NEXT_PUBLIC_API_URL=http://localhost:8000
Chat Page (app/chat/page.tsx)
'use client';
import { ChatKit } from '@openai/chatkit';
import { useAuth } from '@/lib/auth';
export default function ChatPage() {
const { user, token } = useAuth();
const handleMessage = async (message: string, conversationId?: number) => {
const response = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/api/${user.id}/chat`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
},
body: JSON.stringify({ conversation_id: conversationId, message }),
}
);
const data = await response.json();
return data.response;
};
return (
<ChatKit
domainKey={process.env.NEXT_PUBLIC_OPENAI_DOMAIN_KEY!}
onMessage={handleMessage}
placeholder="Ask me to manage your tasks..."
/>
);
}
Domain Allowlist Setup
- Deploy frontend to get URL (e.g., https://app.vercel.app)
- Add domain at: https://platform.openai.com/settings/organization/security/domain-allowlist
- Copy generated domain key
- Set NEXT_PUBLIC_OPENAI_DOMAIN_KEY in Vercel env vars
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?