Skip to content



sanity-plugin-asset-source-openai

Our open-source Sanity asset source plugin that generates images from OpenAI on the fly, right where you pick assets.

entry 05 of 12 · plugin · updated 2026-07-23



What it is

sanity-plugin-asset-source-openai adds OpenAI image generation as a native asset source in Sanity Studio v3. When an editor opens the asset picker on any image field, they see an extra tab alongside the file upload and existing media options. They write a prompt, generate an image with DALL-E, and it lands straight in the asset library.

The distinction from sanity-plugin-image-gen is where the generation surface lives: this one slots into the asset picker itself rather than a dedicated field action. If your editorial flow already centres on the picker, this fits in without any extra steps.

What you get

  • OpenAI image generation as a first-class asset source tab in the standard Sanity picker.
  • Generated images saved directly to the project's asset library, available for reuse.
  • Simple API key configuration with no extra infrastructure needed on the server side.
  • Compatible with Sanity Studio v3 schemas and field types.

How to use it

Install it from the Sanity Exchange or from npm:

bash
npm i sanity-plugin-asset-source-openai

Then register it in your studio config with your OpenAI key:

ts
// sanity.config.ts
import { defineConfig } from "sanity";
import { openaiImageAsset } from "sanity-plugin-asset-source-openai";

export default defineConfig({
  plugins: [
    openaiImageAsset({
      API_KEY: "your_api_key_from_openai",
    }),
  ],
});

Keep the key in an environment variable and read it in at config time; avoid committing it to source control.

How we use it

On projects where editors do most of their work through the asset picker, this fits the generation step into a workflow they already know. We open-sourced it so other teams building Sanity studios can add the same capability without writing the integration from scratch.





Get in touch

Tell us what you're building. We reply within one working day. Jono or someone on the team picks up every message personally.

By sending this you agree to our privacy policy. We only use your details to reply.