Skip to main content

Quickstart

1. Get an API key

Go to data.build.ai/get-access and sign in with Google. If you have a @build.ai email you’ll get a key instantly. Otherwise, request access and we’ll get back to you.
export BUILDAI_API_KEY="build_live_..."

2. Browse a factory

from buildai import Client

client = Client()

factories = client.factories.list(page_size=3)
for factory in factories.items:
    print(factory.factory_id, factory.name, f"{factory.clip_count} clips")

3. Watch a clip

clips = client.clips.list(factory_id="FACTORY_ID", page_size=1)
clip = clips.items[0]

# Get a signed URL and open it
video = client.clips.video(clip.clip_id)
print(video.signed_url)  # paste in browser to watch

# Or download it
import requests
resp = requests.get(video.signed_url)
with open("clip.mp4", "wb") as f:
    f.write(resp.content)

4. View frames

from IPython.display import Image, display

frames = client.clips.frames(clip.clip_id, page_size=5)
for frame in frames.items:
    print(f"frame {frame.frame_index} @ {frame.timestamp_seconds}s — {frame.width_pixels}x{frame.height_pixels}")
    display(Image(url=frame.image_url, width=400))  # renders in Jupyter

5. Search for something

results = client.search("person soldering a circuit board")
for match in results.items:
    print(f"{match.similarity_score:.3f}{match.match_summary}")
    if match.preview_image_url:
        display(Image(url=match.preview_image_url, width=400))

6. Get a dataset

datasets = client.datasets.list()
for ds in datasets.items:
    print(ds.name, f"{ds.clip_count} clips")

# Get WebDataset shard URLs for training
urls = client.datasets.webdataset_urls(datasets.items[0].name)
print(f"{len(urls)} shards ready for training")