Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 26.5 KB

internchatcompletionchunk.mdx

File metadata and controls

19 lines (15 loc) · 26.5 KB
title InternChatCompletionChunk

One data: line of the stream. A run streams a role chunk, content and reasoning chunks, then a finish chunk: stop, tool_calls (the run is paused for input) or error (with an error object). A final chunk with empty choices follows in every case, carrying session_id and usage (null unless the daemon reported usage, and always null after tool_calls). Every stream ends with [DONE].

Fields

Field Type Required Description Example
choices List[components.InternChatChoice] ✔️ One choice on content, tool-call and error chunks. Empty on the final chunk that carries session_id.
created int ✔️ N/A
error Optional[components.InternChatStreamError] ➖ A failure after the response headers were sent. The chunk that carries it has finish_reason: "error", then the final empty-choices chunk and [DONE] follow. Reasons here are attachment_failed, busy, client_closed_request, interaction_not_pending, interaction_unknown, intern_unreachable, run_ended, stream_severed, timeout or turn_failed. run_ended reports an ending the intern confirmed, such as a cancellation or a deadline, while stream_severed reports a connection lost without that confirmation. {
"code": 502,
"message": "The intern could not continue this run.",
"metadata": {
"reason": "attachment_failed",
"retryable": false
}
}
id str ✔️ The completion id, constant for the whole response. chatcmpl-f727571a-3bad-4e0d-8a9e-f18f8cda9750
model str ✔️ The runtime's identifier for the model the intern is running, as the intern reports it. Each chunk carries the model from the event behind it: openrouter/intern on chunks emitted before the intern has reported one and on chunks the API emits itself (timeout, run-ended and severed-stream errors and their final usage chunk), even after an earlier chunk named a model. It can change within a stream. It is not an OpenRouter model slug, and the request model is never used.
object components.InternChatCompletionChunkObject ✔️ N/A
session_id OptionalNullable[str] ➖ On the final chunk of every response, the daemon session to continue with, or null when the run failed before the intern reported one. Send it as session_id on the next request, including the tool reply to an interaction. Session ids are client-visible and scoped to the intern's own daemon. ses_7f3c9a
usage OptionalNullable[components.InternChatUsage] ➖ Token usage for the run as the daemon reported it, on the final chunk before [DONE]. null when the daemon reported none, and always null after tool_calls because the turn is not over. {
"completion_tokens": 12,
"prompt_tokens": 40,
"total_tokens": 52
}