What you get #
Two components you can put on any web page:
<meme-lemur-picker>: a search box and a grid of memes. Someone types what the meme should be about and picks one.<meme-lemur-button>: a button that opens the picker next to it. Point it at a text field and the picked meme goes into the field.
Both follow your team's settings: prohibited topics, tone, blocked templates and your watermark. A pick costs what a generate call costs. The components use a publishable key, which is safe to put in page code.
Set it up #
- Make a publishable key for the sites the component will run on (see Make a publishable key).
- Load the script and add a component:
<script src="https://api.memelemur.com/embed/v1.js" async></script>
<meme-lemur-picker key="mlpk_your_key"></meme-lemur-picker>- Listen for a pick:
<script>
document.addEventListener('meme-select', (event) => {
const meme = event.detail;
console.log(meme.url, meme.templateName, meme.captions);
});
</script>event.detail has the meme's id, url, width, height, templateName, captions and fresh. The id is the shown meme's id, which you can send to feedback from your server.
A meme our model wrote for this search has a sparkle and the word New in its top right corner, so people can tell it from one made earlier. The sparkle is only in the picker: the image has no mark of it, and fresh tells your page which it was.
The meme button #
<textarea id="message"></textarea>
<meme-lemur-button key="mlpk_your_key" for="message" label="Meme"></meme-lemur-button>With for, the picked meme's image address goes into that field, where the cursor is or after what was typed. The button also fires meme-select. Escape or a click outside closes the panel.
Attributes #
| Attribute | On | What it does |
|---|---|---|
key |
both | Your publishable key. Required. publishable-key works too. |
count |
both | How many memes to show, 1 to 8. Default 6. |
accent |
both | A color for the buttons and highlights, such as #2563eb. Use it when you would rather not write CSS. |
prompt |
picker | Searches at once with this text. |
label |
button | The button's text. Default "Meme". |
variant |
button | label shows the Meme Lemur logo and the label, and is the default. icon shows the logo alone. text shows the label alone. |
icon |
button | The address of a picture to show in place of the Meme Lemur logo, such as your own icon. |
for |
button | The id of a text field to put the meme's address in. |
With variant="icon" there are no words on the button, so the label becomes its name for screen readers and its tooltip. Keep it set to something that says what the button does.
Your own words #
Every word the components show can be replaced, for your product's voice or another language. Set these on the picker, or on the button, which passes them to its picker.
| Attribute | Default |
|---|---|
placeholder |
What should the meme be about? |
find-label |
Find |
loading-text |
Finding memes… |
empty-text |
No memes for that yet. Try other words. |
error-text |
One message for every failure, in place of the ones under What a page sees when a call fails. |
<meme-lemur-button
key="mlpk_your_key"
for="message"
variant="icon"
label="Añadir un meme"
placeholder="¿De qué va el meme?"
find-label="Buscar"
empty-text="Nada todavía. Prueba otras palabras."
accent="#7c3aed"
></meme-lemur-button>Style it #
The components draw in their own shadow DOM, so your page's styles don't change them by accident. Set these CSS variables on the element or anywhere above it:
meme-lemur-picker, meme-lemur-button {
--ml-accent: #2563eb;
--ml-accent-text: #ffffff;
--ml-radius: 6px;
--ml-font: Inter, sans-serif;
--ml-columns: 4;
}The others are --ml-text, --ml-muted, --ml-bg, --ml-surface, --ml-border and --ml-fresh, the sparkle's color. The defaults follow the visitor's light or dark mode. For more, style the parts: ::part(input), ::part(button), ::part(grid), ::part(tile), ::part(fresh), ::part(status), ::part(credit) and, on the button, ::part(icon), ::part(label) and ::part(panel).
React #
npm install @memelemur/reactimport { MemeLemurButton, MemeLemurPicker } from '@memelemur/react';
<MemeLemurPicker publishableKey="mlpk_your_key" count={6} onSelect={(meme) => send(meme.url)} />
<MemeLemurButton publishableKey="mlpk_your_key" fieldId="message" variant="icon" label="Add a meme" accent="#7c3aed" onSelect={(meme) => track(meme.id)} />The props are the attributes in camel case: publishableKey, count, accent, prompt, label, variant, icon, fieldId (for for), placeholder, findLabel, loadingText, emptyText and errorText, with onSelect for the pick. The components load in the browser only, so they work in apps rendered on a server.
Size and hosting #
The script is about 19 KB, and about 7 KB compressed, with the logo in it and nothing else to load. It is served from Cloudflare's network, close to your visitors, and a browser keeps it for five minutes. The address has a version: a change that could break your page comes out as v2.js, and v1.js keeps working.
Publishable keys #
A publishable key starts with mlpk_ and is meant to be seen. What keeps it safe is what it may do:
- It works only from the origins you list. A browser sends the page's origin with every call, and a page cannot change it.
- It calls generate and match only, and nothing that reads or changes your team.
- It makes at most
dailyCapcalls a day. After that, calls return 429 until midnight UTC. - Unless
allowModelis true, it gets only memes that already exist, so it never costs a model call. With it, people can get new memes, and each one is a generate call on your bill. - With
space, every call runs in that space and under its rules.
A script outside a browser can send any origin, so the origins stop other sites from using your key in their pages, and the daily cap limits what anyone else can spend. Keep allowModel off unless you need new memes.
An editor, an owner or an admin key can manage publishable keys.
List the publishable keys #
GET /v1/publishable-keys
curl https://api.memelemur.com/v1/publishable-keys \
-H "Authorization: Bearer $MEMELEMUR_KEY"{
"keys": [
{
"id": "pk_8xq2m4n6p0r2t4v6",
"key": "mlpk_k3j5h7g9f1d3s5a7q9w1e3r5t7y9u1i3",
"label": "Help center",
"origins": ["https://help.example.com", "http://localhost:5173"],
"allowModel": false,
"dailyCap": 500,
"space": null,
"createdBy": "jo@example.com",
"createdAt": "2026-10-03T16:20:00.000Z",
"revokedAt": null
}
]
}Revoked keys are listed too, with revokedAt set.
Make a publishable key #
POST /v1/publishable-keys
curl -X POST https://api.memelemur.com/v1/publishable-keys \
-H "Authorization: Bearer $MEMELEMUR_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Help center", "origins": ["https://help.example.com", "http://localhost:5173"] }'| Field | Type and default | What it does |
|---|---|---|
origins |
1 to 20 origins. Required. | The sites the key works from, such as https://app.example.com. https://*.example.com covers every subdomain. Use https, except localhost while you build. |
label |
string, up to 80 characters. Default empty. | A name to tell keys apart. |
allowModel |
boolean. Default false. | Whether the key may get new memes from the model. |
dailyCap |
integer, 0 to 100000. Default 500. | Calls a day. |
space |
a space id, or null. Default null. | The space every call runs in. It has to be one you saved. |
It returns 201 with the key:
{
"key": {
"id": "pk_8xq2m4n6p0r2t4v6",
"key": "mlpk_k3j5h7g9f1d3s5a7q9w1e3r5t7y9u1i3",
"label": "Help center",
"origins": ["https://help.example.com", "http://localhost:5173"],
"allowModel": false,
"dailyCap": 500,
"space": null,
"createdBy": "jo@example.com",
"createdAt": "2026-10-03T16:20:00.000Z",
"revokedAt": null
}
}Errors #
| Status | When |
|---|---|
| 400 | An origin has a path, is not https, or is not an origin at all, or the space is not one you saved. |
| 403 | The caller is a member or a regular API key. |
Revoke a publishable key #
POST /v1/publishable-keys/:id/revoke
curl -X POST https://api.memelemur.com/v1/publishable-keys/pk_8xq2m4n6p0r2t4v6/revoke \
-H "Authorization: Bearer $MEMELEMUR_KEY"The key stops working at once, and pages using it show "This meme picker is not set up yet." It returns the key with revokedAt set, or 404 when your team has no key with that id:
{
"key": {
"id": "pk_8xq2m4n6p0r2t4v6",
"key": "mlpk_k3j5h7g9f1d3s5a7q9w1e3r5t7y9u1i3",
"label": "Help center",
"origins": ["https://help.example.com", "http://localhost:5173"],
"allowModel": false,
"dailyCap": 500,
"space": null,
"createdBy": "jo@example.com",
"createdAt": "2026-10-03T16:20:00.000Z",
"revokedAt": "2026-10-04T09:00:00.000Z"
}
}What a page sees when a call fails #
The components show a short message and write the API's own message to the browser console.
| Status | Shown | Why |
|---|---|---|
| 401 | This meme picker is not set up yet. | The key does not exist or was revoked. |
| 403 | This meme picker is not set up for this site. | The page's origin is not on the key's list. |
| 429 | That is all the memes for today. | The key reached its daily cap. |