MemeStack Generation API

AI image generation for signed-in users, paid with a prepaid credit or a Lightning offer.

GitHub OpenAPI

Operations 2

POST /v1/images/generate Generate an image (logged-in): a prepaid credit, else a Lightning offer #
POST /v1/images/generate/redeem Settle a generation offer and create (or resume) the generation #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/memestack-ai:memestack-ai-generation-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

memestack-ai-generation-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: MemeStack Generation API
  version: 1.0.0
  description: 'Visual search engine for memes, infographics, charts, and screenshots. Find images by meaning, the text inside them, or visual similarity. AI-captioned, OCR-indexed, Lightning-ranked. Two tiers: the Open API (/v1) needs no key — the read endpoints the website itself uses, rate-limited per IP address; the Search API (/v2, Tenor v2-compatible) takes an API key, free for 100 calls a day, then paid plans (card or Lightning): https://memestack.ai/developers.'
  contact:
    name: MemeStack
    url: https://memestack.ai
  termsOfService: https://memestack.ai/terms
servers:
- url: https://api.memestack.ai
tags:
- name: Generation
  description: AI image generation for signed-in users, paid with a prepaid credit or a Lightning offer.
paths:
  /v1/images/generate:
    post:
      tags:
      - Generation
      summary: 'Generate an image (logged-in): a prepaid credit, else a Lightning offer'
      description: 'A `standard` generation consumes ONE prepaid generation credit when the account holds one (answered 201 with the job dispatched); otherwise — and always for `quality` and `edit` — answers a 402 Lightning offer for the mode''s price ($0.08 standard / $0.20 quality / $0.15 edit, invoiced in sats at the current BTC/USD rate), to be paid and then redeemed at POST /v1/images/generate/redeem. `edit` takes up to 3 references: existing image ids (`ref_image_ids`) and/or ephemeral uploads (`ref_upload_ids` from /v1/images/generate/ref-upload). Idempotency-Key is REQUIRED — the credit arm is a mutation, and a same-key retry of a 402 hands back the SAME offer rather than minting a second invoice. Requires a fresh account. Rate limited 20/min/user. Returns 403 while IMAGE_GEN_ENABLED is off.'
      security:
      - BearerAuth: []
      parameters:
      - name: Idempotency-Key
        in: header
        required: true
        schema:
          type: string
          maxLength: 64
        description: Client-generated key (e.g. crypto.randomUUID()). A replayed key returns the original response; missing header is a 400 MISSING_IDEMPOTENCY_KEY.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - mode
              - prompt
              - aspect_ratio
              properties:
                mode:
                  type: string
                  enum:
                  - standard
                  - quality
                  - edit
                prompt:
                  type: string
                  maxLength: 2000
                aspect_ratio:
                  type: string
                  enum:
                  - '1:1'
                  - '3:4'
                  - '16:9'
                ref_image_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: edit only — existing images the caller may access.
                ref_upload_ids:
                  type: array
                  items:
                    type: string
                  description: edit only — ids returned by /v1/images/generate/ref-upload.
            example:
              mode: standard
              prompt: a wojak staring at a bitcoin chart
              aspect_ratio: '1:1'
      responses:
        '201':
          description: A prepaid credit covered the generation; the job is dispatched. Poll GET /v1/images/{id}/generation-status.
          content:
            application/json:
              schema:
                type: object
                properties:
                  imageId:
                    type: string
                    format: uuid
                  status:
                    type: string
                    enum:
                    - generating
                  cost_sats:
                    type: integer
                    enum:
                    - 0
                  paid_with:
                    type: string
                    enum:
                    - credit
                  generation_credits:
                    type: integer
                    description: Credits remaining after this one.
        '400':
          description: MISSING_IDEMPOTENCY_KEY, INVALID_MODE, INVALID_PROMPT, INVALID_ASPECT, or an invalid reference set.
        '401':
          description: Authentication required.
        '402':
          description: The Lightning offer for this mode's price — same shape as /v1/premium/purchase's 402 without `product`. Pay `invoice`, then redeem.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    enum:
                    - PAYMENT_REQUIRED
                  invoice:
                    type: string
                  macaroon:
                    type: string
                  amount_sats:
                    type: integer
                  invoice_expires_at:
                    type: string
                    format: date-time
                  macaroon_expires_at:
                    type: string
                    format: date-time
        '403':
          description: Generation disabled (FEATURE_DISABLED), or a reference the caller may not use.
        '404':
          description: A referenced image does not exist.
        '429':
          description: Rate limit exceeded (20/min/user).
        '502':
          description: The credit was consumed but the job could not be enqueued (ENQUEUE_FAILED); the credit is refunded (`refunded`). Retry with a NEW Idempotency-Key.
        '503':
          description: GENERATION_UNAVAILABLE — the credit check itself failed, nothing was charged; or PAYMENT_UNAVAILABLE — payments paused / the offer could not be minted.
      operationId: postV1ImagesGenerate
      x-operation-id-source: derived
  /v1/images/generate/redeem:
    post:
      tags:
      - Generation
      summary: Settle a generation offer and create (or resume) the generation
      description: 'Checks the offer''s invoice for settlement and creates the generation once — the same `mode`/`prompt`/`aspect_ratio`/references as the offer are validated again here and are what actually generate. Poll this at ~2.5 s until the invoice settles (202 while unpaid), then keep calling it to follow the job: `running` → `done` (with the image) or `policy_rejected` (payment retained, no refund). A `failed` job is re-driven on the SAME payment by the next call (`redriven: true`) — one payment delivers at most one image. Account-bound: an expired macaroon still resumes this account''s paid claim; another account''s is refused. Not gated by IMAGE_GEN_ENABLED for money purposes — with generation off and the invoice PAID, the payment is recorded and the claim stays open (503 GENERATION_UNAVAILABLE, `claim_open: true`). Rate limited 60/min/user. Every answer is private, no-store.'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - mode
              - prompt
              - aspect_ratio
              - macaroon
              properties:
                mode:
                  type: string
                  enum:
                  - standard
                  - quality
                  - edit
                prompt:
                  type: string
                  maxLength: 2000
                aspect_ratio:
                  type: string
                  enum:
                  - '1:1'
                  - '3:4'
                  - '16:9'
                ref_image_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                ref_upload_ids:
                  type: array
                  items:
                    type: string
                macaroon:
                  type: string
                  description: The macaroon from the /v1/images/generate 402.
            example:
              mode: quality
              prompt: a wojak staring at a bitcoin chart
              aspect_ratio: '1:1'
              macaroon: v1:...
      responses:
        '200':
          description: 'The bound generation''s current state. `done` carries the image summary; `policy_rejected` closes the claim with the payment retained; `failed` (rare) reports a delivered-then-failed row without re-driving; `running` with `redriven: true` means this call re-dispatched a failed job.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  image_id:
                    type: string
                    format: uuid
                  status:
                    type: string
                    enum:
                    - done
                    - policy_rejected
                    - failed
                    - running
                  redriven:
                    type: boolean
                  image:
                    type: object
                    nullable: true
                    properties:
                      id:
                        type: string
                        format: uuid
                      caption:
                        type: string
                        nullable: true
                      tags:
                        type: array
                        items:
                          type: object
                        nullable: true
                      thumb:
                        type: boolean
        '201':
          description: Invoice settled and the generation dispatched.
          content:
            application/json:
              schema:
                type: object
                properties:
                  image_id:
                    type: string
                    format: uuid
                  status:
                    type: string
                    enum:
                    - generating
        '202':
          description: Invoice not paid yet (AWAITING_PAYMENT) — keep polling.
        '400':
          description: INVALID_MODE / INVALID_PROMPT / INVALID_ASPECT, an invalid reference set, or PRICE_MISMATCH (the macaroon was minted for another mode's price).
        '401':
          description: Authentication required.
        '402':
          description: Macaroon missing, malformed, invalid, bound to another tool, or from a previous payment provider (PAYMENT_INVALID) — request a new offer.
        '404':
          description: The payment belongs to another account's claim (NOT_FOUND), or a referenced image does not exist.
        '410':
          description: The generated image was removed (IMAGE_REMOVED); the payment is recorded for reconciliation.
        '429':
          description: Rate limit exceeded (60/min/user).
        '502':
          description: 'Could not enqueue the job (ENQUEUE_FAILED) — `claim_open: true`, retry with the same macaroon.'
        '503':
          description: 'PAYMENT_UNAVAILABLE (payments paused or the settlement check failed) or GENERATION_UNAVAILABLE (generation disabled; `claim_open: true`) — the paid invoice is recorded, retry later with the same macaroon.'
      operationId: postV1ImagesGenerateRedeem
      x-operation-id-source: derived
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT issued by /auth/callback (LNURL) or /auth/email/verify. Also accepted as the httpOnly cookie __Secure-bii-token for same-origin browser requests.
    ApiKeyQuery:
      type: apiKey
      in: query
      name: key
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
externalDocs:
  description: Full API documentation and developer guide
  url: https://memestack.ai/developers
x-service-info:
  categories:
  - media
  - search
  docs:
    homepage: https://memestack.ai/developers
    apiReference: https://memestack.ai/llms-full.txt
    llms: https://memestack.ai/llms.txt