The error body #
A failed call returns JSON with an error string. Some errors also have details.
{ "error": "template not found" }A body that fails validation returns 400. error says which fields are wrong in one sentence, and details has one entry for each problem, where path says which field:
{
"error": "prompt is required; count: too big: expected number to be <=10",
"details": [
{ "expected": "string", "code": "invalid_type", "path": ["prompt"], "message": "Invalid input: expected string, received undefined" },
{ "origin": "number", "code": "too_big", "maximum": 10, "inclusive": true, "path": ["count"], "message": "Too big: expected number to be <=10" }
]
}A body that is not JSON returns 400 with request body is not valid JSON.
Status codes #
| Status | What it means |
|---|---|
| 200 | The call worked. |
| 201 | The call made something: a template, a saved meme, an API key or an invitation. |
| 204 | A delete worked. There is no body. |
| 400 | The request is wrong: a field is missing or out of range, the body is not JSON, the caption count does not fit the template, or the Memelemur-Space header is not a valid id. |
| 401 | The API key is missing, wrong or revoked. |
| 402 | Your team has no prepaid credit left and is not billed after it. Also when your team stored its own model key and the provider rejected it. |
| 403 | The caller is not allowed to call the route. The error says what the route needs, and the list below has each message. |
| 404 | The path has no route, or your team has nothing with that id. Something that belongs to another team also returns 404. |
| 409 | The change conflicts with what is there: a template slug that is taken, a key revoking itself, an invitation for someone who is already a member, or removing the only owner. |
| 422 | The caption model declined the prompt, or the prompt, the phrase or every meme written for it mentions a prohibited topic. |
| 429 | A rate limit, the daily cap, a key's daily cap, or the caption model's own rate limit. |
| 500 | Something failed inside Meme Lemur. |
| 502 | The caption model rejected the request, or its reply could not be read. |
| 503 | Something Meme Lemur depends on could not be reached: the caption model, both search rankings, or the check for prohibited topics. |
| 504 | The caption model did not reply in time. |
What a 403 says #
error |
Who gets it | What to do |
|---|---|---|
this route needs an admin API key |
A regular API key that called a route for people, the model key or the API keys. | Make the call with an admin key. |
this route needs the editor role |
A signed-in member who tried to change settings or a space, delete a template, or use the API keys. | Ask an owner to make the person an editor. |
this route needs the owner role |
A signed-in member or editor who called a route for people or the model key. | Ask an owner to do it. |
creating an admin API key needs the owner role |
A signed-in editor who asked for an admin key. | Ask an owner, or make a regular key. |
revoking an admin API key needs the owner role |
A signed-in editor who tried to revoke an admin key. | Ask an owner. |
you are not a member of this team |
A signed-in person who named a team they are not in. | Ask an owner of that team for an invitation. |
People and roles has what each role may do.
What to try again #
Try a 429 again after the seconds in Retry-After, or after a minute when the response has no such header. Try a 500, a 502, a 503 or a 504 again after a short wait.
A 400, 401, 402, 403, 404, 409 or 422 returns the same thing until the request or the team changes.
Sending generate again after a failure can make a second set of memes, and each call that reached the caption model counts toward the daily cap.
The caption model gets 15 seconds, and then a fallback model gets 15 more. A generate or match call can therefore take a little over 30 seconds before it fails, so give your HTTP client a timeout longer than that. Most calls return in a few seconds.
Rate limits #
A team has three rate limits. The operator sets them for each team, and these are what a new team has:
| Limit | What spends it | Calls a minute |
|---|---|---|
model |
A generate or match call that asks the caption model. | 300 |
calls |
Every generate and match call. | Ten times model |
render |
Every render call. | 600 |
Suggest has two limits of its own, the same for every team, which nobody sets. suggest is 600 calls a minute with a burst of 100, and every suggest call spends from it. decision is 30 a minute with a burst of 10, and a call spends from it only when it is about to ask the decision model. A call over decision is not refused: it returns 200 with no suggestions from the decision model. A suggest call spends from no other limit.
Generate and match spend from the same two limits. A call the pool or a phrase pattern fills asks no caption model, so it spends from calls and leaves model alone.
A limit refills evenly and has no window that resets. At 300 a minute one call comes back every fifth of a second. A team that has made no calls for a minute can make a minute of calls at once, unless the operator set a smaller burst. modelCallsPerMinute, modelCallsBurst, rendersPerMinute and rendersBurst in your settings say what your team has.
What you have left #
Every response from the three routes says what is left of the route's limits:
RateLimit-Policy: "model";q=300;w=60, "calls";q=3000;w=60
RateLimit: "model";r=297;t=1, "calls";r=2996;t=1
RateLimit-Limit: 300
RateLimit-Remaining: 297
RateLimit-Reset: 1RateLimit-Policy and RateLimit are the fields of the current IETF draft, draft-ietf-httpapi-ratelimit-headers-11. q is the calls a minute, r is how many calls you can make now, and t is the seconds until you can make one more.
RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset are the fields of the earlier drafts, which most client libraries read. They describe one limit: the one that refused the call, or the one closest to used up. RateLimit-Limit is the most calls you can have saved up, and RateLimit-Reset is the seconds until one more call is available.
When your calls arrive at several servers at once, r and RateLimit-Remaining can be a few calls off.
Over a limit #
A call over a limit returns 429. Retry-After has the seconds until a call would go through, which is 1 for a team that is a little over a limit of hundreds a minute. details.limit says which limit refused:
{
"error": "too many generate calls that need the caption model, try again in 1 seconds",
"details": { "limit": "model", "retryAfterSeconds": 1 }
}A generate call that the pool filled in part is not refused by model. It returns the pool's memes with 200, and the headers show nothing left.
details.limit is platform when Meme Lemur as a whole is sending the model provider all it may. Your own limits are not used up then, and the call goes through after the seconds in Retry-After. A team with its own model key is never refused this way.
A space can have lower model and render limits of its own. A call in the space spends from the space's limit and from the team's.
The daily cap #
A team has a cap on generate calls for each UTC day, dailyGenerateCap in its settings. The operator sets it. Usage returns today's count.
A call counts when the caption model replied to it on the platform's key, whether or not the reply could be used. A prompt the model declines counts.
These do not count:
- A call the pool filled.
- A call no model replied to.
- A call your own model key paid for.
- Match and render calls.
At the cap, generate returns 429. Retry-After has the seconds until 00:00 UTC, and details has the cap and the reset time:
{
"error": "the daily cap of 1000 generate calls for the team is reached, and it resets at 2026-10-03T00:00:00.000Z",
"details": { "scope": "team", "space": null, "cap": 1000, "used": 1000, "resetsAt": "2026-10-03T00:00:00.000Z" }
}A call with "reuse": "only" is never refused at the cap, because it cannot reach the caption model. A team with a stored model key is not refused either.
A space can have a lower cap of its own, and then scope is space and space has its id. The team's cap still applies to all of its spaces together.
The count is read before a call runs, so calls that start together near the cap can take it slightly over.
A key's daily cap #
An API key can have a daily cap of its own, set with PATCH /v1/keys/:keyId. Every generate and match call the key makes counts when it arrives. At the cap, the key's generate and match calls return 429 until 00:00 UTC, with the seconds until then in Retry-After. The team's other keys keep working.
{
"error": "this API key has made its 500 generate and match calls for today, and the count starts again at 2026-10-03T00:00:00.000Z",
"details": { "limit": "key", "keyId": "key_j15z8f8skojfdb1l", "cap": 500, "resetsAt": "2026-10-03T00:00:00.000Z" }
}No credit left #
A team has prepaid credit, and the operator decides whether its calls are billed or refused once the credit is used up. credit.atZero in usage says which, and a new team is refused.
When your team is refused at zero and its balance is zero, generate, match and regenerate return 402 before any work is done. details.reason is noCredit, which tells this 402 from the one for a rejected model key:
{
"error": "the team has no prepaid credit left, so the call was refused. An owner of the team should contact whoever runs Meme Lemur for the team to add credit",
"details": { "reason": "noCredit", "balanceMicros": 0 }
}The response has no Retry-After, because waiting does not help: the call works again once the operator adds credit. A refused call is not stored or charged, and it does not count toward the daily cap. It spends one call of the calls rate limit, as a call refused at the daily cap does.
Render and every other route keep working.
A call that starts with any credit left goes through, even when the balance is smaller than its price, and the rest of the price is billed. The balance is read before a call runs, so calls that start together on a nearly empty balance can all go through. The refusals begin with the first call after the balance reaches zero.
The Memelemur-Degraded header #
A response that was made without one of the things Meme Lemur depends on has a Memelemur-Degraded header. A response without the header is a full answer. The header lists what happened, separated by commas:
Memelemur-Degraded: semantic-search| Value | What happened |
|---|---|
semantic-search |
The search by meaning failed or took too long. The results were ranked by keyword alone. |
keyword-search |
The keyword search failed. The results were ranked by meaning alone. |
team-copy |
Your team could not be read from the database, and the call used the copy from a read less than 60 seconds earlier. A setting changed in that minute, or a key revoked in it, may not have applied to this call. |
index-write |
A template upload or a library save was stored and could not be added to the search by meaning. A keyword search finds it. |
The header matters on these routes:
- On generate and match, a search value means the templates were chosen from a weaker ranking. When both rankings fail, the header lists both values, and the call chooses among your pinned templates and the most popular ones.
- On the template list and the library with
q, one value means the results are ranked one way only. When both rankings fail the search returns 503. - An error response can have the header too.