Skip to main content
LocoPal AiLocoPal Ai
Help & Reference

Guide

Rate Limiting and Quota

Concurrency limits, rate limits, quota and account capacity, and backoff retry methods

View Markdown

Rate Limiting and Quota

Platform limits fall into several categories, each with a different symptom when triggered. Identifying which category applies is the key to handling it quickly.

Limit typeSymptom when triggeredHow to handle
Request frequency (rate limiting)HTTP 429 "requests too frequent"Back off and retry; do not retry concurrently
Async task concurrencyHTTP 429, task_concurrency_exceededWait for existing tasks to finish before submitting
Key quotaInsufficient balance/quota message; the task is not createdTop up, adjust the key quota, or make the request smaller
Account balanceA message that the balance is insufficient to cover the estimated consumption for this requestTop up in the wallet
Asset capacityFormat and size validation when submitting assetsFix the file or use image_url

Request Rate Limits

The platform limits request frequency. Polling too fast, excessive concurrency, or many retries in a short period can all trigger:

{ "error": { "code": "...", "message": "请求过于频繁" } }

The HTTP status is 429.

Correct approach:

  • After receiving 429, back off: wait a while before sending the next request; do not resend immediately;
  • Do not try to bypass rate limiting with concurrent requests; that only makes the backoff longer;
  • When polling async tasks, use a fixed, reasonable interval (for example, once every few seconds); do not poll with no interval.

Do not blindly retry status codes other than 429:

Status codeHandling
429Back off as instructed, then retry
Brief 5xxSave the RequestId, back off, and retry once
400A parameter problem; fix the request before sending again
401The key is invalid or disabled; check the key
403No permission to access that resource or model
404The resource does not exist; verify the ID

Async Task Concurrency

Async tasks such as video are subject to a concurrency limit, at both the individual account level and the overall platform level. When the limit is reached, HTTP 429 is returned with the error code task_concurrency_exceeded, and the message gives "currently N / limit M".

When this happens, you should:

  1. Keep the IDs of existing tasks; do not discard them;
  2. Wait for in-flight tasks to reach a terminal state (or query their current status directly);
  3. Wait, and then have the user actively resubmit; do not retry repeatedly;
  4. Do not repeatedly submit the same task to "grab" concurrency — that produces duplicate tasks and duplicate charges.

Before submitting in batches, we recommend queue-based management in your business backend: control the number of in-flight tasks rather than submitting everything at once.

Key Quota and Account Balance

Quota and balance are two levels of limits:

LevelDescription
Key quotaThe usage limit and validity period set for that key in "API Keys" in the console
Account balanceThe available balance, plan quota, or credits of the entire LocoPal account

Before submission, async tasks check whether the balance can cover the estimated consumption for this request. If not, a readable message is returned, and no task is created, so this situation incurs no charge.

How to handle:

  • Insufficient key quota → adjust the key's quota or validity period in "API Keys";
  • Insufficient account balance → top up in "Wallet" or use a plan;
  • Estimated consumption too high → lower the resolution or duration, or switch to a smaller model.

We recommend doing a pre-check of the balance in your business backend and giving end users a clear message, rather than passing the platform's error directly to the user.

Asset Limits

The asset API validates uploaded data:

LimitSymptomHandling
Address formatimage_url 必须是可公开下载的 http(s) 地址…Use an http(s) URL that can be downloaded directly from the public internet
Submit only one per callimage_url 与 data_url 只能提交一个Keep only one field
Data size图片数据无效或超过 20MBCompress the image or use image_url
Group type素材分组不存在或不是虚拟素材分组Images can only be submitted to virtual groups
Name lengthGroup names cannot be empty and must not exceed 64 characters; descriptions must not exceed 300 charactersFix the name or description

An incomplete asset review is not an error: the query returns 200 and status is Processing; continue polling with the same asset ID, and do not resubmit.

Polling Recommendations

Querying async tasks incurs no charge, but polling too frequently triggers rate limiting.

Task stageRecommended interval
Just submitted (queuing)Once every few seconds
GeneratingOnce every few seconds to a dozen seconds
Reached a terminal stateStop polling

Polling should have a maximum total duration. When the limit is reached, stop querying and return the task ID to the user so they can continue querying with the ID later— do not recreate the task.

Idempotency and Duplicate Submissions

The platform does not automatically merge identical requests. Even if the prompt, parameters, and reference assets are completely identical, every active submission creates a new task and a new result, and each is billed separately.

Therefore:

  • Use idempotency keys on the business side (order number, business ID) to prevent duplicate submissions caused by users clicking repeatedly;
  • Save the task ID in your database immediately after submitting an async task; when the network is interrupted, recover by querying rather than recreating;
  • Only when you click "Direct Retry" on the same failed result does it re-execute in place—which likewise produces a new task and new charges.
Was this page helpful?

On this page