For AI agents: this page is also available as Markdown at https://docs.refabric.com/api-reference/platform/tasks/estimate-a-task.md, and the index of every page is https://docs.refabric.com/llms.txt.
Platform API › Tasks
Estimate a task
What this request would cost — a ceiling: the job, when run, is charged for what it delivers, never more. Nothing runs and nothing is held.
https://api.refabric.com/v1/tasks/{name}/estimateimport os
import requests
url = "https://api.refabric.com/v1/tasks/{name}/estimate"
payload = {}
headers = {
"Authorization": f"Key {os.environ['REFABRIC_API_KEY']}",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json()){
"task": "image.generate",
"ceiling": 4,
"credit_type": "refabric_credits",
"is_ceiling": true
}Authentication. A key with tasks:read: the price is your account's.
Key features
- A body field the task's input schema (
GET /v1/tasks/{name}) does not list is refused (422 field_not_accepted, naming it), never ignored.
Common use cases
- Show a price before you run a task.
Conflicts. A task that was removed answers 410 task_removed; an unknown name 404.
See also
POST /v1/tasks/{name}
Authorization
Authorization: Key $REFABRIC_API_KEYScope: tasks:read
Parameters
Path parameters
- stringrequired
Header parameters
- stringoptional
The contract version you wrote against (a date). Absent: the current version.
format: date
- stringoptional
Your own id for this request; we answer it back under X-Client-Request-ID.
max length 128
Body
application/json
Response
200 — Done: the answer is in the body.
- stringrequired
The task priced.
Example:
image.generate - integerrequired
The most the request can cost, in credits; you are charged for what is delivered, never more.
Example:
4 - stringrequirednullable
Which kind of credit an amount is counted in.
nullwhen the request costs nothing.Values
refabric_credits— Spent by tasks.model_credits— Credits for model training.
Example:
refabric_credits - booleanrequired
Always
true: the figure is a ceiling.Example:
true
- 400 — The request cannot be read as it was sent (a header, the URL or the body's form).
- 401 — No valid API key was sent.
- 403 — Your key or your plan does not allow this.
- 404 — Nothing has this address.
- 410 — This was removed.
- 413 — The body is larger than this operation takes.
- 415 — The body's media type is not one this operation takes.
- 422 — A field is missing or has a value this operation cannot use.
- 429 — Too many requests: wait for the number of seconds in the Retry-After header.
- 500 — Something went wrong on our side; retry, and quote the request id if it keeps happening.