Quickstart

Get up a running with your first Steel Session in a few minutes.

Overview

This guide will walk you through setting up your Steel account, creating your first browser session in the cloud, and driving it using TypeScript/Playwright. In just a few minutes, you'll be up and programmatically controlling a Steel browser Session.

Initial Setup

1. Create a Steel Account

  1. 1

    Sign up for a free account at steel.dev

  2. 2

    Launch includes $30 in one-time free usage credits, valid for 90 days. See Pricing/Limits for current rates and limits.

  3. 3

    No credit card required

2. Get Your API Key

  1. 1

    After signing up, navigate to Settings > API Keys

  2. 2

    Create an API key and save it somewhere safe. You will not be able to generate the same key again.

3. Set Up Environment Variables

  1. 1

    Create a .env file in your project root (if you don't have one)

  2. 2

    Add your Steel API key:

STEEL_API_KEY=ste-your-api-key-here

Make sure to add .env to your .gitignore file to keep your key secure

Installing Dependencies

Install the Steel SDK, Playwright, dotenv to load your .env file, and tsx to run TypeScript:

Terminal
$
npm install steel-sdk playwright dotenv tsx

Using Python? pip install steel-sdk playwright, then playwright install chromium. The PyPI package is steel-sdk, but the import is from steel import Steel.

Create Your First Session

Save the following as steel-client.ts. It creates a session, connects with Playwright, visits a page, and releases the session even if a browser operation fails:

Typescript
steel-client.ts
1
import Steel from 'steel-sdk';
2
import { chromium } from 'playwright';
3
import 'dotenv/config';
4
5
async function main() {
6
const apiKey = process.env.STEEL_API_KEY;
7
if (!apiKey) {
8
throw new Error('Set STEEL_API_KEY in your .env file');
9
}
10
11
const client = new Steel({
12
steelAPIKey: apiKey,
13
});
14
15
const session = await client.sessions.create();
16
console.log('Session created:', session.id);
17
console.log(`View live session at: ${session.sessionViewerUrl}`);
18
19
try {
20
const browser = await chromium.connectOverCDP(
21
`wss://connect.steel.dev?apiKey=${encodeURIComponent(apiKey)}&sessionId=${session.id}`,
22
);
23
const page = await browser.contexts()[0].newPage();
24
await page.goto('https://example.com');
25
console.log('Page title:', await page.title());
26
} finally {
27
// Releasing the session closes its remote browser and connection.
28
await client.sessions.release(session.id);
29
console.log('Session released');
30
}
31
}
32
33
main().catch((error) => {
34
console.error(error);
35
process.exitCode = 1;
36
});

Run it from the directory containing your .env file:

npx tsx steel-client.ts

Session Features

To configure your session, replace the client.sessions.create() call inside main() with the following options:

Typescript
1
const session = await client.sessions.create({
2
useProxy: true, // Use Steel's residential proxy network
3
solveCaptcha: true, // Enable automatic CAPTCHA solving
4
timeout: 600000, // Set 10-minute timeout (default is 5 minutes)
5
inactivityTimeout: 300000, // Release after 5 minutes of inactivity
6
userAgent: 'custom-ua' // Set a custom user agent
7
});

You've now created your first Steel session and learned the basics of session management. With these fundamentals, you can start building more complex automations using Steel's cloud browser infrastructure.

Need help building with the Sessions API?

Reach out to us on the #help channel on Discord under the ⭐ community section.

FAQ