# Use Krexel in ChatGPT

This guide takes about 5 minutes. You'll create a Custom GPT that can read, edit, and ship sites on Krexel from inside ChatGPT.

## What this does

Once set up, you can say things to ChatGPT like:
- *"Show me my last 5 deploys"*
- *"Edit the headline on my homepage to say 'Welcome to my shop'"*
- *"Add a pricing page to my site"*
- *"Roll back to yesterday's deploy"*

And ChatGPT will talk to Krexel for you.

## What you need

- A Krexel account (free at [krexel.com](https://krexel.com))
- A Krexel API key — get one at [/settings/keys](https://krexel.com/settings/keys). Create a new key just for this GPT so you can revoke it later if you want.
- ChatGPT Plus, Team, Enterprise, or Edu (free ChatGPT does not support Custom GPTs)

## Step 1: Open the GPT builder

In ChatGPT, click your profile picture → **My GPTs** → **Create a GPT**.

Click the **Configure** tab (not the Create tab).

## Step 2: Set up the basics

**Name:** Krexel

**Description:** Reads, edits, and ships sites on Krexel. Use it to manage your Krexel deployments from ChatGPT.

**Instructions:** Paste this:

```
You are the Krexel assistant. You help users read, edit, and ship sites on their Krexel account using the Krexel HTTP API.

Start by calling getMyAccount to verify the API key works and tell the user their plan + email.

When the user wants to edit or update a deployed site:
1. Call listDeploys to find the latest ready deploy for the relevant domain
2. If needed, call listFiles to see what's in the deploy
3. Call readFile to fetch the file the user wants to change
4. Plan the exact edit. For 'replace' ops, the 'find' field must be the EXACT current text in the file (whitespace and all) — read the file first to be sure.
5. Call editFile with the patches
6. Show the user the new preview URL and a short summary of what changed

Always confirm before shipping destructive changes (deletes, large rewrites, rollbacks).

Never echo the API key back to the user. If an API call returns 401, tell the user their key is invalid and link them to /settings/keys.

If the user asks to do something you can't do (deploy from a folder, upload a binary file, etc), tell them honestly that this GPT can only edit existing text files, not ship from a folder — and point them to /integrations for the local MCP path which can do that.
```

**Conversation starters:**
- "Show me my recent deploys"
- "Edit the headline on my homepage"
- "Roll back my last change"
- "What files are in my latest deploy?"

**Knowledge:** Leave empty.

**Capabilities:** Turn on **Code Interpreter** OFF and **Web Browsing** OFF. Actions are what we want.

## Step 3: Add the Krexel API as an Action

Scroll down to **Actions** → click **Create new action** → click the **Schema** textbox.

In a new browser tab, go to:
```
https://krexel.com/chatgpt-gpt/openapi.json
```

Copy the entire JSON. Paste it into the Schema box in ChatGPT.

Under **Authentication**, choose **API Key** → **Bearer**.

In **API Key** field, paste your Krexel API key. (Format: `kx_live_...`. Get it from [krexel.com/settings/keys](https://krexel.com/settings/keys).)

Click outside the box to save.

## Step 4: Save and try it

Click **Save** (top right) → choose **Only me** (or **Anyone with a link** if you want to share).

Open your new GPT and say: *"Show me my account"*.

You should see something like:
> Connected as you@example.com — Plan: free

If you see an error, check:
- Your API key is correct (no extra spaces)
- The Schema field got the full JSON (starts with `{`, ends with `}`)
- You saved the GPT before testing

## What this GPT can do today

- ✅ **Get account info** — your email, plan, name
- ✅ **List deploys** — see what you've shipped
- ✅ **Edit files** — patch a deployed file with a `find` / `replace` op
- ✅ **Roll back** — revert to any prior deploy
- ✅ **Get build logs** — read the worker logs for any deploy
- ✅ **Ship from a folder** — paste a folder, get a live URL
- ✅ **List / read files** — browse the contents of a deploy

In short: all 9 Krexel tools work from ChatGPT. The earlier
"auth errors for Next.js-minted keys" caveat was a transient worker
issue that has been resolved — the worker now falls back to verifying
keys against Postgres when its KV index misses.

## Security

Your API key is stored by OpenAI in the GPT configuration. To revoke access, go to [krexel.com/settings/keys](https://krexel.com/settings/keys) and delete that key. We'll cut off access immediately.

We recommend creating a dedicated key just for this GPT. That way if you ever want to disable it, you delete one key — not all your keys.

## Help

Stuck? Email help@krexel.com or check [/integrations](https://krexel.com/integrations) for other ways to connect.