---
name: memegen
description: Generate memes via memegen.link API. Trigger when user asks to create/make a meme, generate meme image, or mentions memegen.link. Returns image URL ready to embed or download.
---

# Memegen.link Skill

Free, no-auth meme generation. Base URL: `https://api.memegen.link`

## Quick path: URL construction (no API call needed)

Most memes need zero HTTP calls. Build URL directly:

```
https://api.memegen.link/images/{template_id}/{line1}/{line2}.{ext}
```

- `template_id`: e.g. `aag`, `drake`, `buzz`, `db`, `ds`, `fry`, `success`, `bender`, `disastergirl`
- Lines: one path segment per text line. Use `_` for empty line.
- `ext`: `png` (default), `jpg`, `gif`, `webp`

Example: `https://api.memegen.link/images/drake/no_thanks/yes_please.png`

### Special character encoding (URL path)

| Char | Encode as |
|------|-----------|
| space | `_` or `-` |
| underscore `_` | `__` |
| dash `-` | `--` |
| newline | `~n` |
| `?` | `~q` |
| `&` | `~a` |
| `%` | `~p` |
| `#` | `~h` |
| `/` | `~s` |
| `\` | `~b` |
| `<` | `~l` |
| `>` | `~g` |
| `"` | `''` (two single quotes) |
| empty line | `_` |

Always URL-encode after substitution (spaces in query are `%20`, but path uses `_`).

## Discovery endpoints

List all templates:
```
GET https://api.memegen.link/templates
GET https://api.memegen.link/templates?filter=drake
GET https://api.memegen.link/templates?animated=true
```

Template detail:
```
GET https://api.memegen.link/templates/{id}
```

Returns `lines` (text count needed), `styles`, `blank` URL, `example`.

Fonts:
```
GET https://api.memegen.link/fonts
```

## POST endpoints (when path encoding too messy)

Create from template:
```
POST https://api.memegen.link/images
Content-Type: application/json

{
  "template_id": "drake",
  "text": ["no thanks", "yes please"],
  "extension": "png",
  "font": "impact",
  "layout": "default"
}
```
Returns `{"url": "..."}`.

Create from custom background image:
```
POST https://api.memegen.link/images/custom
{
  "background": "https://example.com/img.jpg",
  "text": ["top", "bottom"],
  "extension": "png"
}
```

Auto-pick template from phrase:
```
POST https://api.memegen.link/images/automatic
{ "text": "one does not simply walk into mordor", "safe": true }
```

## Query params for `/images/.../*.png`

Append to URL:
- `?font=impact` (or any font id from `/fonts`)
- `?style=<style_name>` (template-specific, see template detail)
- `?layout=top` (alternate text position)
- `?width=600` / `?height=400`

## Auth

Most endpoints anonymous. `X-API-KEY` header only needed for premium features (search, high-volume image generation). Skip unless user provides key.

## Common templates

`drake` (2 lines), `db` distracted-boyfriend (3), `ds` daily-struggle (2), `fry` not-sure-if (2), `success` (2), `aag` ancient-aliens (2), `buzz` x-x-everywhere (2), `bender` (1), `disastergirl` (2), `philosoraptor` (2), `pigeon` (3), `spongebob` (2), `gru` (4 panel, 4 lines).

When unsure of template, GET `/templates?filter=<keyword>` first.

## Workflow

1. User asks for meme → pick template (filter API if needed).
2. Build URL directly with encoded path. Prefer URL over POST — no network call, instant.
3. Return markdown image: `![meme](url)` plus raw URL.
4. If user wants custom image background → use `POST /images/custom`.
