Integrations · JavaScript

Next.js API Routes

Integrate XALEN API into Next.js applications using API routes. Server-side AI calls with edge runtime support.

1. Install

npm install xalen-sdk

2. Code

// app/api/chat/route.ts
#89B4FA;">import XALEN from 'xalen-sdk';

#89B4FA;">const client = new XALEN({ apiKey: process.env.XALEN_API_KEY });

#89B4FA;">export async function POST(req) {
  #89B4FA;">const { messages } = await req.json();
  #89B4FA;">const response = await client.chat.completions.create({
    model: 'vedika-standard',
    messages,
    stream: true
  });
  #89B4FA;">return new Response(response.toReadableStream());
}

Related Tutorials

Build a React Chatbot Integrations · JavaScript Flutter Integration Integrations · Dart LangChain Integration Integrations · Python LlamaIndex Integration Integrations · Python Python Quickstart Getting Started · Python JavaScript Quickstart Getting Started · JavaScript

200+ AI models. One API. Start building in 5 minutes.

Get API Key

Last updated: 2026-05-21