Quickstart

Make your first request in under a minute.
View as Markdown

Kontinent’s data plane is OpenAI-compatible. If you already talk to OpenAI, you change two things: the base URL and the API key.

1. Set your base URL and key

1import OpenAI from "openai";
2
3const client = new OpenAI({
4 baseURL: "https://api.kontinent.ai/v1",
5 apiKey: process.env.KONTINENT_API_KEY, // sk-kt-…
6});

Local development runs the gateway at http://localhost:4000. The dev stack seeds a key automatically — see the repository README.

2. Send a chat completion

1const res = await client.chat.completions.create({
2 model: "mistral/mistral-large-latest",
3 messages: [{ role: "user", content: "Hallo!" }],
4});
5console.log(res.choices[0].message.content);

3. Stream the response

Set stream: true to receive Server-Sent Events as the model generates.

TypeScript
1const stream = await client.chat.completions.create({
2 model: "mistral/mistral-small-latest",
3 messages: [{ role: "user", content: "Write a haiku about Europe." }],
4 stream: true,
5});
6
7for await (const chunk of stream) {
8 process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
9}

See Streaming for the SSE wire format and timeout behavior.

Next steps