Skip to main content
There is no chat() function. Single-turn generation is RunAnywhere.generate(prompt, options). Multi-turn conversations pass prior messages through LLMGenerateRequest.history. All LLM entry points are suspend extension functions on RunAnywhere, imported from com.runanywhere.sdk.public.extensions.

Single turn

generate returns LLMGenerationResult. Wire-generated proto fields are snake_case: result.text, result.tokens_per_second, result.input_tokens, result.tokens_generated, result.generation_time_ms.

Multi-turn

MessageRole values: MESSAGE_ROLE_UNSPECIFIED, MESSAGE_ROLE_USER, MESSAGE_ROLE_ASSISTANT, MESSAGE_ROLE_SYSTEM, MESSAGE_ROLE_TOOL, MESSAGE_ROLE_DEVELOPER. Wire generates plain classes with all-defaulted constructor parameters plus copy(). Use named arguments; there is no builder.

System prompt

Keep the persona on the options rather than in history so history trimming cannot drop it.

Conversation cache

A stable conversation_id lets backends that keep a prompt cache reuse it across turns.

Streaming a turn

generateStream returns a Flow<LLMStreamEvent> and is not a suspend function.

Trimming history