Deployments API
Serve a trained model as a TensorRT endpoint on a GPU: create, call, scale, pause and delete deployments, and stream live video through them.
On this page
- Regions
- Provisioning
- Live state
- Request limit
- Price it
- compute_options
- quote
- Manage
- create
- wait_until_active
- get
- list
- iter
- update
- pause
- resume
- delete
- bulk_pause
- bulk_resume
- bulk_delete
- Edge
- edge_session
- edge_stream
- Calling your deployment
- connect
- Endpoint errors
- Streams
- Stream errors
- Live log
- logs
- Live log errors
- Common errors
A deployment is billed while it’s up, plus its requests’ data transfer; pause it to
stop the meter. Choosing a GPU and keeping cost down: Deployments guide.
Manage deployments with your API key; call one with its own pk_deploy_ token, which create
returns (Calling your deployment). An edge deployment runs in
the browser of whoever opens it instead, on that device’s GPU, and bills nothing.
Regions
A deployment runs in one region, fixed at create: its GPU and its endpoint are both there.
region |
Requests enter |
|---|---|
us-east (the default) |
Virginia |
us-west |
Oregon |
region="auto", the default for create and quote, picks the region
nearest the call; choose the one nearest the cameras and clients that call it. endpoint_url
names the region (https://workflows.pictograph.io/us-west/<slug>/predict), and only that
region answers it. To move a deployment, create another in the new region.
If the region has no free GPU for 30 seconds, a request or stream is also offered GPUs
elsewhere in the US; the first found serves until the deployment goes idle. Requests still
enter, and are priced, in the home region. region_fallback says whether a deployment can fall
back; runtime.fallback counts containers serving elsewhere, and a stream’s open response and
state show fallback.
Provisioning
create returns at once with the deployment provisioning. It turns active in
about a minute, or a few minutes the first time the model is deployed on that GPU at that
precision, while its TensorRT engine builds (unbilled; later deployments skip it). During the
build, engine_build.state is "building" (each model’s started_at, and estimate_s from
earlier builds on that GPU), then "built" (build_s).
wait_until_active waits; the CLI waits with --wait.
A deployment that can’t start is failed with an error_message; it can’t be resumed, so
delete it and create it again. resume provisions a paused deployment the same way,
on the model’s current version. The GPU and precision are fixed at create; update
changes the rest.
Live state
An active deployment’s runtime says what it is doing now (None for any other status).
Reading it never wakes the deployment.
runtime.state |
Means |
|---|---|
live |
Serving, with containers up (and creating starting) |
starting |
creating containers are starting and loading the engine |
waiting |
A request waits for a GPU (since waiting_since), or a warm minimum has no container yet |
asleep |
Scaled to zero; the next request wakes it, in about 10 to 15 seconds when a GPU is free |
unknown |
The state couldn’t be read in time; read it again |
fallback counts the containers serving elsewhere in the US (Regions), and
checked_at is when it was read. Treat an unknown state as new, not an error. The CLI shows
it beside the status, e.g. active · waiting for a GPU 1m42s.
Request limit
There is no request cap by default; cost is bounded by max_containers and your budget.
rate_limit_rpm (1 to 1,000,000 a minute, set at create or update,
0 removes it) caps requests: past it, the endpoint answers 429 rate_limited with
Retry-After. A change reaches the endpoint within 30 seconds.
Price it
compute_options
What a deployment can run with, priced in one region.
Source: Deployments.compute_options
| Arg | Type | Default | Notes |
|---|---|---|---|
region |
str |
"auto" |
Region id, or auto for the one nearest the caller |
offer = client.deployments.compute_options()
for region in offer.regions:
print(region.id, region.label, region.location) # us-east US East Virginia
for option in offer.options:
print(option.gpu_type, option.vram_gb, option.cpu_cores, option.rate_per_min_micro_usd)
for precision in offer.precisions:
print(precision.precision, precision.label, precision.description)
pictograph deployments compute-options
curl -s "https://api.pictograph.io/api/v1/developer/deployments/compute-options" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns DeploymentComputeOptions
DeploymentComputeOptions · 5 fields
class DeploymentComputeOptions(BaseModel):
"""What a deployment may run with: the regions (and the one these prices are for), each GPU tier (its container and price there) and each precision its engine is built at, the default first."""
region: str | None = None
regions: list[DeploymentRegion] = []
options: list[DeploymentComputeOption] = []
precisions: list[DeploymentComputePrecision] = []
transfer_per_gib_micro_usd: int | None = None
Time each region’s ping_url; the fastest is nearest you.
quote
What a deployment would cost while it’s up, before you create it.
Source: Deployments.quote
| Arg | Type | Default | Notes |
|---|---|---|---|
gpu_type |
DeploymentGpuType |
"t4" |
t4 (16 GB), l4 (24 GB) or a100 (40 GB) |
min_containers |
int |
0 |
Containers kept warm; 0 quotes scale-to-zero |
max_containers |
int |
1 |
Most containers it scales to |
region |
str |
"auto" |
Region id, or auto for the one nearest the caller; each region has its own price |
quote = client.deployments.quote(
gpu_type="t4",
min_containers=0,
max_containers=2,
region="us-west",
)
print(quote.rate_per_min_micro_usd, quote.cost_per_hour_micro_usd, quote.max_cost_per_hour_micro_usd)
print(quote.billing_note)
pictograph deployments quote --gpu t4 --min-containers 0 --max-containers 2 --region us-west
curl -s "https://api.pictograph.io/api/v1/developer/deployments/quote?gpu_type=t4&min_containers=0&max_containers=2®ion=us-west" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns DeploymentQuote
DeploymentQuote · 10 fields
class DeploymentQuote(BaseModel):
"""What a deployment costs while it is up, before creating it, in micro-USD."""
rate_per_min_micro_usd: int
container_cost_per_hour_micro_usd: int | None = None
cost_per_hour_micro_usd: int
cost_per_day_micro_usd: int
warm_cost_per_hour_micro_usd: int | None = None
warm_cost_per_day_micro_usd: int | None = None
max_cost_per_hour_micro_usd: int | None = None
transfer_per_gib_micro_usd: int | None = None
scale_to_zero: bool
billing_note: str
Each price is an hour of:
cost_per_hour_micro_usd: running (min_containerscontainers, or one if it scales to zero)warm_cost_per_hour_micro_usd: the containers kept warm (0when it scales to zero)max_cost_per_hour_micro_usd: allmax_containersrunning
transfer_per_gib_micro_usd is a GiB of data transfer (the images sent and the answers),
charged on top, the same on every GPU and in every region.
Manage
create
Deploy a trained model. The response carries its pk_deploy_ token, which the API never
returns again (a member can reveal it in the app: Run on the deployment, then
Overview). Wait for it with wait_until_active. With
environment="edge" it runs in the browser instead, at FP16 unless told otherwise, with no token
(Edge).
Source: Deployments.create
| Arg | Type | Default | Notes |
|---|---|---|---|
model |
str |
required | Model name or id; must be ready |
name |
str | None |
None |
Unique among your live deployments (default: the model’s name) |
environment |
DeploymentEnvironment |
"cloud" |
cloud (a GPU in its region) or edge (the browser of whoever opens it, on that device’s GPU), which takes only name, precision and inference_config (Edge) |
region |
str |
"auto" |
us-east, us-west, or auto (nearest the caller); can’t change later (Regions) |
gpu_type |
DeploymentGpuType |
"t4" |
t4 (16 GB), l4 (24 GB) or a100 (40 GB) |
precision |
DeploymentPrecision | None |
None |
fp32 serves the model as trained; fp16 is faster and as accurate, but not output-identical. None: fp32 in the cloud, fp16 on the edge |
min_containers |
int |
0 |
Containers kept warm, and billed, 0 to 5; 0 scales to zero |
max_containers |
int |
1 |
Most containers it scales to, 1 to 10 |
scaledown_window |
int |
60 |
Seconds a container stays after its last request, 2 to 3600 |
rate_limit_rpm |
int | None |
None |
Max requests a minute before the endpoint answers 429 (request limit); none by default |
inference_config |
dict[str, Any] | None |
None |
Per-model defaults, e.g. a confidence threshold |
created = client.deployments.create(
model="Swift Falcon",
name="prod-detector",
region="us-west",
gpu_type="t4",
precision="fp32",
min_containers=0,
max_containers=2,
scaledown_window=60,
)
print(created.deployment.id, created.deployment.status) # ... provisioning
print(created.auth_token) # pk_deploy_... - store it now
pictograph deployments create "Swift Falcon" \
--name prod-detector --region us-west --gpu t4 --precision fp32 --min 0 --max 2 --scaledown 60 --wait
curl -s -X POST "https://api.pictograph.io/api/v1/developer/deployments/" \
-H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
-d '{"model": "Swift Falcon", "name": "prod-detector", "region": "us-west", "gpu_type": "t4", "precision": "fp32", "min_containers": 0, "max_containers": 2, "scaledown_window": 60}'
Returns CreatedDeployment
CreatedDeployment · 2 fields
class CreatedDeployment(BaseModel):
"""What `create` returns: the deployment and its token, shown once."""
deployment: Deployment
# The deployment's bearer token. The API returns it only here; a member can reveal
# it again in the app. None for an edge deployment: nothing calls it.
auth_token: str | None = None
wait_until_active
Wait until a deployment is active after create or resume
(how long).
Source: Deployments.wait_until_active
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
str | Deployment |
required | Deployment name or id, or the Deployment that create or resume returned |
timeout |
float |
900.0 |
Max seconds to wait |
poll_interval |
float |
3.0 |
Seconds between checks |
deployment = client.deployments.wait_until_active(
deployment="prod-detector",
timeout=900.0,
)
print(deployment.status, deployment.endpoint_url) # active https://.../predict
pictograph deployments wait prod-detector --timeout 900
# There is no wait endpoint: poll the deployment until its status is "active".
curl -s "https://api.pictograph.io/api/v1/developer/deployments/prod-detector" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns Deployment
Deployment · 39 fields
class Deployment(BaseModel):
"""A model inference deployment: provisioning, active, paused, failed or terminated."""
id: str
organization_id: str
model_id: str
version_id: str | None = None
name: str
readme: str | None = None
status: Literal['draft', 'provisioning', 'active', 'paused', 'failed', 'terminated']
environment: str = 'cloud'
region: str | None = None
compute_type: Literal['cpu', 'gpu'] = 'gpu'
gpu_type: str | None = None
precision: str = 'fp32'
min_containers: int
max_containers: int
scaledown_window: int
live_outputs: LiveOutputCounts | None = None
rate_limit_rpm: int | None = None
endpoint_url: str | None = None
auth_token_prefix: str | None = None
inference_config: dict[str, Any] = {}
engine_build: EngineBuild | None = None
error_message: str | None = None
cost_rate_per_min: int = 0
cost_per_hour_micro_usd: int | None = None
max_cost_per_hour_micro_usd: int | None = None
transfer_per_gib_micro_usd: int | None = None
accrued_cost_micro_usd: int = 0
uptime_seconds: int = 0
transfer_bytes: int = 0
transfer_cost_micro_usd: int = 0
metrics: DeploymentMetrics | None = None
runtime: DeploymentRuntime | None = None
stream_limit: int = 0
region_fallback: bool = False
logged: bool | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
started_at: datetime | None = None
paused_at: datetime | None = None
A deployment that scales to zero may be asleep once active; its first request wakes it. A
failure raises ApiError with code job_failed (job_cancelled if it’s paused or deleted
meanwhile) and the deployment as its response. The CLI exits 1 on a failure and 10 on a
timeout.
get
One deployment. Reading it never wakes it.
Source: Deployments.get
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
str |
required | Deployment name or id |
deployment = client.deployments.get(deployment="prod-detector")
print(deployment.status, deployment.gpu_type, deployment.precision, deployment.endpoint_url)
if deployment.runtime is not None:
print(deployment.runtime.state) # live, starting, waiting, asleep or unknown
if deployment.engine_build is not None:
print(deployment.engine_build.state) # building, then built
pictograph deployments get prod-detector
curl -s "https://api.pictograph.io/api/v1/developer/deployments/prod-detector" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns Deployment
Deployment · 39 fields
class Deployment(BaseModel):
"""A model inference deployment: provisioning, active, paused, failed or terminated."""
id: str
organization_id: str
model_id: str
version_id: str | None = None
name: str
readme: str | None = None
status: Literal['draft', 'provisioning', 'active', 'paused', 'failed', 'terminated']
environment: str = 'cloud'
region: str | None = None
compute_type: Literal['cpu', 'gpu'] = 'gpu'
gpu_type: str | None = None
precision: str = 'fp32'
min_containers: int
max_containers: int
scaledown_window: int
live_outputs: LiveOutputCounts | None = None
rate_limit_rpm: int | None = None
endpoint_url: str | None = None
auth_token_prefix: str | None = None
inference_config: dict[str, Any] = {}
engine_build: EngineBuild | None = None
error_message: str | None = None
cost_rate_per_min: int = 0
cost_per_hour_micro_usd: int | None = None
max_cost_per_hour_micro_usd: int | None = None
transfer_per_gib_micro_usd: int | None = None
accrued_cost_micro_usd: int = 0
uptime_seconds: int = 0
transfer_bytes: int = 0
transfer_cost_micro_usd: int = 0
metrics: DeploymentMetrics | None = None
runtime: DeploymentRuntime | None = None
stream_limit: int = 0
region_fallback: bool = False
logged: bool | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
started_at: datetime | None = None
paused_at: datetime | None = None
list
One page of deployments.
Source: Deployments.list
| Arg | Type | Default | Notes |
|---|---|---|---|
model |
str | None |
None |
Only this model’s deployments, by name or id |
name |
str | None |
None |
Only the deployment with this exact name |
status |
DeploymentStatus | None |
None |
Only this status: provisioning, active, paused, failed or terminated |
limit |
int |
50 |
Page size |
offset |
int |
0 |
Items to skip |
for deployment in client.deployments.list(status="active", limit=50):
print(deployment.name, deployment.status, deployment.endpoint_url)
pictograph deployments list --status active --limit 50
curl -s "https://api.pictograph.io/api/v1/developer/deployments/?status=active&limit=50" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns list[Deployment]
Deployment · 39 fields
class Deployment(BaseModel):
"""A model inference deployment: provisioning, active, paused, failed or terminated."""
id: str
organization_id: str
model_id: str
version_id: str | None = None
name: str
readme: str | None = None
status: Literal['draft', 'provisioning', 'active', 'paused', 'failed', 'terminated']
environment: str = 'cloud'
region: str | None = None
compute_type: Literal['cpu', 'gpu'] = 'gpu'
gpu_type: str | None = None
precision: str = 'fp32'
min_containers: int
max_containers: int
scaledown_window: int
live_outputs: LiveOutputCounts | None = None
rate_limit_rpm: int | None = None
endpoint_url: str | None = None
auth_token_prefix: str | None = None
inference_config: dict[str, Any] = {}
engine_build: EngineBuild | None = None
error_message: str | None = None
cost_rate_per_min: int = 0
cost_per_hour_micro_usd: int | None = None
max_cost_per_hour_micro_usd: int | None = None
transfer_per_gib_micro_usd: int | None = None
accrued_cost_micro_usd: int = 0
uptime_seconds: int = 0
transfer_bytes: int = 0
transfer_cost_micro_usd: int = 0
metrics: DeploymentMetrics | None = None
runtime: DeploymentRuntime | None = None
stream_limit: int = 0
region_fallback: bool = False
logged: bool | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
started_at: datetime | None = None
paused_at: datetime | None = None
iter
Every deployment, fetched page by page.
Source: Deployments.iter
| Arg | Type | Default | Notes |
|---|---|---|---|
model |
str | None |
None |
As in list |
name |
str | None |
None |
As in list |
status |
DeploymentStatus | None |
None |
As in list |
page_size |
int |
50 |
Items fetched per request |
max_total |
int | None |
None |
Stop after this many items |
for deployment in client.deployments.iter(page_size=50):
print(deployment.name, deployment.status)
curl -s "https://api.pictograph.io/api/v1/developer/deployments/?limit=50&offset=0" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
# The CLI does not auto-page; this is a single page.
pictograph deployments list
Returns OffsetPager[Deployment]
Deployment · 39 fields
class Deployment(BaseModel):
"""A model inference deployment: provisioning, active, paused, failed or terminated."""
id: str
organization_id: str
model_id: str
version_id: str | None = None
name: str
readme: str | None = None
status: Literal['draft', 'provisioning', 'active', 'paused', 'failed', 'terminated']
environment: str = 'cloud'
region: str | None = None
compute_type: Literal['cpu', 'gpu'] = 'gpu'
gpu_type: str | None = None
precision: str = 'fp32'
min_containers: int
max_containers: int
scaledown_window: int
live_outputs: LiveOutputCounts | None = None
rate_limit_rpm: int | None = None
endpoint_url: str | None = None
auth_token_prefix: str | None = None
inference_config: dict[str, Any] = {}
engine_build: EngineBuild | None = None
error_message: str | None = None
cost_rate_per_min: int = 0
cost_per_hour_micro_usd: int | None = None
max_cost_per_hour_micro_usd: int | None = None
transfer_per_gib_micro_usd: int | None = None
accrued_cost_micro_usd: int = 0
uptime_seconds: int = 0
transfer_bytes: int = 0
transfer_cost_micro_usd: int = 0
metrics: DeploymentMetrics | None = None
runtime: DeploymentRuntime | None = None
stream_limit: int = 0
region_fallback: bool = False
logged: bool | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
started_at: datetime | None = None
paused_at: datetime | None = None
update
Change a deployment’s name, README, autoscaling or request limit; only what you pass changes. An active deployment takes a scaling change at once, without a restart; a provisioning or paused one when it next starts. A rename keeps its endpoint and token. To change the GPU or precision, deploy again.
Source: Deployments.update
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
str |
required | Deployment name or id |
min_containers |
int | None |
None |
As in create |
max_containers |
int | None |
None |
As in create; at least min_containers |
scaledown_window |
int | None |
None |
As in create |
name |
str | None |
None |
New name, unique among your live deployments; up to 100 characters, no / |
readme |
str | None |
None |
README in Markdown, up to 20,000 characters; "" clears it |
rate_limit_rpm |
int | None |
None |
New request limit; 0 removes it |
deployment = client.deployments.update(
deployment="prod-detector",
min_containers=1,
max_containers=3,
scaledown_window=300,
readme="Dock cameras, 6am - 10pm.",
)
print(deployment.status, deployment.min_containers, deployment.max_containers) # active 1 3
pictograph deployments update prod-detector \
--min-containers 1 --max-containers 3 --scaledown-window 300 \
--readme "Dock cameras, 6am - 10pm."
curl -s -X PATCH "https://api.pictograph.io/api/v1/developer/deployments/prod-detector" \
-H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
-d '{"min_containers": 1, "max_containers": 3, "scaledown_window": 300, "readme": "Dock cameras, 6am - 10pm."}'
Returns Deployment
Deployment · 39 fields
class Deployment(BaseModel):
"""A model inference deployment: provisioning, active, paused, failed or terminated."""
id: str
organization_id: str
model_id: str
version_id: str | None = None
name: str
readme: str | None = None
status: Literal['draft', 'provisioning', 'active', 'paused', 'failed', 'terminated']
environment: str = 'cloud'
region: str | None = None
compute_type: Literal['cpu', 'gpu'] = 'gpu'
gpu_type: str | None = None
precision: str = 'fp32'
min_containers: int
max_containers: int
scaledown_window: int
live_outputs: LiveOutputCounts | None = None
rate_limit_rpm: int | None = None
endpoint_url: str | None = None
auth_token_prefix: str | None = None
inference_config: dict[str, Any] = {}
engine_build: EngineBuild | None = None
error_message: str | None = None
cost_rate_per_min: int = 0
cost_per_hour_micro_usd: int | None = None
max_cost_per_hour_micro_usd: int | None = None
transfer_per_gib_micro_usd: int | None = None
accrued_cost_micro_usd: int = 0
uptime_seconds: int = 0
transfer_bytes: int = 0
transfer_cost_micro_usd: int = 0
metrics: DeploymentMetrics | None = None
runtime: DeploymentRuntime | None = None
stream_limit: int = 0
region_fallback: bool = False
logged: bool | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
started_at: datetime | None = None
paused_at: datetime | None = None
pause
Pause a deployment: its containers and its billing stop.
Source: Deployments.pause
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
str |
required | Deployment name or id |
deployment = client.deployments.pause(deployment="prod-detector")
print(deployment.status) # paused - uptime billing stops here
pictograph deployments pause prod-detector
curl -s -X POST "https://api.pictograph.io/api/v1/developer/deployments/prod-detector/pause" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns Deployment
Deployment · 39 fields
class Deployment(BaseModel):
"""A model inference deployment: provisioning, active, paused, failed or terminated."""
id: str
organization_id: str
model_id: str
version_id: str | None = None
name: str
readme: str | None = None
status: Literal['draft', 'provisioning', 'active', 'paused', 'failed', 'terminated']
environment: str = 'cloud'
region: str | None = None
compute_type: Literal['cpu', 'gpu'] = 'gpu'
gpu_type: str | None = None
precision: str = 'fp32'
min_containers: int
max_containers: int
scaledown_window: int
live_outputs: LiveOutputCounts | None = None
rate_limit_rpm: int | None = None
endpoint_url: str | None = None
auth_token_prefix: str | None = None
inference_config: dict[str, Any] = {}
engine_build: EngineBuild | None = None
error_message: str | None = None
cost_rate_per_min: int = 0
cost_per_hour_micro_usd: int | None = None
max_cost_per_hour_micro_usd: int | None = None
transfer_per_gib_micro_usd: int | None = None
accrued_cost_micro_usd: int = 0
uptime_seconds: int = 0
transfer_bytes: int = 0
transfer_cost_micro_usd: int = 0
metrics: DeploymentMetrics | None = None
runtime: DeploymentRuntime | None = None
stream_limit: int = 0
region_fallback: bool = False
logged: bool | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
started_at: datetime | None = None
paused_at: datetime | None = None
resume
Resume a paused deployment; it provisions again on its model’s current version.
Source: Deployments.resume
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
str |
required | Deployment name or id |
deployment = client.deployments.resume(deployment="prod-detector")
print(deployment.status) # provisioning
deployment = client.deployments.wait_until_active(deployment=deployment)
print(deployment.status, deployment.endpoint_url) # active ...
pictograph deployments resume prod-detector --wait
curl -s -X POST "https://api.pictograph.io/api/v1/developer/deployments/prod-detector/resume" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns Deployment
Deployment · 39 fields
class Deployment(BaseModel):
"""A model inference deployment: provisioning, active, paused, failed or terminated."""
id: str
organization_id: str
model_id: str
version_id: str | None = None
name: str
readme: str | None = None
status: Literal['draft', 'provisioning', 'active', 'paused', 'failed', 'terminated']
environment: str = 'cloud'
region: str | None = None
compute_type: Literal['cpu', 'gpu'] = 'gpu'
gpu_type: str | None = None
precision: str = 'fp32'
min_containers: int
max_containers: int
scaledown_window: int
live_outputs: LiveOutputCounts | None = None
rate_limit_rpm: int | None = None
endpoint_url: str | None = None
auth_token_prefix: str | None = None
inference_config: dict[str, Any] = {}
engine_build: EngineBuild | None = None
error_message: str | None = None
cost_rate_per_min: int = 0
cost_per_hour_micro_usd: int | None = None
max_cost_per_hour_micro_usd: int | None = None
transfer_per_gib_micro_usd: int | None = None
accrued_cost_micro_usd: int = 0
uptime_seconds: int = 0
transfer_bytes: int = 0
transfer_cost_micro_usd: int = 0
metrics: DeploymentMetrics | None = None
runtime: DeploymentRuntime | None = None
stream_limit: int = 0
region_fallback: bool = False
logged: bool | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
started_at: datetime | None = None
paused_at: datetime | None = None
delete
Delete a deployment: its endpoint and token stop working and its billing stops. It can’t be undone.
Source: Deployments.delete
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
str |
required | Deployment name or id |
client.deployments.delete(deployment="prod-detector")
pictograph deployments delete prod-detector --yes
curl -s -X DELETE "https://api.pictograph.io/api/v1/developer/deployments/prod-detector" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns None
bulk_pause
Pause several deployments in one call. A name that isn’t found is listed in not_found.
Source: Deployments.bulk_pause
| Arg | Type | Default | Notes |
|---|---|---|---|
deployments |
Sequence[str] |
required | Deployment names or ids |
result = client.deployments.bulk_pause(
deployments=["prod-detector", "staging-detector"],
)
print(result.count, "changed;", result.not_found, "not found")
# Several names make one call.
pictograph deployments pause prod-detector staging-detector
curl -s -X POST "https://api.pictograph.io/api/v1/developer/deployments/bulk-pause" \
-H "X-API-Key: $PICTOGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"deployments": ["prod-detector", "staging-detector"]}'
Returns BulkActionResult
BulkActionResult · 3 fields
class BulkActionResult(BaseModel):
"""What a bulk change (pause, resume, cancel) did."""
# Ids this call changed.
succeeded: list[str] = []
# Ids not found, or not in a state it could change.
not_found: list[str] = []
# How many were changed.
count: int = 0
bulk_resume
Resume several paused deployments in one call; each provisions again. A name that isn’t found is listed in not_found.
Source: Deployments.bulk_resume
| Arg | Type | Default | Notes |
|---|---|---|---|
deployments |
Sequence[str] |
required | Deployment names or ids |
result = client.deployments.bulk_resume(
deployments=["prod-detector", "staging-detector"],
)
print(result.count, "changed;", result.not_found, "not found")
# Several names make one call.
pictograph deployments resume prod-detector staging-detector
curl -s -X POST "https://api.pictograph.io/api/v1/developer/deployments/bulk-resume" \
-H "X-API-Key: $PICTOGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"deployments": ["prod-detector", "staging-detector"]}'
Returns BulkActionResult
BulkActionResult · 3 fields
class BulkActionResult(BaseModel):
"""What a bulk change (pause, resume, cancel) did."""
# Ids this call changed.
succeeded: list[str] = []
# Ids not found, or not in a state it could change.
not_found: list[str] = []
# How many were changed.
count: int = 0
bulk_delete
Delete several deployments in one call. A name that isn’t found is listed in not_found.
Source: Deployments.bulk_delete
| Arg | Type | Default | Notes |
|---|---|---|---|
deployments |
Sequence[str] |
required | Deployment names or ids |
result = client.deployments.bulk_delete(
deployments=["prod-detector", "staging-detector"],
)
print(result.count, "changed;", result.not_found, "not found")
# Several names make one call.
pictograph deployments delete prod-detector staging-detector --yes
curl -s -X POST "https://api.pictograph.io/api/v1/developer/deployments/bulk-delete" \
-H "X-API-Key: $PICTOGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"deployments": ["prod-detector", "staging-detector"]}'
Returns BulkDeleteResult
BulkDeleteResult · 3 fields
class BulkDeleteResult(BaseModel):
"""What a bulk delete removed."""
# Ids that existed and were deleted.
succeeded: list[str] = []
# Ids that were not found.
not_found: list[str] = []
# How many were deleted.
count: int = 0
# The same as succeeded.
@property
def deleted(self) -> list[str]: ...
Edge
An edge deployment runs in the browser of whoever opens it, on that device’s own GPU (WebGPU):
it holds no GPU of ours, so it has no endpoint or token and nothing is billed for compute. Create
one with create and environment="edge", then run it from its Run view in the app
(Deployments, then Run). It runs at FP16 unless you pass precision="fp32"; when its
model has no FP16 graph yet, one is built first (a minute or two, not billed) and the deployment
is provisioning until then (wait_until_active waits for it). Choosing
one: Deployments guide.
edge_session
What a browser runs an edge deployment with: its ONNX graph (a download URL good for 60
minutes, and the key its bytes are cached by), the config its engine reads it by, its inference
defaults, the look its live view is drawn in, and where its log is written. The app’s Run view
runs it from exactly this. Any role may ask and it costs nothing; a cloud deployment, or one that
is not active, answers 409.
Source: Deployments.edge_session
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
str |
required | Deployment name or id |
session = client.deployments.edge_session(deployment="lobby-kiosk")
print(session.graph.filename, session.graph.bytes, session.graph.precision)
print(session.expires_at) # its graph URL and log token last until then
pictograph deployments edge-session lobby-kiosk
curl -s -X POST "https://api.pictograph.io/api/v1/developer/deployments/lobby-kiosk/edge-session" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns EdgeSession
EdgeSession · 10 fields
class EdgeSession(BaseModel):
"""What a browser runs an edge deployment with (`deployments.edge_session`): its graph, the config its engine reads it by, its inference defaults, the look its live view is drawn in, and its log."""
deployment_id: str
name: str | None = None
model: dict[str, Any]
graph: EdgeGraph
fallback: EdgeGraph | None = None
config: dict[str, Any]
inference_config: dict[str, Any] = {}
visualization: dict[str, Any] = {}
log: EdgeLog | None = None
expires_at: datetime
edge_stream
Opens one stream of an edge deployment for you to run yourself in the edge engine: its session spec
(a cloud stream’s own, its one source this stream’s), its model’s ONNX graph and config, its outputs as
resolved, its own token (good until expires_at), where its events go (events_url) and its log. The
app’s Run view streams it from exactly this; its image test uses edge_session.
outputs takes passive_capture alone: a frame every every_s seconds, with the model’s predictions,
saved into a dataset folder (Save a stream’s frames). Anything
else raises ValueError before any request. Writing takes a member or above; with no outputs any role
may open one. A cloud deployment, or one that is not active, answers 409.
Source: Deployments.edge_stream
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
str |
required | Deployment name or id |
outputs |
RunOutputs | None |
None |
What the stream writes beside its log: passive_capture alone |
session = client.deployments.edge_stream(
deployment="lobby-kiosk",
outputs={"passive_capture": {"dataset": "Lobby frames", "every_s": 10}},
)
print(session.session_id, session.outputs, session.events_url)
pictograph deployments edge-stream lobby-kiosk \
--outputs '{"passive_capture": {"dataset": "Lobby frames", "every_s": 10}}'
curl -s -X POST "https://api.pictograph.io/api/v1/developer/deployments/lobby-kiosk/edge-sessions" \
-H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
-d '{"outputs": {"passive_capture": {"dataset": "Lobby frames", "every_s": 10}}}'
Returns EdgeStreamSession
EdgeStreamSession · 14 fields
class EdgeStreamSession(BaseModel):
"""A stream of an EDGE deployment (pictograph.resources.deployments.Deployments.edge_stream) or workflow (pictograph.models.workflow.WorkflowEdgeSession): what a browser - or a client of your own - runs it with in the browser's edge engine. Its `spec` (its one source this session's), each of its `models`, its `outputs` as resolved, its own `token` (good until `expires_at`: its batches' Bearer), `events_url` (a path on the API: where its events and its end go), its `log` and its watermark (`mark`: base64 bytes, or None). Its stream runs at most `max_seconds`; each model's graph URL lapses at `graphs_expire_at`."""
session_id: str
token: str
endpoint_id: str
spec: dict[str, Any]
models: list[EdgeStreamModel]
outputs: dict[str, Any] | None = None
captures: dict[str, Any] | None = None
events_url: str
log: EdgeLog | None = None
mark: dict[str, Any] | None = None
opened_at: datetime | None = None
max_seconds: int
expires_at: datetime
graphs_expire_at: datetime | None = None
Calling your deployment
Call a deployment’s endpoint_url (it ends in /predict) with its pk_deploy_ token as a
bearer, not your API key.
Source: DeploymentClient
infer arg |
Type | Default | Notes |
|---|---|---|---|
image |
str | bytes | Path |
required | File path, http(s):// URL or bytes |
confidence |
float | None |
None |
Minimum score, overriding the deployment’s default |
class_filter |
list[str] | None |
None |
Only these classes |
top_k |
int | None |
None |
Predictions to return (classifiers only) |
from pictograph import Client, DetectionResult
client = Client()
deployment = client.deployments.get(deployment="prod-detector")
# `task=` narrows the result type, exactly as it does on get_model.
infer = client.deployments.connect(
deployment=deployment,
api_key="pk_deploy_...",
task="object_detection",
)
result: DetectionResult = infer.infer("photo.jpg", confidence=0.4)
for prediction in result.predictions:
print(prediction.name, round(prediction.confidence, 2), prediction.bounding_box)
# infer_raw(...) returns the endpoint's JSON untouched.
# --endpoint makes the pk_deploy_ token the only credential needed.
pictograph deployments predict prod-detector photo.jpg \
--token "pk_deploy_..." --confidence 0.4
# A video's sampled frames, or a dataset's images (read-only), one JSON line each:
pictograph deployments predict prod-detector --video aisle.mp4 --token "pk_deploy_..."
# A local file as multipart:
curl -s -X POST "$ENDPOINT_URL" \
-H "Authorization: Bearer pk_deploy_..." \
-F "file=@photo.jpg"
# Or a URL / base64 image as JSON, with options inline:
curl -s -X POST "$ENDPOINT_URL" \
-H "Authorization: Bearer pk_deploy_..." -H "Content-Type: application/json" \
-d '{"image": {"type": "url", "value": "https://example.com/photo.jpg"}, "confidence": 0.4}'
$ENDPOINT_URL is the deployment’s endpoint_url. The response is
{"model_type": ..., "predictions": [...]} (plus tags from a classifier). Every response
carries X-Request-Id; a successful one also carries X-Pictograph-Device: cuda and
Server-Timing (decode, infer and total milliseconds), which the SDK’s result reads as
device and inference_ms.
Given the URL, the token is the only credential: DeploymentClient(endpoint_url, "pk_deploy_...", task="object_detection"), or --endpoint <url> --token <token> on the CLI.
connect
A client for one deployment, called with its token: infer(...) returns the typed result
for its task, and infer_raw(...) the endpoint’s JSON.
Source: Deployments.connect
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
Deployment |
required | The deployment, as get, create or wait_until_active return it |
api_key |
str |
required | Its pk_deploy_ token, from create (or revealed in the app) |
task |
TaskName | None |
None |
Narrows the result type; None reads it from the deployment |
timeout |
float |
150.0 |
Seconds a prediction may take; longer than a sleeping deployment takes to wake |
deployment = client.deployments.get(deployment="prod-detector")
endpoint = client.deployments.connect(
deployment=deployment,
api_key="pk_deploy_...",
task="object_detection",
)
result = endpoint.infer("photo.jpg", confidence=0.4)
# No `connect` command - it returns an SDK object, not a request. The CLI
# reaches the same endpoint directly:
pictograph deployments predict prod-detector ./photo.jpg --token pk_deploy_...
# `connect` builds a client locally and issues no request of its own. What it
# then calls is the deployment's endpoint:
curl -s -X POST "$ENDPOINT_URL" \
-H "Authorization: Bearer pk_deploy_..." \
-F "file=@photo.jpg"
Returns DeploymentClient[Any]
Endpoint errors
The endpoint names what went wrong in error; the SDK raises the matching typed error
with that name as e.code and a fix saying what to do.
| Status | error |
Exception | Cause |
|---|---|---|---|
| 400 | could_not_decode_image, no_image_provided, invalid_option |
ValidationError |
The image couldn’t be read, or an option was refused |
| 401 | unauthorized |
AuthError |
Not this deployment’s pk_deploy_ token |
| 404 | deployment_not_found |
NotFoundError |
No deployment at this URL (a deleted one stops answering) |
| 409 | deployment_not_active |
ConflictError |
Still provisioning, or paused; wait for it or resume it |
| 413 | request_too_large |
ApiError |
The request is over 64 MiB |
| 429 | rate_limited |
RateLimitError |
Over its request limit (only when set); wait Retry-After, or raise or remove the limit |
| 502 | deployment_unreachable, deployment_unavailable |
ServerError |
Its server couldn’t be reached; retry shortly |
| 503 | deployment_starting |
ServerError |
A scaled-to-zero deployment’s container didn’t start within two minutes; retry after Retry-After |
| 503 | overloaded |
ServerError |
At capacity; retry after Retry-After, or raise max_containers |
| 503 | gateway_unavailable |
ServerError |
The endpoint couldn’t look up the deployment; retry after Retry-After |
| 504 | inference_timeout |
ServerError |
The model didn’t answer in time |
DeploymentClient retries a 429, a 5xx and a network failure (twice, by default), waiting
out a Retry-After.
Streams
A stream sends live video to an active deployment, with its token, and returns each frame’s results as it is processed. The app, the browser and the REST protocol: Streams guide.
Source: DeploymentClient.open_stream
open_stream arg |
Type | Default | Notes |
|---|---|---|---|
source |
str |
required | rtsp://... or rtsps://... (RTSP camera), https://... (WHEP camera), or "whip" to send video yourself |
overlay |
bool |
True |
Draw results on the live view |
stream |
bool |
True |
Send the live view’s pictures; with False, results, events, outputs and the log continue |
transport |
"auto", "tcp", "udp" |
None (tcp) |
RTSP only: "tcp" over the RTSP connection (works through NAT and firewalls), "auto" tries UDP first, "udp" only if the camera’s UDP reaches the deployment |
buffer_mode |
"auto", "none" |
None (auto) |
RTSP only: "none" keeps the sender’s timestamps, so a streamed recording is timed like its file |
reconnect |
"always", "never" |
None (always) |
RTSP only: "never" ends the stream at a recording’s end, after its last frame (ended == "source_ended") |
outputs |
RunOutputs | None |
None |
What to write beside the log: a model’s deployment takes passive_capture alone (Save a stream’s frames); a workflow’s stream takes annotated_video, event_capture, passive_capture and webhook (live outputs) |
confidence |
float | None |
None |
The confidence it opens at, over 0 and at most 1; None is the deployment’s own (Change the confidence) |
infer = client.deployments.connect(
deployment=deployment,
api_key="pk_deploy_...",
task="object_detection",
)
with infer.open_stream(source="rtsp://camera.example.com:554/live") as stream:
for frame in stream.frames():
print(frame.index, frame.latency_ms.engine, len(frame.result.predictions))
# One JSON line per frame, for 60 seconds; the stream stops when the command does.
pictograph deployments stream prod-detector rtsp://camera.example.com:554/live \
--token "pk_deploy_..." --seconds 60
# "whip": prints where to send the video, then each frame's results.
pictograph deployments stream prod-detector whip --token "pk_deploy_..." --frames 300
# Fail with exit code 9 (stream_stalled) after 5 seconds without a frame.
pictograph deployments stream prod-detector rtsp://camera.example.com:554/live \
--token "pk_deploy_..." --idle-timeout 5
# Results only: no live view is drawn or encoded.
pictograph deployments stream prod-detector rtsp://camera.example.com:554/live \
--token "pk_deploy_..." --no-stream
# Open at a confidence of 0.3 (the deployment's own otherwise).
pictograph deployments stream prod-detector rtsp://camera.example.com:554/live \
--token "pk_deploy_..." --confidence 0.3
# Streams open at the endpoint_url with /sessions in place of /predict.
curl -s -X POST "https://workflows.pictograph.io/us-west/7f3a91c2/sessions" \
-H "Authorization: Bearer pk_deploy_..." -H "Content-Type: application/json" \
-d '{"source": {"kind": "rtsp", "uri": "rtsp://camera.example.com:554/live"}}'
Returns a DeploymentStream:
| Member | What it is |
|---|---|
frames(idle_timeout=None) |
Yields a StreamFrame per frame until the stream ends; with idle_timeout, raises StreamStalledError after that many seconds without a frame |
messages(idle_timeout=None) |
Yields every raw message: frames, events, and a stats message each second (a heartbeat with each source’s last_frame_s while no frame comes) |
set_overlay(on) |
Turns drawing on the live view on or off from the next frame; returns the new setting |
set_stream(on) |
Turns the live view’s pictures on or off from the next frame (back on, it starts on a keyframe); returns the new setting |
set_confidence(confidence) |
Moves every whole-frame model’s confidence from the next frame (over 0, at most 1; held to at least 0.01); returns the one it runs at |
state() |
A StreamState: session, kind, opened_at, expires_at and engine (source, viewers, overlay, stream, and looks_skipped: frames not drawn because the live view was off) |
stop() |
Stops the stream (also when its with block ends); for a joined run’s live view, stops watching |
whep_url |
The live view, for any WHEP player, with the deployment token |
whip_url |
Where a "whip" stream’s video goes; None for a camera |
results_url |
The WebSocket frames() reads |
id, kind, overlay, stream, confidence, stream_limit, opened_at, expires_at |
From the open; overlay, stream and confidence track set_overlay, set_stream and set_confidence; a run’s live view has kind "run" |
joined |
True for a stream joined with join_stream |
outputs |
What the stream writes, as resolved at the open (WorkflowRunWrites): a deployment’s Passive capture, a workflow’s outputs; None writes only its log |
ended |
Why it ended: stopped, source_ended, idle, time_limit, container_stopped or ended, or for a run’s live view run_completed, run_failed or run_cancelled; None while running |
Each StreamFrame has result (the typed result infer() returns), index, pts,
latency_ms, capture_time and capture_ns (capture time on the sender’s clock; None until
the sender’s first report), capture_latency_ms (capture to result, on your clock), width,
height and message.
A deployment runs up to four streams per container (stream_limit in all). If it’s asleep,
the open waits about 20 seconds for a container to start.
join_stream(session) joins a running stream by id instead of opening one, such as a
workflow run’s live view (the run’s live_view.session;
watch_run finds it for you). It returns a
DeploymentStream with joined True and kind "run", which ends with its run; stop()
only stops watching. The join waits up to a minute for the run’s first frames.
Stream errors
| Status | error |
Exception | Cause and fix |
|---|---|---|---|
| 400 | invalid_source, unsafe_source |
ValidationError |
The source isn’t "whip" or an rtsp://, rtsps:// or https:// camera reachable from the internet |
| 400 | invalid_source_option |
ValidationError |
transport, buffer_mode or reconnect on a non-RTSP source, or an unknown value |
| 400 | invalid_request_body, invalid_option |
ValidationError |
The body is not JSON, or overlay or stream is not true or false |
| 400, 404, 409 | invalid_outputs |
ValidationError, NotFoundError, ConflictError |
Outputs the stream can’t write (output names which): a model’s deployment writes passive_capture alone; a missing dataset or webhook endpoint is a 404; a dataset in cold storage, or an output the endpoint can’t write until it moves onto the current engine, a 409 |
| 401 | unauthorized |
AuthError |
Not this deployment’s pk_deploy_ token |
| 404 | deployment_not_found, wrong_region |
NotFoundError |
Wrong URL; use the deployment’s endpoint_url as is |
| 404, 410 | session_not_found, session_ended |
NotFoundError, ApiError |
The stream has ended: open a new one (a run’s live view ends with its run) |
| 406 | - | ApiError |
The video or the player does not support H.264 |
| 409 | deployment_not_active |
ConflictError |
The deployment is paused or still provisioning |
| 409 | streams_unavailable |
ConflictError |
The deployment predates streams; pause and resume it once |
| 409 | run_live_view |
ConflictError |
DELETE on a run’s live view; cancel the run instead |
| 413 | request_too_large |
ApiError |
The request is over 256 KiB |
| 429 | stream_limit |
RateLimitError |
It already runs stream_limit streams; stop one, or raise max_containers |
| 502 | session_failed, deployment_unreachable, deployment_unavailable |
ServerError |
The stream didn’t start; retry (detail says why) |
| 503 | deployment_starting |
ServerError |
No container had started after about 25 seconds (its GPU is still being found); asked again automatically for up to four minutes, and 30 seconds into the wait the deployment’s fallback elsewhere in the US is asked too |
| 503 | sessions_unavailable, gateway_unavailable |
ServerError |
Retry shortly |
| 504 | session_timeout |
ServerError |
Retry |
| - | stream_switch_unavailable |
ConflictError |
set_stream on an endpoint without the stream switch (raised before any request); idle endpoints get it automatically, or pause and resume to get it now |
| - | confidence_unavailable |
ConflictError |
set_confidence on an endpoint that cannot move a running stream’s confidence (raised before any request); open the stream again with confidence= |
| - | engine_starting |
ServerError |
join_stream: the run’s engine didn’t answer within a minute (raised by the SDK); join again shortly |
While you read frames(), a dropped connection reconnects; if the stream’s engine stops,
frames() raises ServerError (code session_failed).
Live log
Every session’s and every device’s records, oldest first: each frame’s annotations, each image a stream captured, each stream’s numbers every second and its end, from a GPU in the cloud or the browser or iPhone that ran it. The record, its webhooks and REST paging: Live log guide.
logs
The deployment’s records as they arrive (live=True), or over a window, read page by page as you
loop. The filters are applied by the server: what they leave out is never sent.
Source: Deployments.logs
| Arg | Type | Default | Notes |
|---|---|---|---|
deployment |
str |
required | The deployment’s name. |
live |
bool |
False |
A live connection: the records as they arrive, until you stop looping. With since, the history from then first, then live - each record once. |
since |
str | datetime | timedelta | None |
None |
Where the history starts: "now", a duration ago ("30s", "10m", "1h30m", "2d"), an ISO 8601 time, a datetime or a timedelta ago. Default: an hour before until (with live: no history, only what arrives). |
until |
str | datetime | timedelta | None |
None |
Where it ends (the same forms; not with live). Default: now. |
kinds |
Sequence[LogKind] | None |
None |
Only these kinds: "frame", "event", "capture", "stats", "status". Default: every kind the organization’s plan logs (frames on paid plans). |
classes |
Sequence[str] | None |
None |
Only records with an annotation of these classes - each record carrying those alone. |
min_confidence |
float | None |
None |
Only annotations at least this confident (0 to 1). |
session |
str | None |
None |
One stream’s records: the stream’s id. |
every |
int | None |
None |
Every Nth frame of each stream. |
cursor |
str | None |
None |
Where to resume: after a record’s cursor (where an earlier read stopped), or from a gap’s gap.backfill (logs(name, cursor=gap_record.gap.backfill, until=gap_record.time): what the gap stood for - keep each record once by its identity). |
records = client.deployments.logs(
deployment="loading-dock",
live=True,
classes=["forklift"],
min_confidence=0.6,
)
for record in records:
print(record.time, record.session, [a.name for a in record.annotations])
pictograph deployments logs loading-dock --live --class forklift --min-confidence 0.6
# The last hour, oldest first.
pictograph deployments logs loading-dock --since 1h --class forklift
# One record a line, for jq.
pictograph deployments logs loading-dock --since 10m --json | jq -r '.annotations[].name'
# The images its streams captured today, saved into captures/.
pictograph deployments logs loading-dock --kind capture --since 1d --download captures/
curl -s "https://api.pictograph.io/api/v1/developer/deployments/loading-dock/logs?since=1h&classes=forklift&min_confidence=0.6" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
Returns Iterator[LogRecord]
LogRecord · 20 fields
class LogRecord(BaseModel):
"""One record of a Live log: every kind in one shape; the fields of another kind are `None`."""
# The record's identity, and where a read resumes after it.
cursor: str | None = None
kind: Literal['frame', 'event', 'capture', 'stats', 'status', 'gap']
time: datetime | None = None
# When the log stored it.
logged_at: datetime | None = None
deployment: str | None = None
workflow: str | None = None
# A stream's id, or a workflow run's.
session: str | None = None
# The engine run that wrote it.
run: str | None = None
# Its batch in its run.
seq: int | None = None
# Its place in its batch.
index: int | None = None
source: LogSource | None = None
model: LogModel | None = None
frame: LogFrame | None = None
annotations: list[Annotation] = []
tags: list[LogTag] = []
event: LogEvent | None = None
capture: LogCapture | None = None
stats: LogStats | None = None
status: LogStatus | None = None
gap: LogGap | None = None
# The record's identity: the same for one record wherever it was read - a history
# page, a live connection, a webhook - though a live connection's `cursor` also says
# where it arrived. Keep a gap's backfill to the records not seen yet with it.
# `None` for a record with no cursor (a `capture.saved` delivery's).
@property
def identity(self) -> tuple[Any, ...] | None: ...
A live connection opens again from where it stood whenever it drops or the server ends it (every
two minutes): nothing is lost or seen twice. A gap record stands in for records it could not
carry: read them with cursor=record.gap.backfill, until=record.time
(Gaps). Frames are logged on paid plans and kept 30 days; events,
captures, stats and statuses are logged on every plan and kept 13 months.
Live log errors
| Status | error |
Exception | Cause and fix |
|---|---|---|---|
| 400 | invalid_since, invalid_until, invalid_window |
ValidationError |
A bound that isn’t now, a duration ago or an ISO 8601 time, since after until, or until on a live connection |
| 400 | invalid_kinds, invalid_classes |
ValidationError |
A kind that isn’t frame, event, capture, stats or status, or over 100 classes |
| 400 | invalid_session |
ValidationError |
session isn’t one of the deployment’s streams (a stream’s id: 16 hex characters) |
| 400 | invalid_cursor |
ValidationError |
A cursor this log didn’t make: start again without one |
| 400 | log_range_too_large |
ValidationError |
The window reads more of the log than one page may: narrow it, or filter |
| 402 | insufficient_credits |
PaymentRequiredError |
A live connection while this month’s Live log is past the plan’s allowance and your Budget: raise the Budget in Settings > Usage |
| 403 | frames_not_logged |
ForbiddenError |
kinds names frame on a plan that logs no frames: read the other kinds, or upgrade |
| 403 | live_connection_limit |
ForbiddenError |
Every live connection the plan allows is open (one closed in the last three minutes can still count): close one, or upgrade |
| 404 | - | NotFoundError |
No deployment has that name |
| 503 | log_unavailable, live_unavailable |
ServerError |
The log, or a live connection to it, can’t be opened right now; retry shortly (the SDK and CLI do) |
Common errors
| Status | Exception | Cause |
|---|---|---|
| 400 | ValidationError |
An unknown gpu_type or precision, max_containers below min_containers, an update that changes nothing, or a model that isn’t ready |
| 402 | PaymentRequiredError |
Not enough credit to provision, resume or keep more containers warm |
| 403 | ForbiddenError |
A key below member (create, update, pause, resume, delete) |
| 404 | NotFoundError |
The deployment or model doesn’t exist |
| 409 | ConflictError |
A name in use, an action the status doesn’t allow (such as changing a failed deployment), an update that collided with another change (retry), or resuming an old CPU deployment (deploy again) |
| 422 | ValidationError |
A container count or window out of bounds (min_containers 0 to 5, max_containers 1 to 10, scaledown_window 2 to 3600), or a field update does not take |
| 502 | ServerError |
The live deployment refused an update and nothing changed; retry (the SDK retries once) |
| - | PollTimeoutError |
wait_until_active passed timeout; the deployment keeps provisioning |
Calling the endpoint: Endpoint errors. Streams: Stream errors. The Live log: Live log errors.