Sign in Get started

Deployments

Turn a trained model into a GPU inference endpoint with its own /predict URL and token, billed by uptime. Create, call and scale it from the SDK, CLI or REST.

View as Markdown
On this page

Create a deployment, wait for it to start, then call its URL. It serves your model as a TensorRT engine built for the GPU and precision you choose.

from pictograph import Client, CreatedDeployment, Deployment

client = Client()

created: CreatedDeployment = client.deployments.create(
    model="Swift Falcon",
    region="us-west",
    gpu_type="t4",
    precision="fp32",
    min_containers=1,
)
print(created.auth_token)  # pk_deploy_..., shown once; a member can reveal it again in the app

deployment: Deployment = client.deployments.wait_until_active(
    deployment=created.deployment,
)
print(deployment.endpoint_url)
pictograph deployments create "Swift Falcon" --region us-west --gpu t4 --precision fp32 --min 1 --wait

Every argument: deployments.create.

Region

A deployment runs in one region, fixed when it’s created: us-east (Virginia) or us-west (Oregon). Pick the one nearest its callers; without region (or with "auto"), the region nearest the creating call is used. When the region has no free GPU for 30 seconds, requests are served elsewhere in the US at the same price (details).

GPU and precision

There is no CPU tier.

gpu_type GPU memory Container Use it for
t4 (default) 16 GB 4 CPU cores, 4 GiB Detection and classification at the lowest cost
l4 24 GB 4 CPU cores, 4 GiB Better price for performance, and higher resolutions
a100 40 GB 8 CPU cores, 8 GiB The lowest latency on the largest models

precision="fp32" (the default) serves the model as trained; "fp16" is faster and as accurate, though not output-identical. On a live 1080p camera, YOLOX-s answers each frame 3.75 ms after capture on an L4 and 8.78 ms on a T4, both in FP16 (measured).

Starting up

create returns at once with the deployment provisioning; it turns active in about a minute, or a few minutes more the first time a model is built for a GPU and precision (unbilled). wait_until_active waits. Once active, runtime.state is live, starting, waiting or asleep, and reading it never wakes the deployment (states).

Calling the endpoint

The endpoint takes the deployment’s own pk_deploy_ token, not your API key.

from pictograph import DeploymentClient, DetectionResult

infer = DeploymentClient(
    endpoint=deployment.endpoint_url,
    api_key="pk_deploy_...",
    task="object_detection",
)
result: DetectionResult = infer.infer(image="./frame.jpg")  # a path, a URL or bytes

for p in result.predictions:
    print(p.name, round(p.confidence, 2), p.bounding_box)
print(result.backend, result.device, result.inference_ms)  # tensorrt cuda 13.4
curl -X POST "$ENDPOINT_URL" \
  -H "Authorization: Bearer pk_deploy_..." \
  -F "file=@frame.jpg"

infer() returns the same typed results as local inference. DeploymentClient retries 429, 5xx and dropped connections, and waits out a sleeping deployment’s start. Request body, headers and errors: Calling your deployment.

Edge

An edge deployment runs in the browser of whoever opens it, on that device’s own GPU (WebGPU): the model’s ONNX graph runs on that GPU, and Pictograph’s engine, compiled to WebAssembly, prepares each frame and reads, draws and logs its results. It holds no GPU of ours, so nothing is provisioned or billed for compute, and it has no endpoint or token. Open it in the app (Deployments, then Run) to stream a camera or a video through it, or to run an image; its frames are logged like a cloud deployment’s.

created = client.deployments.create(
    model="Swift Falcon",
    environment="edge",
)
deployment = client.deployments.wait_until_active(deployment=created.deployment)
print(deployment.precision, created.auth_token)  # fp16 None
pictograph deployments create "Swift Falcon" --environment edge --wait

It runs at FP16 unless you choose FP32. FP16 is about half the download and faster; a GPU without 16-bit shaders runs the model’s FP32 graph instead. Every model can run at FP16: the first time one is deployed to the edge at FP16, its FP16 graph is built (a minute or two, not billed) and the deployment waits as provisioning until it is ready. A region, GPU, scaling or request limit given for it is refused. It needs a browser with WebGPU: Chrome or Edge on a computer, or Safari on macOS 26 and later. client.deployments.edge_session(deployment) returns what a browser runs it with: its graph (and the FP32 graph it falls back to), the config the engine reads it by, its defaults and its log. client.deployments.edge_stream(deployment) opens one of its streams to run yourself in the edge engine, with its Passive capture when you pass outputs (Save a stream’s frames).

Cost

A deployment is billed while it’s up, plus its requests’ data transfer (a 640x480 JPEG and its answer are about 170 KB; a 20 fps camera sends about 12 GiB an hour). Price it first:

quote = client.deployments.quote(
    gpu_type="t4",
    min_containers=0,
    max_containers=2,
)
print(quote.cost_per_hour_micro_usd, quote.max_cost_per_hour_micro_usd, quote.transfer_per_gib_micro_usd)

To spend less:

  • Pause - pause stops the meter; resume restarts it in about a minute.
  • Scale to zero - with min_containers=0 it bills only while a container is up; the first request after it sleeps waits for one to start.
  • Scale - update(min_containers=..., max_containers=..., scaledown_window=...) applies to a live deployment at once.
  • Auto-pause - it pauses itself when your balance reaches zero.
deployment = client.deployments.update(
    deployment="prod-detector",
    min_containers=0,
    scaledown_window=120,
)
pictograph deployments update prod-detector --min-containers 0 --scaledown-window 120

There’s no request cap unless you set rate_limit_rpm (request limit).

Next

  • Workflows - chain models, tracking and counting; a workflow serves itself, with no deployment
  • Deployments API - every call and field
Copied to clipboard