Ratelane.

Quickstart — Python

Add Ratelane to a FastAPI app in under 5 minutes.

Install

pip install ratelane-sdk

Configure

from fastapi import FastAPI
from ratelane.config import RatelaneConfig
from ratelane.middleware import RatelaneMiddleware, close_ratelane

app = FastAPI()

config = RatelaneConfig(
    api_key="sk_live_your_api_key",
    collector_url="https://api.ratelane.dev",
    fastapi_app=app,
    instance_version="1.0.0",           # optional: your app version
    telemetry_flush_interval_seconds=30, # optional: default 30
    ep_trigger_after_seconds=10,         # optional: emergency profile trigger
)

app.add_middleware(RatelaneMiddleware, config=config)

@app.on_event("shutdown")
async def shutdown():
    await close_ratelane()

Run

uvicorn main:app --reload

Your instance will appear in the Ratelane dashboard within seconds. Routes are discovered automatically on startup.

Next steps

On this page