← ImageToPrompt

Open source setup

Self-host Image to Prompt with your own credentials

The project has a static HTML frontend and two backend choices. The public demo calls the project's Cloudflare Worker. A self-hosted copy should call your backend so its AI usage, limits, and data handling are under your control.

Get the code

git clone https://github.com/image-to-prompt/image-to-prompt.github.io.git
cd image-to-prompt.github.io

See the repository README for the current deployment steps. The repository includes the frontend and both backend options.

Option A: Cloudflare Workers AI

Create a Cloudflare account, install dependencies in backend/cf-worker, create a KV namespace for rate limiting, and copy wrangler.toml to wrangler.local.toml, then set your own account and namespace IDs in that local file. The Worker uses a Cloudflare AI binding, so you do not put an API key in the browser.

cd backend/cf-worker
npm install
npx wrangler login
npx wrangler kv:namespace create IMAGE_TO_PROMPT_KV
cp wrangler.toml wrangler.local.toml
# Set your own account_id and KV namespace ID in wrangler.local.toml
npx wrangler deploy --config wrangler.local.toml

Set the Worker AI binding named AI as described in the Worker setup guide. Provider availability and charges depend on your Cloudflare account.

Option B: Docker with an OpenAI compatible API

In backend/docker, copy .env.example to .env, set your provider key and model, then start Docker Compose. Keep .env private.

cd backend/docker
cp .env.example .env
# Set OPENAI_API_KEY, MODEL, and CORS_ORIGIN in .env
docker compose up -d --build

The Docker backend accepts one image per request and uses an in-memory rate limit. For public deployment, configure your reverse proxy, HTTPS, trusted client IP handling, and durable rate limiting.

Point the frontend at your backend

Set window.IMAGE_TO_PROMPT_API_URL before the inline app script in index.html, or replace its default API_BASE_URL. Apply the same change to any translated pages you deploy. The value is your backend's public URL, never an API key.

<script>window.IMAGE_TO_PROMPT_API_URL = 'https://your-api.example.com';</script>

Test /api/health first, then upload a non-sensitive image through your frontend. Confirm CORS allows your frontend origin and the response contains a prompt.

Before you publish

For a working prompt workflow, see the image to prompt guide.

ImageToPrompt is made by the team behind uPilote.