Kiwi

Quickstart

From nothing to a first answer from your own code.

1. Make an account

Sign in at sed1t.com/auth with Google or with a code sent to your email. If you come from "Kiwi API", the API keys window opens right after you sign in.

2. Make a key

In the chat, open the menu under your name and choose Get API keys (it is also at chat.sed1t.com/api-keys). Give the key a name and create it. A key looks like sk-kiwi-... and is shown once, when you make it, so keep it somewhere safe. If it leaks, revoke it in the same window and make another.

Keep the key out of web pages and apps that other people can open: anyone who has it can use Kiwi as you. Call the API from a server or from your own machine.

3. Send a request

Put the key in an environment variable and send a message.

export KIWI_API_KEY="sk-kiwi-..."
curl https://api.sed1t.com/v1/messages \
  -H "x-api-key: $KIWI_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello, Kiwi"}]
  }'
import os
import requests

r = requests.post(
    "https://api.sed1t.com/v1/messages",
    headers={"x-api-key": os.environ["KIWI_API_KEY"]},
    json={"max_tokens": 1024, "messages": [{"role": "user", "content": "Hello, Kiwi"}]},
    timeout=600,
)
r.raise_for_status()
data = r.json()
print("".join(b["text"] for b in data["content"] if b["type"] == "text"))
const res = await fetch("https://api.sed1t.com/v1/messages", {
  method: "POST",
  headers: { "x-api-key": process.env.KIWI_API_KEY, "content-type": "application/json" },
  body: JSON.stringify({
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello, Kiwi" }],
  }),
});
if (!res.ok) throw new Error(res.status + " " + (await res.text()));
const data = await res.json();
console.log(data.content.filter((b) => b.type === "text").map((b) => b.text).join(""));

The answer is a JSON message:

{
  "id": "msg_3f0c1a7e5b2d4c96a1e8f0b2",
  "type": "message",
  "role": "assistant",
  "content": [{ "type": "text", "text": "Hello! What can I do for you?" }],
  "model": "k1",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": { "input_tokens": 9, "output_tokens": 11 }
}

Kiwi writes one answer at a time, so a request can wait while another is being written, and a long answer takes time. Allow minutes, not seconds, for the timeout. Streaming shows the text as it is written.

Next

Read the Messages reference for every field, Tools to let Kiwi call your functions, and Errors and limits before you build anything that retries.