Installation & Setup
Prerequisites
- Python 3.10 or higher
- TurnWise account with API key
- OpenRouter API key (or other supported LLM provider)
Installation
Install the SDK using pip:Getting Your API Keys
TurnWise API Key
- Log in to TurnWise
- Go to Settings → API Keys
- Click “Create API Key”
- Copy your API key (starts with
tw_)
OpenRouter API Key
- Sign up at OpenRouter
- Go to Keys page
- Create a new API key
- Copy your API key (starts with
sk-or-)
Configuration
Environment Variables (Recommended)
Set your API keys as environment variables:Direct Configuration
Pass keys directly when creating the client:Configuration File
Create a.env file in your project root:
Verify Installation
Test your setup:Optional Configuration
Custom Base URL
For self-hosted instances or testing:Default Model
Set a default model for all evaluations:Troubleshooting
Import Errors
If you get import errors, ensure you’re using Python 3.10+:Authentication Errors
If you see authentication errors:- Verify your API keys are correct
- Check that keys are set in environment variables
- Ensure keys haven’t expired or been revoked
Connection Errors
If you can’t connect to TurnWise:- Check your internet connection
- Verify the base URL is correct
- Check if TurnWise is experiencing downtime