DEV Community

Cover image for How to create a ChatGPT app with OpenAI's Apps SDK
David Turnbull for Lingo.dev

Posted on

How to create a ChatGPT app with OpenAI's Apps SDK

Introduction

OpenAI has announced the introduction of "apps" for ChatGPT:

Apps are essentially plugins for ChatGPT that can be invoked with natural language. They can render custom user interfaces, which enables richer and more interactive user experiences, and are built on top of the Model Context Protocol (MCP) specification, which means you don't have to learn an entirely new technology.

At this stage, only certain developers are allowed to distribute their apps, but anyone can start developing them. I'm keen to explore possible opportunities for Lingo.dev, so I've immediately started digging into what's possible.

This guide explains what I've learned about how to get an app up and running.

👉 In future articles, I'll be doing deeper dives into ChatGPT app development, so follow me on Twitter or LinkedIn to keep up to date.

Caveat

There is an issue that is preventing developers from running apps within ChatGPT. You'll need to wait for the issue to be resolved before you can test the app.

Step 1. Set up the examples repo

OpenAI has provided a repo of app examples to help understand the basic lifecycle of apps and common patterns, such as creating interactive interfaces.

To set up the repo:

  1. Clone the openai-apps-sdk-examples repo:

    git clone https://github.com/openai/openai-apps-sdk-examples.git
    
  2. Navigate into the repo:

    cd openai-apps-sdk-examples
    
  3. Install the dependencies:

    pnpm install
    

Step 2. Start the development servers

Apps are made up of an MCP server, which is responsible for defining things like tools and resources, and frontend code, which is responsible for rendering UI elements that can be displayed withi ChatGPT.

Start the frontend server

In the terminal, run the following comand:

pnpm run dev
Enter fullscreen mode Exit fullscreen mode

Start the backend server

In a separate terminal:

  1. Navigate into the directory for the server code:

    cd pizzaz_server_node
    
  2. Run the server:

    pnpm start
    

The server should become available at http://localhost:8000.

Step 3. Expose the local server

For ChatGPT to be able to "talk" to an app, it needs to be available via a public URL. During development, the easiest way to do this is with an SSH tunneling tool, such as ngrok. This kind of tool exposes a local server via a publicly accessible URL.

To set up ngrok:

  1. Sign up for an ngrok account.
  2. Install ngrok:

    brew install ngrok
    
  3. Configure an authtoken for ngrok:

    ngrok config add-authtoken <authtoken>
    

    (You'll see the authtoken after signing up for an account.)

  4. Start a tunnel:

    ngrok http 8000
    

    Here, "8000" is the port number. If the server is not running on port 8000, be sure to specify the actual port number.

Note: There are many alternatives to ngrok, including free and open-source options. For a (very) comprehensive list, see awesome-tunneling.

Step 4. Enable Developer Mode

To test an app that's in development, Developer Mode must be enabled in ChatGPT.

To enable Developer Mode:

  1. In ChatGPT, navigate to Settings.
  2. In the sidebar, select Apps & Connectors.
  3. Scroll down and click Advanced settings.
  4. Enable Developer mode.

When Developer Mode is enabled, ChatGPT should look like this:

Step 5. Create an app

  1. In ChatGPT, navigate to Settings.
  2. In the sidebar, select Apps & Connectors.
  3. Click Create.
  4. In the Name field, enter a name for the app (e.g., "Hello World").
  5. In the MCP Server URL field, enter the URL of the MCP endpoint. This URL must be public, support HTTPS, and point directly to the /mcp endpoint (i.e., not the root server URL).
  6. In the Authentication dropdown, select No authentication.
  7. Enable I trust this application.
  8. Click Create.

Step 6. Use the app

  1. In ChatGPT, start a new chat.
  2. Click the + (Plus) icon.
  3. In the More menu, select the app.
  4. Submit a prompt that explicitly invokes the app:

    Using the "Hello World" app, give me a list of pizza places.

Next steps

Top comments (0)