Introduction

Amkyaw AI is a next-generation AI assistant built with Next.js 14, Groq SDK, and modern design principles. It features ultra-fast token streaming, context-aware conversations, and a beautiful glassmorphism UI.

Quick Start

# Clone the repository
git clone https://github.com/amkyawdev/ai-app.git

# Install dependencies
npm install

# Set environment variable
echo "GROQ_API_KEY=your_api_key" > .env.local

# Run development server
npm run dev

Token Streaming

Amkyaw AI uses ReadableStream to stream tokens in real-time, providing an instant feedback experience.

const response = await fetch('/api/chat', {
  method: 'POST',
  body: JSON.stringify({ messages }),
});

const reader = response.body.getReader();
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  const chunk = decoder.decode(value);
  // Process chunk in real-time
}

API Reference

POST /api/chat

Send a message and receive AI response.

Request Body

{
  messages: [
    { role: 'user', content: 'Hello!' }
  ]
}