Kiwi

Messages

POST https://api.sed1t.com/v1/messages sends a conversation and returns Kiwi's next message. It follows the shape of the Anthropic Messages protocol, with a few Kiwi additions.

Authentication

Send your key in the x-api-key header, or as Authorization: Bearer sk-kiwi-.... A request without a valid key gets 401. Revoked and expired keys do not work, and neither does a key of an account that was deleted.

Request body

FieldTypeNotes
max_tokensinteger, requiredThe most tokens in the answer. A positive integer; a request without it gets 400.
messagesarray, requiredThe conversation so far, oldest first. Each item has role (user or assistant) and content, a string or a list of blocks. Any other role is treated as user. The API keeps no conversation for you, so send the whole history each time.
systemstring or list of text blocksYour instructions. They are added to Kiwi's own instructions, they do not replace them.
modelstringAccepted and ignored. There is one model, k1, and every request goes to it.
streambooleanSend the answer as server-sent events as it is written. See Streaming.
temperaturenumberPassed to the model.
top_p, top_knumberPassed to the model.
stop_sequencesarray of stringsThe answer stops before any of them. When it stops that way stop_reason is stop_sequence.
toolsarrayFunctions Kiwi may ask you to call. See Tools.
tool_choiceobject{"type":"auto"} (the default), {"type":"any"} to require a tool call, {"type":"tool","name":"..."} to require one tool, {"type":"none"} to turn tools off for the request.
session_idstringOptional name for the conversation. Two requests with the same name cannot run at the same time (the second gets 409). Left out, one is made from your first message.

Kiwi's own fields

These are optional, and a value that is not in the list is ignored.

FieldValuesWhat it does
effortlow, medium (default), high, maxHow much care and exploration Kiwi puts in. The same setting as the effort slider in the apps.
thinkingoff, on, auto (default)Whether Kiwi thinks before it answers. A string, not the object the Anthropic API takes; an object is ignored.
tool_accessauto (default), on_demand, always, offWhether Kiwi may use its own tools (web search, running code, files in your account's private folder). off answers from knowledge only.
searchon (default), offWhether Kiwi may search the web.
stylenormal (default), learning, concise, explanatory, formalThe tone and length of answers.

What goes in content

Text blocks ({"type":"text","text":"..."}) are what Kiwi reads. Image blocks are skipped: the API does not take images. Tool calls and tool results from earlier turns are given to Kiwi as plain text, which is enough for it to follow the conversation.

Response

{
  "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 }
}
FieldNotes
contentA list of blocks: text blocks with the answer, and tool_use blocks when Kiwi asks you to call one of your tools.
stop_reasonend_turn (finished), max_tokens (cut off at your limit), tool_use (it wants a tool called), stop_sequence.
usageinput_tokens and output_tokens. When the model does not report them they are estimated.

It is Kiwi, not a bare model

A request runs Kiwi's own loop on the server: Kiwi's instructions are added, and unless you set tool_access to off it may search the web or run code to answer, and that happens before you see the reply. The answer you get is the finished one. Requests are screened by the same safety checks as the chat, and the Usage Policy applies to what you send.