api-error-handling
Skill0 starsChanged 2 months agoMITView on GitHub
Read AI Content Drop API failures correctly and decide whether to retry, change the request, or stop. Covers the error envelope and its 21 codes, rate limits and Retry-After, idempotency conflicts, and the two response shapes the generation endpoints can return. Use when a call to aicontentdrop.com fails, returns 4xx or 5xx, is rate limited, or when writing a retry loop against the API.
- Reads credentials
2 other projects use a version of this.
Adopted by
Most recently taken up by
- charanjit-singh/lovable-skillstheir own version, first seen May 22, 2026
- nanami7777777/chinese-fullstack-skillstheir own version, first seen Mar 28, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- charanjit-singh/lovable-skills★ 10same name
- nanami7777777/chinese-fullstack-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- ai-video-model-pickerSkill
- credits-and-plansSkill
- short-drama-writerSkill
- video-prompt-writerSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Every failure on the public surface carries a machine-readable code:
- Very specific: line 31
Read error.code. Never branch on the message — it is written for a human and will change.
- Distinctive: line 92
Every response carries the counters, not just the 429:
- Very specific: line 107
When you are refused, a 429 carries Retry-After in seconds and retry_after_seconds in the body.
- Distinctive: line 120
Never tell a user they were charged for a failed generation.
- Distinctive: line 121
Never write code that asks for a refund or a credit adjustment.
- Distinctive: line 129
If you are unsure a request is well formed, run it through the sandbox first.
- Very specific: line 151
Put an Idempotency-Key on every generation request.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Failing well against the AI Content Drop API
The point of this skill is to stop you doing the two things that waste a user's money and time: retrying something that will never succeed, and giving up on something that would have worked in thirty seconds.
The envelope
Every failure on the public surface carries a machine-readable code:
{
"error": {
"code": "insufficient_credits",
"message": "Balance below the model cost.",
"documentation": "https://aicontentdrop.com/docs/errors"
}
}Read error.code. Never branch on the message — it is written for a human and
will change.
One exception you must handle. POST /v1/generate/video and
/v1/generate/image are path aliases onto the handlers the website itself
calls, so a validation failure from those two can still arrive in the older
shape, { "error": "some message" } — a string, not an object. Write the read
once and forget it:
const code = typeof body.error === "object" ? body.error.code : undefined;
const message = typeof body.error === "string" ? body.error : body.error?.message;What each code means for your next move
Do not retry — fix the request:
| Code | Status | What to do |
invalid_request | 400 | The message names the field. Correct it. |
invalid_json | 400 | Send a complete object with Content-Type: application/json. |
safety_rejected | 400 | The prompt was refused. Rewrite it. Nothing was charged. |
unsupported_operation | 400 | Not available inside a batch. Call the endpoint directly. |
unknown_model | 404 | Re-read /v1/models. Check id normalisation (below). |
unknown_endpoint | 404 | GET /v1 lists the whole surface. |
method_not_allowed | 405 | The message names the verbs that work. |
forbidden | 403 | The object is not yours. Retrying cannot change that. |
payload_too_large | 413 | Split the work. See POST /v1/batch. |
query_too_large | 413 | GraphQL query over 8,000 characters. Split it. |
Do not retry — the user has to act:
| Code | Status | What to do |
unauthorized | 401 | No key, or a revoked or malformed one. Read WWW-Authenticate. |
unauthenticated | 401 | A session surface reached without a session. Most of /v1 needs no credential. |
invalid_client | 401 | Re-register at /agent/auth/register. |
insufficient_credits | 402 | Tell the user the balance and the cost. Offer a cheaper model. |
idempotency_conflict | 409 | Same Idempotency-Key, different body. Use a new key. |
Retry is correct:
| Code | Status | What to do |
rate_limited | 429 | Wait Retry-After seconds exactly. Nothing was charged. |
provider_error | 502 | The upstream model failed. Retry is reasonable. Nothing was charged. |
internal_error | 500 | Our bug. Retry once, then report it. |
not_found (404) and operation_failed (400, one item inside a batch) are
context-dependent: re-read the catalogue, or read that item's own error.
Rate limits
| Surface | Limit per minute |
/v1/* REST | 120 |
POST /graphql | 120 |
POST /mcp, POST /mcp/docs | 600 |
POST /ask | 60 |
Every response carries the counters, not just the 429:
RateLimit-Limit: 120
RateLimit-Remaining: 118
RateLimit-Reset: 47Self-throttle on RateLimit-Remaining instead of waiting to be refused. You can
watch them with no credential at all:
curl -sD - https://aicontentdrop.com/v1 -o /dev/null | grep -i ratelimitWhen you are refused, a 429 carries Retry-After in seconds and
retry_after_seconds in the body. Wait that long. Retrying sooner extends
the window rather than shortening it, so an impatient loop is strictly slower
than a patient one.
The rule that makes failure cheap here
Credits are charged only when a generation succeeds. A safety block, a provider failure, a validation error and a timeout all cost nothing. A failed generation has no refund path because there is nothing to refund.
Two consequences for your error handling:
- Never tell a user they were charged for a failed generation. They were not.
- Never write code that asks for a refund or a credit adjustment. No such endpoint exists, by design.
A generation that fails after it started shows status: "failed" with
credits_used: 0 and an error_message you can read.
Rehearse instead of guessing
If you are unsure a request is well formed, run it through the sandbox first. It applies the full validation path, needs no API key, and charges nothing:
curl -sX POST https://aicontentdrop.com/v1/generate/video \
-H "Content-Type: application/json" \
-H "X-Sandbox: true" \
-d '{"prompt":"a red balloon over a city","model":"kling_3_0"}'A 202 means the request shape is right. A 400 names what is wrong, before
anyone's credits are involved.
Model id normalisation
Ids use underscores (kling_3_0, veo_3_fast). Dashes are accepted and
normalised, so kling-3-0 works. If a model still comes back unknown_model,
re-read /v1/models rather than guessing a variant — the catalogue is the
source of truth and needs no credential.
Retrying without double-spending
Put an Idempotency-Key on every generation request. Retention is 24 hours: the
same key with the same body returns the original result instead of starting a
second generation; the same key with a different body is a 409
idempotency_conflict.
curl -sX POST https://aicontentdrop.com/v1/generate/video \
-H "Authorization: Bearer $ACD_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"prompt":"…","model":"kling_3_0"}'This is what makes a network timeout safe to retry. Without it, a retry after a timeout can start a second paid generation.
Full reference: https://aicontentdrop.com/docs/errors
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

