Introducing FastRTC, a new way to build real-time AI apps

Read More
  1. Helpers
  2. load_chat

New to Gradio? Start here: Getting Started

See the Release History

load_chat

gradio.load_chat(ยทยทยท)

Description

Load a chat interface from an OpenAI API chat compatible endpoint.

Example Usage

import gradio as gr
demo = gr.load_chat("http://localhost:11434/v1", model="deepseek-r1")
demo.launch()

Initialization

Parameters
๐Ÿ”—
base_url: str

The base URL of the endpoint, e.g. "http://localhost:11434/v1/"

๐Ÿ”—
model: str

The name of the model you are loading, e.g. "llama3.2"

๐Ÿ”—
token: str | None
default = None

The API token or a placeholder string if you are using a local model, e.g. "ollama"

๐Ÿ”—
file_types: Literal['text_encoded', 'image'] | list[Literal['text_encoded', 'image']] | None
default = "text_encoded"

The file types allowed to be uploaded by the user. "text_encoded" allows uploading any text-encoded file (which is simply appended to the prompt), and "image" adds image upload support. Set to None to disable file uploads.

๐Ÿ”—
system_message: str | None
default = None

The system message to use for the conversation, if any.

๐Ÿ”—
streaming: bool
default = True

Whether the response should be streamed.

๐Ÿ”—
kwargs: <class 'inspect._empty'>

Additional keyword arguments to pass into ChatInterface for customization.