Installation
Install the Retrace SDK for Python or TypeScript.
Python SDK
pip install retraceRequires Python 3.10 or later. The SDK has minimal dependencies:
@google/genai- For Gemini interceptorwebsockets/websocket-client- For real-time streamingrequests- For HTTP fallback transport
TypeScript SDK
npm install retraceRequires Node.js 20 or later. ESM-only package.
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
RETRACE_API_KEY | Yes | - | Your API key (starts with rt_live_) |
RETRACE_BASE_URL | No | https://api.retrace.yashbogam.me | API endpoint |
RETRACE_PROJECT_ID | No | - | Default project for traces |
RETRACE_ENABLED | No | true | Set to false to disable recording |
[!NOTE] Get your API key from the Settings page in the dashboard.
Verify Installation
import retrace
retrace.configure(api_key="rt_live_...")
@retrace.record(name="test")
def hello():
return "world"
hello() # Check your dashboard
print("Retrace is working!")Programmatic Configuration
You can also configure the SDK programmatically instead of using environment variables:
import retrace
retrace.configure(
api_key="rt_live_...",
base_url="http://localhost:3001", # For local development
project_id="my-project-id",
)