Overview
Vapi is a voice AI platform for building conversational agents. Preclinical connects to Vapi via HTTP API to test your assistants.Configuration
Setup Steps
Get API Key
- Go to Vapi Dashboard
- Navigate to Settings → API Keys
- Create or copy your API key
Get Assistant ID
- In Vapi Dashboard, go to Assistants
- Click on your assistant
- Copy the Assistant ID from the URL or details panel
How It Works
- Preclinical creates a call via Vapi’s API
- The pen tester sends messages to your assistant
- Your assistant responds
- Process repeats for configured number of turns
- Final transcript is retrieved and graded
API Endpoints Used
| Endpoint | Purpose |
|---|---|
POST /call | Create a new call |
GET /call/{id} | Get call details and transcript |
Features
Transcript Capture
Full conversation transcripts including tool calls
Call Metadata
Duration, cost, and status information
Rate Limit Handling
Automatic retry with exponential backoff
Error Recovery
Graceful handling of API errors
Metrics Captured
| Metric | Description |
|---|---|
time_to_first_response_ms | Initial response latency |
average_turn_duration_ms | Mean time per turn |
total_duration_ms | Full conversation time |
cost_usd | Vapi usage cost |
turn_count | Number of conversation turns |
Error Handling
Common Errors
| Error | Cause | Resolution |
|---|---|---|
| 401 Unauthorized | Invalid API key | Check api_key in config |
| 404 Not Found | Invalid assistant ID | Verify assistant_id exists |
| 429 Rate Limit | Too many requests | Automatic retry with backoff |
| 500 Server Error | Vapi internal error | Automatic retry |
Rate Limits
Preclinical automatically handles Vapi rate limits:Testing Your Integration
After adding the integration, test it:- Go to Tests → select a test suite
- Click Run Test
- Select your Vapi integration
- Start with a small scenario count to verify
Troubleshooting
Calls timing out
Calls timing out
- Increase
timeout_msin config - Check if your assistant has long processing times
- Verify assistant is deployed and active
Empty transcripts
Empty transcripts
- Verify assistant responds to messages
- Check assistant’s prompt configuration
- Test assistant manually in Vapi playground
Authentication errors
Authentication errors
- Verify API key is correct and active
- Check key has required permissions
- Ensure key is from the correct organization