# Connect OpenAI

> Connect an OpenAI API key to your app, build a conversational feature and test its responses in the native preview.

Canonical: https://www.rnblocks.dev/docs/connectors/openai
Updated: 2026-10-01

Add an AI assistant or text-generation feature using your OpenAI API account. Start with a short text request so you can verify the connection before adding more complex inputs.

## Before you start

- An app in Studio.
- An OpenAI API account with access and available quota for the model your app will use.

## Create a key for the app

Section: https://www.rnblocks.dev/docs/connectors/openai#key

Sign in to the [OpenAI API dashboard](https://platform.openai.com/api-keys), select the intended project and create a key for this app. Keep the key private. The [OpenAI quickstart](https://developers.openai.com/api/docs/quickstart) links to the current key-creation flow.

> **Use an API credential**
> The connector takes an OpenAI API key. Signing in to ChatGPT does not connect your RNBlocks app or import your personal ChatGPT conversations.


## Connect OpenAI to this app

Section: https://www.rnblocks.dev/docs/connectors/openai#connect

1. **Open the app in Studio** — Select **App options (+) → Connectors → OpenAI**. A **Connect OpenAI** request in the conversation opens the same setup. Connections belong to the app you have open.

2. **Save the credential privately** — Paste your credential into **API Key** and select **Save**. Keep it out of the conversation and app source. RNBlocks stores the credential for this app; the saved value is masked in this form.

3. **Return to your conversation** — Close the connection panel and continue the feature you requested. **Connected** means a credential is saved; the feature still needs a successful request and a test in your app.

### Figure: Connect OpenAI, step by step

App options (+) opens Connectors. Choose OpenAI, enter its API Key privately and select Save. The saved view masks the value and shows Connected.

1. **App options** — The actual App options menu above the + button. It contains separate Supabase, Connectors and App memory actions.

2. **Choose a service** — The Connectors catalogue contains OpenAI, Anthropic, Groq, ElevenLabs and Replicate cards with their own logos.

3. **Add your key** — OpenAI connector detail with its original logo, use cases, documentation link, private API Key field and Save button. The field is empty.

4. **Saved connection** — Illustrative saved OpenAI connection. Connected appears beside its name, the saved value is masked, and Update and Disconnect controls are available. No credential is shown.

1. Open App options (+) → Connectors in the app you want to connect.
2. Choose OpenAI in the catalogue, then enter your API Key in its private form and select Save.
3. Return to the conversation and test the feature. Connected means a credential is saved, not that a provider request has succeeded.

The actual connection screens. Empty form and illustrative saved state; no credential is shown.


## Try one complete conversation

Section: https://www.rnblocks.dev/docs/connectors/openai#test

1. **Give Studio a specific feature** — For example: “Add a recipe helper using OpenAI. Let me enter ingredients and get one recipe with preparation steps.”

2. **Test the native result** — In the iOS or Android preview, enter a few ingredients. Confirm the app shows a loading state and then a useful response.

3. **Try a follow-up** — Ask to change one ingredient. If your app promises saved conversations, reopen it and confirm the history remains. Tell Studio separately if you want persistent history.


## When the first request fails

Section: https://www.rnblocks.dev/docs/connectors/openai#recovery

- Check that the saved key belongs to the intended OpenAI project and has not expired or been revoked.
- Review that project’s API quota, billing and model access. A key can save successfully while its first model request fails.
- If a text request works but an attachment fails, give Studio the exact file type and visible error. File uploads, saved file IDs and every OpenAI endpoint are not interchangeable with the connector’s supported requests.

- [OpenAI production and key guidance](https://developers.openai.com/api/docs/guides/production-best-practices)

## Costs and the information your app sends

Section: https://www.rnblocks.dev/docs/connectors/openai#costs-and-data

Your connected provider handles its own API usage and billing. Those charges are separate from RNBlocks credits used while building your app. Review the provider’s quota and billing before testing with a large audience.

An AI feature sends the information needed for that request to its provider. Decide what your app should send, explain that clearly to your users, and test any permission and decline choices before release. Connecting a service does not automatically add a saved history, private file library or every feature in that provider’s API.

- [Understand credits and usage](https://www.rnblocks.dev/docs/credits-and-usage)

## Update or disconnect

Section: https://www.rnblocks.dev/docs/connectors/openai#manage

Open **App options (+) → Connectors → OpenAI**. To replace the saved credential, enter the new value and select **Update**, then test the feature again.

**Disconnect** removes this app’s saved OpenAI credential. Features that use it will need a working connection again. It does not close your provider account, cancel provider billing, revoke the original key at the provider, or erase data already sent there. Reopen Connectors to check the saved connection state.


## Continue

- [Connector overview](https://www.rnblocks.dev/docs/connectors)
- [Preview and test](https://www.rnblocks.dev/docs/previewing-screens)
- [Connect Supabase for saved data](https://www.rnblocks.dev/docs/connectors/supabase)

## Official references

- [OpenAI API quickstart](https://developers.openai.com/api/docs/quickstart)
- [OpenAI production best practices](https://developers.openai.com/api/docs/guides/production-best-practices)
