API Reference

Documentation

Everything you need to integrate Pawan.Krd into your application.

OpenAI SDK

Pawan.Krd is fully compatible with the official OpenAI SDK. Just change the baseURL and apiKey - no other changes needed.

💻Install
npm install openai
📘TypeScript / JavaScript
1import OpenAI from "openai"; 2 3const client = new OpenAI({ 4 baseURL: "https://api.pawan.krd/v1", 5 apiKey: "pk-your_key", 6}); 7 8const response = await client.chat.completions.create({ 9 model: "your-model-id", 10 messages: [{ role: "user", content: "Hello!" }], 11}); 12 13console.log(response.choices[0].message.content);

Streaming

📘Streaming with OpenAI SDK
1import OpenAI from "openai"; 2 3const client = new OpenAI({ 4 baseURL: "https://api.pawan.krd/v1", 5 apiKey: "pk-your_key", 6}); 7 8const stream = await client.chat.completions.create({ 9 model: "your-model-id", 10 messages: [{ role: "user", content: "Write a poem" }], 11 stream: true, 12}); 13 14for await (const chunk of stream) { 15 const content = chunk.choices[0]?.delta?.content || ""; 16 process.stdout.write(content); 17}