Research AI API Testing
Overview
This documentation describes how to switch between the RAI Production API and the RAI Development API on the stage environment. This enables internal testing of both API versions without requiring code changes.
Cookie-based API Switching
Cookie Name
useRaiDevUrl
Accepted Values
true- Enables the RAI Dev API- Not set - Uses the RAI Prod API (default)
Prerequisites
For the Dev API to be used, both conditions must be met:
- ✅ Cookie
useRaiDevUrlis set totrue - ✅ Environment variable
APP_AI_SUMMARY_KEY_DEVis defined
Setting the Cookie
Using Browser DevTools
- Open Browser DevTools (F12)
- Go to the Application tab (Chrome) or Storage tab (Firefox)
- Navigate to Cookies → Select the domain
- Click "Add Cookie" or create a new cookie:
- Name:
useRaiDevUrl - Value:
true
- Name:
Testing Workflow
Scenario 1: Testing RAI Dev API
- Set the cookie:
useRaiDevUrl=true - Reload the page
- Execute Research AI requests (summaries, suggestions, etc.)
- All requests go to Dev API
Scenario 2: Testing RAI Prod API
- Delete the cookie or set:
useRaiDevUrl=false - Reload the page
- Execute Research AI requests
- All requests go to the default Prod API
Important Notes
⚠️ Cookie Persistence
- The cookie remains set until it is deleted or expires
- Don't forget to remove the cookie after testing
⚠️ Session
- After setting/deleting the cookie, the page must be reloaded
- Already open API connections are not affected