Skip to Content

Introduction

Endpoints for open models, Serverless or Dedicated, called with your key.

TensorFactory makes endpoints for open models. Call a Serverless endpoint and pay per call, or deploy a model from Hugging Face to a Dedicated endpoint of your own. You call every endpoint with your API key over REST, JSON in and out. Today's Serverless models make and edit images; each image has a fixed price, known before it runs.

Base URLhttps://tensorfactory.ai/v1
AuthAuthorization: Bearer $TENSORFACTORY_API_KEY
Modelsqwen-image/text-to-image, qwen-image/edit, qwen-image/camera-angle, qwen-image/inpaint
TimesUTC, ISO 8601

Keys work from servers only: the API sends no CORS headers. Keep your key out of browser code.

Quickstart

Sign in at /login with your DV account, Deep Variance's sign-in shared with DV4. A new email gets an account.

Create a key on API keys and keep it on your server:

export TENSORFACTORY_API_KEY=tf_...

A key can stop working on a day you choose, up to a year ahead, or never. You can change that day or remove it later from the key's menu.

Make your first image. The answer is 202 with the generation's id, which this saves as ID (it needs jq):

ID=$(curl -s https://tensorfactory.ai/v1/generations \
  -H "Authorization: Bearer $TENSORFACTORY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"model": "qwen-image/text-to-image", "prompt": "A brass microscope on a graph-paper notebook, warm window light"}' | jq -r .id)

Poll until status is done, then download result.image_url right away: it is deleted after the first download, or 10 minutes after the run if nobody downloads it.

curl "https://tensorfactory.ai/v1/generations/$ID?wait=10" \
  -H "Authorization: Bearer $TENSORFACTORY_API_KEY"

Next

On this page