Client Libraries
Python SDK
Official Python client for ByteKit, with sync and async support.
The official Python SDK is generated from the ByteKit OpenAPI spec, so its models and methods always match the API. Every operation ships in both synchronous and asynchronous form.
Install
pip install bytekitYour first scrape
from bytekit import AuthenticatedClient
from bytekit.api.scrape import create_scrape
from bytekit.models.scrape_request import ScrapeRequest
from bytekit.models.scrape_request_formats_item import ScrapeRequestFormatsItem
from bytekit.models.scrape_success_envelope import ScrapeSuccessEnvelope
client = AuthenticatedClient(
base_url="https://api.bytekit.com",
token="sk_live_your_api_key_here",
)
# Request the markdown format explicitly — otherwise response.formats.markdown is UNSET.
body = ScrapeRequest(
url="https://example.com",
formats=[ScrapeRequestFormatsItem.MARKDOWN],
)
response = create_scrape.sync(client=client, body=body)
# .sync() returns None on a transport error, and a queued/error envelope on the
# async or failure paths. Only a ScrapeSuccessEnvelope carries populated formats.
if response is None:
print("Request failed — no response returned.")
elif isinstance(response, ScrapeSuccessEnvelope) and isinstance(response.formats.markdown, str):
print(response.formats.markdown)
else:
# Queued (ScrapeQueuedEnvelope) or error (ScrapeErrorEnvelope) — inspect `response`.
print(f"Scrape not complete: {response}")Each operation exposes four call styles:
create_scrape.sync(...)— returns the parsed model (orNone).create_scrape.sync_detailed(...)— returns the fullResponse(status code, headers, body).create_scrape.asyncio(...)— awaitable form ofsync.create_scrape.asyncio_detailed(...)— awaitable form ofsync_detailed.
Async usage
import asyncio
from bytekit import AuthenticatedClient
from bytekit.api.screenshots import create_screenshot
from bytekit.models.screenshot_request import ScreenshotRequest
async def main():
client = AuthenticatedClient(
base_url="https://api.bytekit.com",
token="sk_live_your_api_key_here",
)
body = ScreenshotRequest(url="https://example.com")
response = await create_screenshot.asyncio(client=client, body=body)
print(response)
asyncio.run(main())What's available
Operations are grouped by capability under bytekit.api.*: scrape, scrape_bulk,
screenshots, recordings, bulk, fetch, fetch_bulk, monitors, sitemap, and
account.
See the Python SDK Reference for every module, function, and model.
Next steps
- TypeScript SDK — the same API surface in TypeScript.
- API Reference — the underlying REST endpoints.
- Errors — error codes and retry guidance.