---
title: "serve"
sidebar_label: "serve"
description: "Kotlin binding reference: serve."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.modelverse](../index.md)/[Modelverse](index.md)/[serve](serve.md)

# serve

[common]\
fun [serve](serve.md)(model: [GenerativeModel](../GenerativeModel/index.md), options: [ServeOptions](../ServeOptions/index.md) = ServeOptions()): [Server](../Server/index.md)

A [Server](../Server/index.md) over a loaded [model](serve.md) under [options](serve.md), not yet listening ([Server.start](../Server/start.md)). The server holds the model: the model's `close()` refuses until the server is closed.

[common]\
fun [serve](serve.md)(task: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), source: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), loadOptions: [LoadOptions](../LoadOptions/index.md) = LoadOptions(), options: [ServeOptions](../ServeOptions/index.md) = ServeOptions()): [Server](../Server/index.md)

A [Server](../Server/index.md) over the model [source](serve.md) loads as (through [AutoModel.fromPretrained](../AutoModel/fromPretrained.md) with [task](serve.md), `text-generation` by default), not yet listening. The server owns nothing more than any other: the loaded model is answered through [Server.model](../Server/model.md) and is the caller's to close after the server.