Completion API is fully compatible with OpenAI SDK Python and Typescript.
import OpenAI from "openai";
const openaiClient = new OpenAI({
apiKey: "<kirha_api_key>",
baseURL: "https://api.kirha.ai/chat/v1/openai",
});
const response = await openaiClient.chat.completions.create({
model: "kirha-flash:crypto",
messages: [
{ role: "system", content: "You are a helpful crypto assistant." },
{ role: "user", content: "give me the balance of vitalik.eth" }
],
stream: true,
});
for await (const chunk of response) {
if (chunk.choices[0].delta.content) {
console.log(chunk.choices[0].delta.content);
}
}