AI Integration

We integrated OpenRouter to enable AI-powered features such as chat, content generation, or other intelligent tools via API.

Connect your OpenRouter account

1
Go to `OpenRouter.ai` and sign in or create an account.
2
Navigate to your API Keys section.
3
Generate a new API key (you may only see it once — make sure to copy and store it safely).
4
Select a default model to use, such as `openai/gpt-4`, `mistralai/mixtral-8x7b`, or any available LLM based on your use case.
5
Add it to your project

Add your API key to /app/dashboard/ai/page.tsx

page.tsx
  const res = await fetch("https://openrouter.ai/api/v1/chat/completions", {
      method: "POST",
      headers: {
        Authorization: "Bearer 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",
        "Content-Type": "application/json",
        "HTTP-Referer": "https://your-site.com",
        "X-Title": "Your AI Boilerplate"
      },
      body: JSON.stringify({
        model: "deepseek/deepseek-prover-v2:free",
        messages: [
          {
            role: "user",
            content: prompt
          }
        ]
      })
    });