Consume quota /skill/consume.json
Call this before submitting a task. It checks and deducts your account's quota for the tool. Pass the returned context through to the task submission request body.
Request
Request body
Response
Call order
- Always call it before submitting. If the quota API returns a non-zero business code, stop and check
meta.msg. - If a task fails, the quota deducted for that task is returned to your account.
- A successful
consumehas already deducted quota. If the request times out or the connection drops, find out what happened to it first. Once you have atask_id, only query that task. Callingconsumeagain may deduct quota again.
cURL example
Continuing from config in Get config and media_url in Upload media.
This request consumes quota. Check the image URL and tool config, then run it once.
After meta.code is 0, submit the task with the same image URL and the returned context.