Use OpenAPI TS library to generate a type safe TypeScript client for the Browser Use API.The following guide shows how to create a simple type-safe fetch client, but you can also use other generators.
// client.ts'use client'import createClient from 'openapi-fetch'import { paths } from '@/lib/api/v1'export type Client = ReturnType<typeof createClient<paths>>export const client = createClient<paths>({ baseUrl: 'https://api.browser-use.com/', // NOTE: You can get your API key from https://cloud.browser-use.com/billing! headers: { Authorization: `Bearer ${apiKey}` },})