> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runanywhere.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# chat()

> Simple one-liner for quick text responses

The simplest way to generate text—a single function call that returns the response directly.

```kotlin theme={null}
// One-liner for quick responses
val response = RunAnywhere.chat("What is the capital of France?")
println(response)  // "The capital of France is Paris."
```

## When to Use

Use `chat()` when you need:

* Quick, simple responses
* No metrics or metadata
* Minimal code

For more control, use [`generate()`](/kotlin/llm/generate) or [`generateStream()`](/kotlin/llm/stream).

## Example: Simple Q\&A

```kotlin theme={null}
lifecycleScope.launch {
    try {
        val answer = RunAnywhere.chat("Explain machine learning in one sentence")
        textView.text = answer
    } catch (e: SDKError) {
        showError(e.message)
    }
}
```

## Example: Chat Bot

```kotlin theme={null}
suspend fun sendMessage(userMessage: String): String {
    // Ensure model is loaded
    if (!RunAnywhere.isLLMModelLoaded()) {
        RunAnywhere.loadLLMModel(modelId)
    }

    return RunAnywhere.chat(userMessage)
}
```

<Note>
  `chat()` uses default generation options. For custom temperature, max tokens, or system prompts,
  use [`generate()`](/kotlin/llm/generate) instead.
</Note>
