---
title: OpenAI
---

## Create chat completion

With the OpenAI block, you can create a chat completion based on your user queries and display the answer back to your typebot.

<Frame>
  <img
    src="/images/blocks/integrations/openai/overview.png"
    alt="OpenAI block"
  />
</Frame>

This integration comes with a convenient message type called **Dialogue**. It allows you to easily pass a sequence of saved assistant / user messages history to OpenAI:

<Frame>
  <img
    src="/images/blocks/integrations/openai/append-to-history.png"
    alt="OpenAI messages sequence"
  />
</Frame>

Then you can give the OpenAI block access to this sequence of messages:

<Frame>
  <img
    src="/images/blocks/integrations/openai/dialogue-usage.png"
    alt="OpenAI messages sequence"
  />
</Frame>

## Create speech

This action allows you to transform a text input into an audio URL that you can reuse in your bot.

:::note
The generated audio URLs are temporary and expire after 7 days. If you need to store them, make sure to download them before they expire.
:::

<div
  style={{
    position: 'relative',
    paddingBottom: '64.5933014354067%',
    height: 0,
  }}
>
  <iframe
    src="https://www.loom.com/embed/ccca6cbf16ed4d01b513836775db06a3?sid=22a54baa-000b-435a-b770-bfaf32bfe453"
    allowFullScreen
    style={{
      position: 'absolute',
      top: 0,
      left: 0,
      width: '100%',
      height: '100%',
      marginBottom: '1rem',
    }}
  />
</div>

## Using Multiple Open AI Blocks: Tips and Tricks

In this video, I discuss some important things to keep in mind when using multiple Open AI blocks consecutively. I provide an example where we ask the user for a topic, generate a summary, and display a list of authors.

I explain that streaming messages is not possible when they are prefixed or suffixed by text, and that all blocks need to compute before displaying anything.

I also demonstrate how formatting can be affected by the presence of text before a message. Watch this video to learn how to optimize your use of multiple Open AI blocks.

<div
  style={{
    position: 'relative',
    paddingBottom: '64.63195691202873%',
    height: 0,
  }}
>
  <iframe
    src="https://www.loom.com/embed/35dc8af6b9244762acc4a5acf275fb43?sid=3723aa59-13ac-49f2-a95b-5608807ac76d"
    allowFullScreen
    style={{
      position: 'absolute',
      top: 0,
      left: 0,
      width: '100%',
      height: '100%',
    }}
  ></iframe>
</div>

## Troobleshooting

### Error message: "OpenAI block returned error"

It means your OpenAI block is not configured properly. Please check the following:

- You have selected an OpenAI account
- You have at least 1 **user** message or a **Dialogue** message set up.

### It returns an empty message

It most likely mean that you exceeded your OpenAI free quota. Add a payment method to your OpenAI account to continue using it.
