factorial-compute
One API for AI compute that returns typed answers — an image, a set of masks, a transcript, text — in the same shape whichever model or supplier produced it.
pip install factorial-compute
export FACTORIAL_API_KEY=fc_...
from factorial_compute import Client
f = Client() # reads FACTORIAL_API_KEY
# Text, and JSON on request.
print(f.run(model="gpt-oss-120b", input="Name three uses for a forklift.").text)
# An image from a prompt.
result = f.run(model="flux-schnell", input={"prompt": "a red forklift in a warehouse"})
result.images[0].save("forklift.jpg")
# Masks: one per object, each with a box measured from the mask.
result = f.run(model="sam2-segment", input={
"image": "warehouse.jpg", # a local path: uploaded for you
"objects": [{"id": "pallet", "box": [40, 60, 300, 280]},
{"id": "cone", "point": [512, 240]}],
})
for mask in result.masks:
print(mask.id, mask.box)
mask.save(f"{mask.id}.png")
# A transcript, with timestamps.
result = f.run(model="whisper", input={"audio": "meeting.mp3"})
print(result.transcript.text)
for segment in result.transcript.segments:
print(f"{segment.start:6.1f}s {segment.text}")
That is the whole surface for most work: run() with a model id and an
input, then read the typed answer.
Rules worth knowing
- Files go in by path, URL or bytes under the keys
image,images,audioandvideo. The client uploads them and sends a reference. (A chat model that reads images takes them as URLs, sent as written.) - Answers are typed.
.text,.images,.masks,.transcript. Asking a result for the wrong kind raises, rather than returning something empty. - Files come back as handles.
.save(path)writes one;.read()returns the bytes. They stay on the server until you ask. - Retries are safe. Every
run()carries an idempotency key and is retried on connection failures and on 429/502/503/504, so a retry never runs — or bills — the work twice. - Errors say what to change. A refused input raises
InvalidInputwhose message names the field and a value that works. - Usage is in the model's own unit: tokens,
images,audio_seconds.result.usage.unitshas it.
Which models exist
for model in f.models.catalog():
print(model["id"], model.get("output"), model["unit"])
output says what kind of answer a model returns — image, masks,
transcript — so code can pick a model by what it produces.
Longer work
handle = f.submit(model="flux-schnell", input={"prompt": "..."})
result = handle.wait()
submit returns before the work runs and survives your process exiting.
Metadata
Release files for factorial-compute 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| factorial_compute-0.0.1.tar.gz | 20.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| factorial_compute-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.8 kB
Release files / factorial_compute-0.0.1.tar.gz
| Download URL | factorial_compute-0.0.1.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25400aa01b7ff5d002097b88c2df0e3208eaf7eb9a24713a04d711aff012ce09
|
|
BLAKE2b-256 checksum How to use checksums |
b6c3dc7f2ac209cd1340f6708be4dc1375a9775c27d2e28cf39e7cedf70f3f71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / factorial_compute-0.0.1-py3-none-any.whl
| Download URL | factorial_compute-0.0.1-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1477896cd386f1b3f986450848add4a22e2abe3e0a61a0985531e2da8092c2e7
|
|
BLAKE2b-256 checksum How to use checksums |
292e972b83e0585a0b48ee76537c43c199b8d5e70a6cd5b414786dbc609237bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency log