Skip to main content

Overview

Multi-turn conversations allow you to maintain context across multiple exchanges by including conversation history in your API requests. This enables the model to understand and reference previous messages, creating natural, coherent dialogues.

Why use multi-turn conversations?

With conversation history, you can:
  • Ask follow-up questions - Ask “What’s the population?” and the model knows you’re referring to Paris from the previous message
  • Build on previous responses - Request clarifications, expansions, or corrections without repeating context
  • Create interactive experiences - Build chatbots, assistants, and conversational interfaces that feel natural

How it works

Each API request includes an array of previous messages. The model uses this history to understand context and maintain coherence across the conversation:
Note: You’re responsible for managing conversation history. Each request must include all relevant previous messages - the API doesn’t store history between requests.

Getting started

Maintain context by including conversation history:

Message types

When building conversation history, you can use the following message types:
  • user - Messages from the user
  • assistant - Messages from the AI model
  • system - System instructions or context
Structure your conversation history with these message types to track the complete interaction flow between the user and model.

API reference

Request

The LLM Gateway accepts POST requests to https://llm-gateway.assemblyai.com/v1/chat/completions with the following parameters:

Request parameters

Message object

Content part object

Response

The API returns a JSON response with the model’s completion:

Response fields

Error response

If an error occurs, the API returns an error response:

Common error codes