---
title: "How to get an OpenAI API key - Workflow Functions"
description: "Create an OpenAI API key and connect it to Workflow Functions to generate functions with GPT."
canonical: "https://docs.workflow-functions.app/get-openai-api-key"
---

# How to get an OpenAI API key

To use **Generate with AI** with GPT, connect your own OpenAI API key. Here's how to create one - it takes a minute.

## Create the key

1. Go to the **OpenAI platform** and sign in (or create an account): <a href="https://platform.openai.com" target="_blank" rel="noopener">platform.openai.com</a>.
2. Open **API keys** - direct link: <a href="https://platform.openai.com/api-keys" target="_blank" rel="noopener">platform.openai.com/api-keys</a>.
3. Select **Create new secret key**, give it a name (for example `Workflow Functions`), and **copy the key** - it starts with `sk-`. You can only see it once, so copy it now.
4. Make sure your OpenAI account has a billing method or credit - generation calls are billed to your account.

## Connect it

1. In your Shopify admin, open **Workflow Functions -> Developer -> Connections**.
2. Paste the key into the **OpenAI** card and select **Save key**.

Your key is encrypted at rest and used only for generation - it's never shown again and never runs inside your functions. Then open any function's **Code** tab and use **Generate with AI**.

> [!NOTE]
> **Billing and models**
> Generation is billed to your own OpenAI account, not your Workflow Functions plan. See [Generate functions with AI](https://docs.workflow-functions.app/generate-with-ai.md) for the available GPT models and per-generation cost estimates.
