This guide helps you manually test the AI routing fix to ensure all models correctly route to the /api/completion endpoint.
- ✅ Authentication: Login to https://vtchat.io.vn
- ✅ VT+ Subscription: Required to test VT+ models
- ✅ Browser DevTools: Open Network tab to monitor requests
Note: Claude Sonnet 4.5 is now the default selection. Switch to the free Gemini 3 Flash Lite Preview model before running this scenario.
- Model: Gemini 3 Flash Lite Preview
- Expected: Routes to
/api/completion(managed VT+ flow) - Test: Send a simple message like "Hello, test free model"
Test these models should all route to /api/completion:
- Claude Sonnet 4.5 ✅
- Claude 4 Sonnet ✅
- Claude 4 Opus ✅
- GPT 4o ✅
- GPT 4o Mini ✅
- Gemini 3 Pro ✅
- Gemini 3 Flash ✅
- DeepSeek R1 (Fireworks) ✅
- Grok 4 (xAI) ✅
These should always route to /api/completion:
- Deep Research ✅
- Pro Search ✅
- Go to https://vtchat.io.vn
- Click login and authenticate
- Verify you see "VT+" in the interface
- Press F12 or right-click → Inspect
- Go to Network tab
- Filter by "completion" to see
/api/completioncalls
For each model in the list above:
- Select Model: Click model selector → Choose model
- Send Message: Type "Test routing for [model name]"
- Check Network: Look for
/api/completionrequests - Verify: ✅ if
/api/completionis called, ❌ if not
- Select "Deep Research" from model selector
- Send a research query like "Research latest AI developments"
- Verify
/api/completionis called - Repeat for "Pro Search"
- VT+ models call
/api/completion - VT+ exclusive features call
/api/completion - Free models may call either endpoint
- No authentication errors for VT+ users
- VT+ models don't call
/api/completion - VT+ features use client-side routing
- Authentication errors for valid users
Request URL: https://vtchat.io.vn/api/completion
Method: POST
Status: 200 OK
Content-Type: application/jsonAuthorization: Bearer [token](if applicable)
mode: Selected model (e.g., "claude-4-sonnet")messages: User messageshasVtPlus: true (for VT+ users)
Symptoms: VT+ models using client-side routing
Fix: Check shouldUseServerSideAPI() function in packages/common/lib/ai-routing.ts
Symptoms: "Invalid API key" errors
Fix: Check filterApiKeysForServerSide() function removes provider keys
Symptoms: Login dialogs for authenticated users Fix: Check session validation in routing logic
# Test the routing functions
bun test packages/common/tests/ai-routing.test.ts# Verify app builds correctly
bun run build# Check application logs
bun run dev# Install dependencies
npm install playwright
# Run verification
node verify-routing-fix.js
# Run detailed tests (after login)
node test-routing-detailed.js- Free models work correctly
- All VT+ models route to
/api/completion - VT+ exclusive features route to
/api/completion - No authentication errors for VT+ users
- API keys are properly filtered for server-side calls
- Network requests show correct routing
- No console errors related to routing
If you find any issues, please report:
- Model name and provider
- Expected vs actual routing
- Network request details
- Console errors (if any)
- Steps to reproduce
- Routing Logic:
packages/common/lib/ai-routing.ts - Tests:
packages/common/tests/ai-routing.test.ts - Implementation:
packages/common/hooks/agent-provider.tsx - Deployment: https://vtchat.io.vn (v2.4.6)