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
| Field | Type | Notes |
|---|---|---|
max_tokens | integer, required | The most tokens in the answer. A positive integer; a request without it gets 400. |
messages | array, required | The 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. |
system | string or list of text blocks | Your instructions. They are added to Kiwi's own instructions, they do not replace them. |
model | string | Accepted and ignored. There is one model, k1, and every request goes to it. |
stream | boolean | Send the answer as server-sent events as it is written. See Streaming. |
temperature | number | Passed to the model. |
top_p, top_k | number | Passed to the model. |
stop_sequences | array of strings | The answer stops before any of them. When it stops that way stop_reason is stop_sequence. |
tools | array | Functions Kiwi may ask you to call. See Tools. |
tool_choice | object | {"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_id | string | Optional 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.
| Field | Values | What it does |
|---|---|---|
effort | low, medium (default), high, max | How much care and exploration Kiwi puts in. The same setting as the effort slider in the apps. |
thinking | off, on, auto (default) | Whether Kiwi thinks before it answers. A string, not the object the Anthropic API takes; an object is ignored. |
tool_access | auto (default), on_demand, always, off | Whether Kiwi may use its own tools (web search, running code, files in your account's private folder). off answers from knowledge only. |
search | on (default), off | Whether Kiwi may search the web. |
style | normal (default), learning, concise, explanatory, formal | The 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 }
}| Field | Notes |
|---|---|
content | A list of blocks: text blocks with the answer, and tool_use blocks when Kiwi asks you to call one of your tools. |
stop_reason | end_turn (finished), max_tokens (cut off at your limit), tool_use (it wants a tool called), stop_sequence. |
usage | input_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.