Skip to main content
1

Install the SDK

uv add tzafon
2

Get Your API Key

Sign up at tzafon.ai and copy your API key from the dashboard.Set it as an environment variable:
export TZAFON_API_KEY=sk_your_api_key_here
Add this to your .env or .env.local file.
3

Write Your First Script

from tzafon import Computer

client = Computer()
with client.create(kind="browser") as computer:
    computer.navigate("https://wikipedia.org")
    computer.wait(2)

    result = computer.screenshot()
    url = computer.get_screenshot_url(result)
    print(f"Screenshot: {url}")
4

Run It

uv run your_script.py
You should see a screenshot URL printed to the console.

What Just Happened?

  1. Initialized a Tzafon client with your API key
  2. Created a browser instance
  3. Navigated to Wikipedia
  4. Captured a screenshot
The screenshot URL is returned and you can view or download it.

Customize Session Settings

computer = client.create(
    kind="browser",
    timeout_seconds=3600,
    inactivity_timeout_seconds=120,
    display={"width": 1280, "height": 720, "scale": 1.0},
    context_id="quickstart-demo",
)
ParameterTypeDescription
kindstring"browser" or "desktop"
timeout_secondsintMaximum session lifetime
inactivity_timeout_secondsintIdle timeout before auto-termination
displayobjectViewport dimensions: {width, height, scale}
context_idstringCustom ID for request correlation
auto_killboolAuto-terminate on inactivity (default: true)
persistentboolSave session state for reuse
environment_idstringRestore state from a previous persistent session
use_advanced_proxyboolUse advanced residential proxy (browser only)
Use persistent to create a reusable state, then pass the returned session id as environment_id later. If you want the restored session to be saved again, set persistent: true on that run.
See Session Lifecycle for details on timeouts and billing.

Next Steps

Core Concepts

Understand execution modes and computer types

Actions Reference

Explore all available actions

Example

See a complete working example

Pricing

View usage-based pricing

Need Help?