Can I add new context while Leiolai is generating?
Yes. Experimental Leiolai continuous generation lets a client add new messages, growing text, or an updated image while a response continues. Open a continuous session, keep the returned session ID, and send updates using the same API key. Delivered answer text and the optional replaceable preview have separate event fields.
Read the Leiolai API reference
How do I open a session that accepts live updates?
Open a Leiolai session with POST /v1/infinite/chat/completions. Send model: leiolai-1, opening messages, effort, and mode when required by the key. The endpoint returns server-sent events; its first session event supplies session_id for later updates.
Continuous session basicsWhere do I send the next update?
Send a POST request to /v1/infinite/inject?session=<session_id> with the same Leiolai API key that opened the session. Send updates one at a time in the intended order, and retain each acknowledgement.
How do I add a complete new message?
Send the text field through Leiolai’s continuous-generation inject endpoint to add a completed message. Use a new message for an instruction, correction, or fact added after generation starts.
How do I send text that is still being typed?
Send text_partial with the complete text typed so far. Each Leiolai update replaces the previous partial value, so send the whole current draft. When finished, send text for the completed message. Do not send text and text_partial together.
How do I update an image during a session?
Send a base64 data URI in the Leiolai injection’s image field. The new image replaces the previous live image. The decoded image limit is 8 MiB, and the request body limit is 12 MiB.
Supply image data in the right formatShould I append the lookahead preview to the answer?
No. Append choices[0].delta.content to the delivered Leiolai answer. Show lookahead separately as a preview: each value replaces the whole preview, and an empty value clears the preview. The delivered answer stays intact.
What does an update acknowledgement identify?
A Leiolai injection acknowledgement supplies an ID, sequence, and an anchor measured in UTF-8 bytes. Use the anchor to place the accepted user update among the delivered answer text. For multibyte text, the byte offset differs from the character count.
Can I inject a file after the session begins?
No. Send supported inline files in the Leiolai session’s opening messages. Later inject requests accept the documented text and image updates, not file uploads.
Prepare long text and document inputsHow do I stop the session and control costs?
Send stop: true by itself to the Leiolai inject endpoint. The session also ends when the available balance or API budget is exhausted.
Token usage and continuous-session billing