How does Leiolai continuous generation work?
Leiolai’s experimental continuous-generation API has no fixed output-token ceiling. Open a session, read the response stream, and use its session ID to add instructions, update an image, or stop generation. Leiolai API input and output tokens are billed at the rates for your selected mode and effort. Generation ends when stopped or when the available balance or API budget is exhausted.
Read the Leiolai API reference
Which API endpoint opens a continuous session?
Use POST /v1/infinite/chat/completions with the model ID leiolai-1 and opening messages. The endpoint always returns server-sent events. Choose the permitted mode and thinking effort for the key, and use a client that retains the event types described in the docs.
How do I identify the session for later updates?
The first event from a Leiolai continuous session contains session_id. Keep that value and send updates to POST /v1/infinite/inject?session=<session_id> with the same API key that opened the session.
Live updatesCan I send a new instruction during the response?
Yes. Add a completed message to a Leiolai continuous-generation session using text through the inject endpoint. Send inject requests one at a time, in order. The acknowledgement provides the insertion point so the client can place the new user message between the delivered portions of the answer.
What is the difference between text and text_partial?
Send text for a completed user message. Send text_partial for the complete message so far; each update replaces the previous partial value. Do not send both fields together. When the message is finished, send text to add the completed turn to the Leiolai conversation.
Can I add an image during a continuous session?
Yes. Send a base64 image data URI through the Leiolai inject endpoint to replace the prior live image. The decoded image limit is 8 MiB, and the inject body limit is 12 MiB. Supported inline text files belong in the opening request and cannot be added through inject.
Image inputHow should a client display preview text?
For a Leiolai continuous stream, append choices[0].delta.content to the delivered answer. A lookahead value is the full current preview: replace the old preview rather than append to the answer. An empty lookahead clears the preview. Delivered answer text stays intact.
How do I stop the session?
Send stop: true by itself to the Leiolai inject endpoint, using the session ID and the key that opened the session. The stream ends with data: [DONE]. A pause in output or an SSE keepalive comment does not end the session.
How is Leiolai continuous generation priced?
Leiolai API input and output tokens have separate rates for each mode and thinking effort. Output charges continue while the session generates a response. The session ends if the available balance or API budget is exhausted.
Token cost estimatesIs a finite response with stream enabled continuous generation?
No. Finite Leiolai Chat Completions, Responses, Messages, and text Completions streams use their own response fields and terminal events. The continuous endpoint is a Leiolai extension with session and inject controls.
Finite streaming contracts