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

# OpenAI

> Connect OpenAI to Rocket and add GPT-powered AI to your app - from chat assistants and content generators to search and summarization.

export const LlmsDirective = () => <blockquote className="llms-directive">
    For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
    For a lightweight markdown version of this page, append .md to the URL.
  </blockquote>;

<LlmsDirective />

Connect your OpenAI API key and describe the AI feature you need in chat. Rocket handles all the integration code automatically so you can focus on what your features should do.

<Note>
  This connector is only available for **Next.js TypeScript** web build tasks.
</Note>

<Divider />

## What you can do

<CardGroup cols={2}>
  <Card title="AI chat assistant" icon="comments">
    Conversational chatbot that answers questions, provides recommendations, or guides users through workflows.
  </Card>

  <Card title="Content generation" icon="pen-nib">
    Let users generate blog posts, marketing copy, product descriptions, or social media content from simple prompts.
  </Card>

  <Card title="Document summarizer" icon="file-lines">
    Upload documents or paste text and get concise summaries, key takeaways, or action items automatically.
  </Card>

  <Card title="AI-powered search" icon="magnifying-glass">
    Semantic search that understands user intent instead of just matching keywords.
  </Card>

  <Card title="Customer support bot" icon="headset">
    Automate first-line support with a bot that answers FAQs, triages issues, and escalates complex requests.
  </Card>
</CardGroup>

<Divider />

## Before you connect

You need an OpenAI API key.

<Card icon="arrow-up-right-from-square" horizontal href="https://platform.openai.com/api-keys" arrow="true">
  Get your OpenAI API key from the dashboard
</Card>

<Warning>
  Never paste your API key directly into chat. Always use the secure connector popup. If your key is exposed, rotate it immediately from the OpenAI dashboard.
</Warning>

<Note>
  OpenAI is a **task-level** connector. Each Rocket task connects to its own API key independently.
</Note>

<Divider />

## Connect OpenAI

<Tabs>
  <Tab title="Web Browser">
    You can connect from two places - both open the same popup.

    **Option 1: From chat**

    Type a prompt that mentions OpenAI or GPT - for example, `Connect OpenAI and add a GPT-powered chat assistant to my app`. Rocket detects the intent and shows a **Connect** button inline. Click it and the popup opens.

    <Frame caption="OpenAI connection prompt in chat">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/sC1V0MCOzqVaM3we/images/build-docs/connectors/openai/web-browser/openai-chat-light.webp?fit=max&auto=format&n=sC1V0MCOzqVaM3we&q=85&s=30c0313304666b81d1a39c6c0db63e00" alt="OpenAI connection prompt in the Rocket chat panel." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/connectors/openai/web-browser/openai-chat-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/sC1V0MCOzqVaM3we/images/build-docs/connectors/openai/web-browser/openai-chat-dark.webp?fit=max&auto=format&n=sC1V0MCOzqVaM3we&q=85&s=d8760666b567a0a2c2f02933880c6984" alt="OpenAI connection prompt in the Rocket chat panel." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/connectors/openai/web-browser/openai-chat-dark.webp" />
    </Frame>

    **Option 2: From the Connectors tab**

    Click the **`...`** button in the preview toolbar, then select **Connectors**.

    <Frame caption="Open Connectors from the toolbar">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/2lqYWidv_xVHKfL6/images/build-docs/connectors/shared/connectors-tab-open-light.webp?fit=max&auto=format&n=2lqYWidv_xVHKfL6&q=85&s=7bd785a0e878564054e08328b2aa3d6b" alt="Toolbar dropdown with Connectors option highlighted." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/connectors/shared/connectors-tab-open-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/2lqYWidv_xVHKfL6/images/build-docs/connectors/shared/connectors-tab-open-dark.webp?fit=max&auto=format&n=2lqYWidv_xVHKfL6&q=85&s=d047040372d776cb47e4e483de8eeb8d" alt="Toolbar dropdown with Connectors option highlighted." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/connectors/shared/connectors-tab-open-dark.webp" />
    </Frame>

    Click the **OpenAI** card, then click **Connect**.

    <Frame caption="OpenAI card in the Connectors panel">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/sC1V0MCOzqVaM3we/images/build-docs/connectors/openai/web-browser/openai-connectors-tab-light.webp?fit=max&auto=format&n=sC1V0MCOzqVaM3we&q=85&s=58e32e2ae03ab024139b9072a2d900c7" alt="Connectors panel showing the OpenAI card with a Connect button." className="theme-image light-image" width="1816" height="519" data-path="images/build-docs/connectors/openai/web-browser/openai-connectors-tab-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/sC1V0MCOzqVaM3we/images/build-docs/connectors/openai/web-browser/openai-connectors-tab-dark.webp?fit=max&auto=format&n=sC1V0MCOzqVaM3we&q=85&s=a451486a51d5c936b98b1a15ead33039" alt="Connectors panel showing the OpenAI card with a Connect button." className="theme-image dark-image" width="1817" height="544" data-path="images/build-docs/connectors/openai/web-browser/openai-connectors-tab-dark.webp" />
    </Frame>

    **After clicking Connect**

    A popup opens. Paste your **API key** and click **Connect**.

    <Frame caption="Connect OpenAI popup">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/sC1V0MCOzqVaM3we/images/build-docs/connectors/openai/web-browser/openai-popup-light.webp?fit=max&auto=format&n=sC1V0MCOzqVaM3we&q=85&s=ec6516d55b74116ad5761abdc151bca3" alt="Connect OpenAI popup with an API key input field." className="theme-image light-image" width="840" height="500" data-path="images/build-docs/connectors/openai/web-browser/openai-popup-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/sC1V0MCOzqVaM3we/images/build-docs/connectors/openai/web-browser/openai-popup-dark.webp?fit=max&auto=format&n=sC1V0MCOzqVaM3we&q=85&s=bd3a5c5144cc862455119de67db1c536" alt="Connect OpenAI popup with an API key input field." className="theme-image dark-image" width="840" height="500" data-path="images/build-docs/connectors/openai/web-browser/openai-popup-dark.webp" />
    </Frame>

    A green dot appears next to OpenAI when the connection is active.

    **Update or disconnect**

    Go to [**Connectors > OpenAI**](#connect-openai). Click **Edit** to update the key or **Disconnect** to remove the integration.

    <Frame caption="Edit and Disconnect options on a connected OpenAI card">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/sC1V0MCOzqVaM3we/images/build-docs/connectors/openai/web-browser/openai-disconnect-light.webp?fit=max&auto=format&n=sC1V0MCOzqVaM3we&q=85&s=e16a2758a1b8927d9497ba28ca248d04" alt="OpenAI card showing Edit and Disconnect buttons." className="theme-image light-image" width="1813" height="523" data-path="images/build-docs/connectors/openai/web-browser/openai-disconnect-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/sC1V0MCOzqVaM3we/images/build-docs/connectors/openai/web-browser/openai-disconnect-dark.webp?fit=max&auto=format&n=sC1V0MCOzqVaM3we&q=85&s=d8bcedf5ca2ab24fd1eea3de55711282" alt="OpenAI card showing Edit and Disconnect buttons." className="theme-image dark-image" width="1807" height="525" data-path="images/build-docs/connectors/openai/web-browser/openai-disconnect-dark.webp" />
    </Frame>
  </Tab>

  <Tab title="Mobile App">
    You can connect from two places - both open the same popup.

    **Option 1: From chat**

    Type a prompt that mentions OpenAI or GPT. Rocket detects the intent, shows a **Connect** button, and the popup opens when you tap it.

    **Option 2: From the Connectors tab**

    1. Tap the **More** button in the header.
    2. Tap **Integrations**.
    3. Tap the **OpenAI** card, then tap **Connect**.

    **After tapping Connect**

    A popup opens. Paste your **API key** and tap **Done**.

    A green dot appears next to OpenAI when the connection is active.

    **Update or disconnect**

    Go back to the **OpenAI** card in Integrations. Tap **Edit** to update the key or **Disconnect** to remove it from this task.
  </Tab>
</Tabs>

<Divider />

## Example prompts

| What you want        | Prompt to use                                                                                       |
| :------------------- | :-------------------------------------------------------------------------------------------------- |
| Chatbot              | `Add an AI chatbot to my app that answers user questions using OpenAI GPT.`                         |
| Blog writer          | `Build a blog post generator where users enter a topic and get a full draft from GPT.`              |
| Email drafter        | `Create an email composer that generates professional emails from bullet points using GPT.`         |
| Code explainer       | `Add a code explainer tool where users paste code and get a plain-English explanation from OpenAI.` |
| Content moderator    | `Use OpenAI to automatically flag inappropriate user-submitted content before it is published.`     |
| Quiz generator       | `Build a quiz generator that creates multiple-choice questions from any topic using GPT.`           |
| Language translator  | `Add a translation feature that converts user text between languages using OpenAI.`                 |
| Sentiment analyzer   | `Analyze customer feedback sentiment using OpenAI and display results in a dashboard.`              |
| Meeting summarizer   | `Summarize meeting notes into key decisions and action items using GPT.`                            |
| Product descriptions | `Generate product descriptions from basic details like name, category, and features using OpenAI.`  |

<Divider />

## Tips

* **API billing is separate.** OpenAI charges based on token usage. Monitor your spending in the [OpenAI usage dashboard](https://platform.openai.com/usage).
* **Rate limits apply.** New accounts have lower rate limits. Check your [rate limit tier](https://platform.openai.com/docs/guides/rate-limits) and request an increase if needed.
* **Token costs vary by model.** Longer prompts and responses cost more. Keep system prompts concise and set reasonable max token limits.
* **OpenAI vs. Anthropic.** GPT models excel at broad general-purpose tasks, function calling, and vision. Claude is better suited for long-context analysis and tasks requiring careful, detailed reasoning.
* **One API key per task.** Each Rocket task connects to one OpenAI API key independently.

<Divider />

## What's next?

<CardGroup cols={2}>
  <Card title="Anthropic" icon="brain" href="./anthropic">
    Add Claude models for long-context analysis and detailed reasoning alongside GPT.
  </Card>

  <Card title="Gemini" icon="stars" href="./gemini">
    Connect Google's Gemini models for multimodal AI features.
  </Card>

  <Card title="Perplexity" icon="sparkles" href="./perplexity">
    Add real-time web search and up-to-date answers to your AI features.
  </Card>

  <Card title="Supabase" icon="database" href="./supabase/overview">
    Store conversation history, user preferences, and AI-generated content.
  </Card>
</CardGroup>
