- a resumable chunked uploader for large WSIs,
- typed dataclasses for requests and responses,
- SSE streaming for live job status,
- and an optional
AnnDataround-trip for results.
Install
Configuration
| Source | Variable / argument | Default |
|---|---|---|
| Env | STRAND_API_KEY | required |
| Env | STRAND_BASE_URL | https://app.strandai.com |
| Arg | Client(api_key=..., base_url=..., timeout=..., max_retries=...) | n/a |
Uploads
upload_file runs the three-step resumable flow under the hood
(initiate → chunked PUT to GCS → complete). Chunks are 8 MiB by default
and can be tuned via chunk_size.
Predict
| Method | What it does |
|---|---|
client.predict.estimate(upload_id, markers) | Compute the credit cost without reserving credits. |
client.predict.submit(upload_id, markers, model=...) | Reserve credits and enqueue. Returns a Job. |
Selecting a model
predict.submit and predict(...) accept an optional model=. Live Lattice
versions:
"v0.4": 192-marker panel, original training."v0.5": 192-marker panel, retrained (current default).
model to let the platform pick the current default ("v0.5").
"v10", "v10-fullpanel", and "v10-fullpanel-v2" names are
still accepted as deprecated aliases with a DeprecationWarning; pin the
canonical v0.X id to silence the warning and forward-protect against the
2026-12-01 alias sunset. The "v10" alias resolved to the now-sunset v0.3
and is rejected with 400 unknown_model.
Submit without waiting
A full pipeline run blocks for 15+ minutes. To kick a job off and continue with other work, passwait=False, and predict(...) returns a Job handle
as soon as the upload + submit complete:
wait flag: wait=True returns PredictResult and
wait=False returns Job, so IDE completions stay correct without a runtime
check.
Jobs
| Method | What it does |
|---|---|
job.refresh() | Refetch the latest JobStatus snapshot. |
job.wait(timeout=...) | Block until completed or failed. |
job.stream_events() | Iterate over SSE JobEvents. |
job.download_results() | Returns an AnnData (default) or writes to a path. |
Errors
All errors inherit fromStrandError. Typed subclasses map HTTP codes
1:1 so you can except precisely:
| Exception | HTTP |
|---|---|
AuthError | 401 |
BadRequestError | 400 |
InsufficientCreditsError | 402 (carries .required) |
NotFoundError | 404 |
RateLimitError | 429 (carries .retry_after) |
JobFailedError | n/a (terminal status failed) |
JobTimeoutError | n/a (wait() timeout) |
UploadError | n/a (GCS resumable session failed) |
Public surface
See also
- Quickstart: five-minute walkthrough.
- REST API overview: the underlying HTTP surface.
- Pricing: how credits map to slides × markers.